コード例 #1
1
ファイル: Product.php プロジェクト: vinnivinsachi/Vincent-DR
 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;
 }
コード例 #2
1
 public function additemtoshoppingcartAction()
 {
     $request = $this->getRequest();
     $id = $this->getRequest()->getParam('id');
     $purchase_type = $this->getRequest()->getParam('product');
     $currentItem = array();
     $product = array();
     if ($purchase_type == 'Inventory') {
         $product = DatabaseObject_Helper_ProductDisplay::retrieveProductFromInventoryForPurchaseDetails($this->db, $id);
         //echo 'product count is: '.count($product);
         Zend_Debug::dump($product);
         if (count($product) > 0) {
             echo 'here';
             $currentItem = DatabaseObject_Helper_ShoppingcartManager::setInventoryProductInfoForCart($product);
             $currentItem['product_type_added_to_shopping_cart'] = 'Inventory';
             $this->shoppingCartInfoSession->productInfo[] = $currentItem;
             $this->shoppingCartInfoSession->cartInfo->tempTotalCost += $this->shoppingCartInfoSession->cartInfo->totalCost + $currentItem['product_price'];
             $this->shoppingCartInfoSession->cartInfo->totalRewardPoints = $this->shoppingCartInfoSession->cartInfo->totalRewardPoints + $currentItem['reward_points_awarded'];
             Zend_Debug::dump($currentItem);
             $this->shoppingCartInfoSession->cartInfo->totalItems = $this->shoppingCartInfoSession->cartInfo->totalItems + 1;
         }
     } elseif ($purchase_type == 'Customize') {
         $product = DatabaseObject_Helper_ProductDisplay::retrieveProductFromProductsForPurchaseDetails($this->db, $id);
         if (count($product) > 0) {
             $currentItem = DatabaseObject_Helper_ShoppingcartManager::setCustomizeBasicProductInfoForCart($product);
             $currentItem['product_type_added_to_shopping_cart'] = 'Customize';
             foreach ($this->getRequest()->getParam('attribute') as $k => $v) {
                 $currentItem['attributes'][$k] = $v;
             }
             $this->shoppingCartInfoSession->productInfo[] = $currentItem;
             $this->shoppingCartInfoSession->cartInfo->tempTotalCost += $this->shoppingCartInfoSession->cartInfo->totalCost + $currentItem['product_price'];
             $this->shoppingCartInfoSession->cartInfo->totalRewardPoints = $this->shoppingCartInfoSession->cartInfo->totalRewardPoints + $currentItem['reward_point'];
             $this->shoppingCartInfoSession->cartInfo->totalItems = $this->shoppingCartInfoSession->cartInfo->totalItems + 1;
         }
     }
     //Zend_Debug::dump($currentItem);
     $this->messenger->addMessage('Product added to shopping cart.');
     $this->_redirect($_SERVER['HTTP_REFERER']);
     //$this->sendJSON($currentItem);
 }
コード例 #3
1
 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']);
         }
     }
 }
コード例 #4
0
 public function purchasedetailsAction()
 {
     $id = $this->getRequest()->getParam('number');
     $productType = $this->getRequest()->getParam('product');
     $referral = $this->getRequest()->getParam('referral');
     if (isset($referral)) {
         $this->view->referral = $referral;
     }
     if (in_array($productType, $this->productConfig['productDisplay']['search_table'])) {
         if ($productType == 'inventory') {
             $product = DatabaseObject_Helper_ProductDisplay::retrieveProductFromInventoryForPurchaseDetails($this->db, $id);
             //$this->view->currentHREF=$_SERVER['REQUEST_URI'];
             if (count($product) == 0) {
                 $this->messenger->addMessage('Wrong selection');
                 $this->_redirect('/index/error');
             }
         } elseif ($productType == 'products') {
             $product = DatabaseObject_Helper_ProductDisplay::retrieveProductFromProductsForPurchaseDetails($this->db, $id);
             if ($product[0]['purchase_type'] != 'Customizable' || count($product) == 0) {
                 $this->messenger->addMessage('Wrong selection');
                 $this->_redirect('/index/error');
             }
             if ($product[0]['inventory_attribute_table'] == 'shoes') {
                 //if there are no shoe attributes, redirect
                 $measurement = array();
                 $i = $product['systemColorAndShoesAttributes']['shoes'][0]['min_size'];
                 while ($i < $product['systemColorAndShoesAttributes']['shoes'][0]['max_size'] + 0.5) {
                     $measurement[] = $i;
                     $i = $i + 0.5;
                 }
                 $this->view->measurements = $measurement;
                 $heels = array();
                 foreach ($product['systemColorAndShoesAttributes']['heels'][0] as $key => $value) {
                     if ($key != 'product_id') {
                         if ($value == 1) {
                             $heels[] = $this->productConfig['attribute_conversion_details']['heel_sizes'][$key];
                         }
                     }
                 }
                 //Zend_Debug::dump($this->productConfig['attribute_conversion_details']['heel_sizes']);
                 $this->view->heels = $heels;
             }
         }
         $this->view->product = $product;
         //echo 'here';
         Zend_Debug::dump($product);
         if ($this->getRequest()->isXmlHttpRequest()) {
             $this->view->layout = 'purchasedetailsAJAX';
         } else {
             $this->view->layout = 'purchasedetails';
         }
         $shoutboxMessages = DatabaseObject_Helper_Communication::retriveShoutOutForProduct($this->db, $product[0]['product_id']);
         $this->view->shoutboxMessages = $shoutboxMessages;
         $this->view->detailPartial = '_' . $productType . 'Details.tpl';
     } else {
         $this->_redirect('/index/error');
     }
     //publicShoutbox messages
 }
