Example #1
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
 }