public function deleteinventoryAction()
 {
     $inventoryId = $this->request->getParam('id');
     $inventoryProduct = new DatabaseObject_Inventory_Product($this->db);
     //check inventory_purchase_type
     $inventoryProduct->load($inventoryId);
     $product = DatabaseObject_Helper_ProductDisplay::getBasicProductInfo($this->db, $inventoryProduct->product_id);
     if ($inventoryProduct->delete()) {
         if ($product[0]['purchase_type'] == 'Buy_now') {
             if (DatabaseObject_Helper_ProductListing::updateProductStatus($this->db, 'products', $this->signedInUserSessionInfoHolder->generalInfo->userID, $product[0]['product_id'], 'Removed')) {
                 $this->messenger->addMessage('This item had been removed.');
                 $this->_redirect('/productlisting/viewpendingproduct');
             } else {
                 $this->messenger->addMessage('Error at delete inventory');
                 $this->_redirect('/index/error');
             }
         } elseif ($product[0]['purchase_type'] == 'Customizable') {
             $this->messenger->addMessage('This item had been deleted.');
             $this->_redirect($_SERVER['HTTP_REFERER']);
         }
     }
 }
Пример #2
0
 public function process(Zend_Controller_Request_Abstract $request)
 {
     $this->fabricSetParam = $request->getParam('fabricSet');
     Zend_Debug::dump($this->fabricSetParam);
     Zend_Debug::dump($_FILES['fabricSetImage']);
     foreach ($this->fabricSetParam as $k => $v) {
         $this->fabricSetName[] = $k;
     }
     Zend_Debug::dump($this->fabricSetName[0]);
     foreach ($this->fabricSetParam[$this->fabricSetName[0]]['name'] as $k => $v) {
         $this->fabricSetKey[] = $k;
     }
     Zend_Debug::dump($this->fabricSetKey);
     $this->fabricSet->name_of_set = $this->fabricSetName[0];
     $this->fabricSet->uploader_id = $this->userID;
     if (!DatabaseObject_Helper_ProductListing::confirmattributenamewithuploader($this->db, 'fabric_set', $this->userID, $this->fabricSetName[0])) {
         $this->fabricSet->save();
         $this->attributeID = $this->fabricSet->getId();
         echo 'here at no error';
         return true;
     } else {
         echo 'here at errors';
         $this->addError('duplicate', 'this is a duplicate');
         return !$this->hasError();
     }
     //return true if no errors have occurred
 }
