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);
 }
 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
 }