コード例 #5
0
 public function viewpendingproductAction()
 {
     //mapper instantiation:
     $this->productType = $this->request->getParam('product');
     $this->productTag = $this->request->getParam('tag');
     if ($this->productTag != '' && in_array($this->productTag, $this->productConfig['product_tag'])) {
         $options['product_tag'] = $this->product_tag;
         //$options['status']=array('Listed', 'Unlisted');
         $options['no_options'] = false;
     } else {
         $options['no_options'] = true;
     }
     $status = $this->request->getParam('status');
     if (isset($status)) {
         $options['status'][] = $this->request->getParam('status');
     } else {
         $options['status'] = array('LISTED', 'UNLISTED');
     }
     $productList = Application_Model_Mapper_Products_ProductsMapper::retrieveAllProduct($this->_db, 'products', 1, 'member', $options);
     //Zend_Debug::dump($productList);
     $this->view->productList = $productList;
     $menuOptions['status'] = array('LISTED', 'UNLISTED');
     $tags = DatabaseObject_Helper_ProductDisplay::retrieveSingleTagForProduct($this->db, 'products', $this->signedInUserSessionInfoHolder->generalInfo->userID, $menuOptions);
     $this->view->tagArray = $tags;
     //Zend_Debug::dump($tags);
     //Zend_Debug::dump($this->productConfig['upload_menu_item']);
     //$menuBar=array();
     $menuBars = DatabaseObject_Helper_UtilityManager::setTagMenuForProductListing($tags);
     Zend_Debug::dump($menuBars);
     $this->view->menuBars = $menuBars;
     $brand = DatabaseObject_Helper_ProductDisplay::retrieveBrandForProduct($this->db, 'products', $this->signedInUserSessionInfoHolder->generalInfo->userID, $this->product_tag);
     $this->view->brands = $brand;
 }
コード例 #6
-1
 public function indexAction()
 {
     //$tag=$this->getRequest->getParam('tag');
     //$purchasetype=$this->getRequest->getParam('purchasetype');
     $this->breadcrumbs->addStep('My compare chart', '');
     Zend_Debug::dump($this->compareChart->comparechart);
     //Zend_Debug::dump($this->searchOptions);
     //			Zend_Debug::dump($this->searchOptions);
     if ($this->auth->hasIdentity()) {
         $products = DatabaseObject_Helper_ProductDisplay::retrieveCompareChartProductsForDisplay($this->db, DatabaseObject_Helper_CompareChartManager::retrieveCompareChart($this->db, $this->signedInUserSessionInfoHolder->generalInfo->userID));
     } else {
         $products = DatabaseObject_Helper_ProductDisplay::retrieveCompareChartProductsForDisplay($this->db, $this->compareChart->comparechart);
     }
     //Zend_Debug::dump($productExistingAttribute);
     Zend_Debug::dump($products);
     $this->view->products = $products;
     $this->render('productdisplay/index', null, true);
     //Zend_Debug::dump($_SERVER);
 }
コード例 #7
-1
 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);
     }
 }