Пример #3
0
 public static function removeProductAndInventoryImage($db, $fatherTable, $imagetable, $product_tag, $imageID, $postID, $userID)
 {
     if ($product_tag == 'inventory') {
         $okayBool = DatabaseObject_Helper_InventoryManager::verifyInventoryItemForUser($db, $postID, $userID);
     } else {
         $okayBool = DatabaseObject_Helper_ProductListing::confirmproductforuploader($db, $fatherTable, $userID, $postID);
     }
     if ($okayBool) {
         $image = new DatabaseObject_Image($db, $imagetable, $product_tag);
         if ($image->loadForPost($postID, $imageID)) {
             echo 'here at load image';
             if ($image->delete()) {
                 echo 'here at delete image';
                 return true;
             } else {
                 return false;
             }
         } else {
             echo 'image not loaded';
         }
     } else {
         echo 'You have no permission to perform this action';
         return false;
     }
 }
 public function listingpreviewAction()
 {
     $id = $this->request->getParam('id');
     $product_type = $this->request->getParam('product');
     //error check for type;
     //$product = ObjectGenerator::generateProductForListing($this->db, $product_type);
     $product = new DatabaseObject_Products($this->db);
     echo $this->signedInUserSessionInfoHolder->generalInfo->userID;
     $product->getProductForUser($this->signedInUserSessionInfoHolder->generalInfo->userID, $id);
     $this->view->product = $product;
     //load all image attribute for order
     //*******************IMAGES ATTRIBUTE*****************************//
     $selectColumnOptions = array('group' => true, 'value' => array('image_attribute_id', 'attribute_name', 'image_name', 'price_adjustment'));
     $attributeArray = DatabaseObject_Helper_ProductListing::getImageAttribute($this->db, $product->Username, $product_type, $id, $selectColumnOptions);
     $selectColumnOptions = array('group' => false, 'value' => array('image_attribute_id', 'attribute_name', 'image_name', 'price_adjustment'));
     $imageAttribute = DatabaseObject_Helper_ProductListing::getImageAttribute($this->db, $product->Username, $product_type, $id, $selectColumnOptions);
     $this->view->attributeArray = $attributeArray;
     $this->view->imageAttribute = $imageAttribute;
     //load all measurement w/ image attribute for order
     //*******************MEASUREMENT ATTRIBUTE*************************//
     $selectColumnOptions = array('group' => false, 'value' => array('measurement_attribute_id', 'measurement_name', 'beginning_measurement', 'ending_measurement', 'incremental_measurement', 'price_adjustment', 'filename', 'video_youtube', 'description'));
     $measurementAttribute = DatabaseObject_Helper_ProductListing::getMeasurementAttribute($this->db, $product->Username, $product_type, $id, $selectColumnOptions);
     $this->view->measurementAttribute = $measurementAttribute;
     //load all sizing attribute for order
     //*******************SIZE ATTRIBUTE*******************************//
     $selectColumnOptions = array('group' => true, 'value' => array('size_attribute_id', 'attribute_name', 'size_name', 'price_adjustment'));
     $sizeAttributeArray = DatabaseObject_Helper_ProductListing::getSizeAttribute($this->db, $product->Username, $product_type, $id, $selectColumnOptions);
     $selectColumnOptions = array('group' => false, 'value' => array('size_attribute_id', 'attribute_name', 'size_name', 'price_adjustment'));
     $sizeAttribute = DatabaseObject_Helper_ProductListing::getSizeAttribute($this->db, $product->Username, $product_type, $id, $selectColumnOptions);
     $this->view->sizeAttributeArray = $sizeAttributeArray;
     $this->view->sizeAttribute = $sizeAttribute;
     //********************RETRIEVE INVENTORY ITEMS*********************//
     $inventoryItems = DatabaseObject_Helper_InventoryManager::retriveAllInventoryForSpecificProduct($this->db, $product->Username, $product_type, $id);
     //Zend_Debug::dump($inventoryItems);
     $this->view->inventoryItems = $inventoryItems;
     //load review for product
 }
 public function saveproductattributeAction()
 {
     $productID = $this->request->getParam('id');
     Zend_Debug::dump($this->request->getParams());
     echo 'product id is: ' . $productID;
     if (DatabaseObject_Helper_ProductListing::confirmproductforuploader($this->db, 'products', $this->signedInUserSessionInfoHolder->generalInfo->userID, $productID)) {
         echo 'here good at product';
         $colors = $this->request->getParam('color');
         if (count($colors) == 0) {
             $this->messenger->addMessage('please select at least one major color categories this product belongs to.');
             $this->_redirect($_SERVER['HTTP_REFERER']);
         }
         Zend_Debug::dump($colors);
         foreach ($this->productConfig['attribute_categories_details']['color'] as $k => $v) {
             if (isset($colors[$v])) {
                 $colors[$v] = 1;
                 echo $v . '<br/>';
             } else {
                 $colors[$v] = 0;
             }
         }
         //Zend_Debug::dump($colors);
         $product = DatabaseObject_Helper_ProductDisplay::getBasicProductInfo($this->db, $productID);
         $inventory_attribute_table = $product[0]['inventory_attribute_table'];
         if ($inventory_attribute_table == 'shoes') {
             //echo 'editing shoes';
             $shoesAttribute['product_id'] = $productID;
             $shoesAttribute['shoes_metric'] = $this->request->getParam('shoes_metric');
             $shoesAttribute['min_size'] = $this->request->getParam('min_size');
             $shoesAttribute['max_size'] = $this->request->getParam('max_size');
             $shoesAttribute['size_interval'] = $this->request->getParam('size_interval');
             $shoesAttribute['ts_created'] = date('Y-m-d G:i:s');
             //insert shoes attribute
             DatabaseObject_Helper_ManageAttribute::insertShoeProductAttribute($this->db, 'product_shoes_attributes', $productID, $shoesAttribute);
             //insert shoes heel
             $heels = $this->request->getParam('heel');
             if (count($heels) == 0) {
                 $this->messenger->addMessage('please select at least one heel size for this product.');
                 $this->_redirect($_SERVER['HTTP_REFERER']);
             }
             Zend_Debug::dump($heels);
             foreach ($this->productConfig['attribute_categories_details']['heel'] as $k => $v) {
                 if (isset($heels[$v])) {
                     $heels[$v] = 1;
                     echo $v . '<br/>';
                 } else {
                     $heels[$v] = 0;
                 }
             }
             DatabaseObject_Helper_ManageAttribute::insertShoeHeelAttribute($this->db, 'product_shoes_heel', $productID, $heels);
         }
         DatabaseObject_Helper_ManageAttribute::insertProductColors($this->db, 'product_colors', $productID, $colors);
         $this->messenger->addMessage('product attribute saved');
         $this->_redirect('manageinventory/addinventory?id=' . $productID);
     }
 }