public function preDelete() { $product = DatabaseObject_Helper_ProductDisplay::getBasicProductInfo($this->_db, $this->product_id); if ($product[0]['purchase_type'] == 'Buy_now') { //remove color from product_colors; echo 'here at color removal'; $colors = array(); $colors['' . $this->sys_color . ''] = 0; DatabaseObject_Helper_ManageAttribute::insertProductColors($this->_db, 'product_colors', $this->product_id, $colors); } $this->getImages(); foreach ($this->images as $image) { $image->delete(false); } $this->profile->delete(); return true; }
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); } }