Example #1
0
 public function getTotals()
 {
     if (is_null($this->_totals)) {
         return parent::getTotals();
     }
     return $this->_totals;
 }
Example #2
0
 /**
  * Prepare Quote Item Product URLs
  *
  */
 public function __construct()
 {
     parent::__construct();
     // prepare cart items URLs
     $products = array();
     /* @var $item Mage_Sales_Model_Quote_Item */
     foreach ($this->getItems() as $item) {
         $product = $item->getProduct();
         $option = $item->getOptionByCode('product_type');
         if ($option) {
             $product = $option->getProduct();
         }
         if ($item->getStoreId() != Mage::app()->getStore()->getId() && !$item->getRedirectUrl() && !$product->isVisibleInSiteVisibility()) {
             $products[$product->getId()] = $item->getStoreId();
         }
     }
     if ($products) {
         $products = Mage::getResourceSingleton('catalog/url')->getRewriteByProductStore($products);
         foreach ($this->getItems() as $item) {
             $product = $item->getProduct();
             $option = $item->getOptionByCode('product_type');
             if ($option) {
                 $product = $option->getProduct();
             }
             if (isset($products[$product->getId()])) {
                 $object = new Varien_Object($products[$product->getId()]);
                 $item->getProduct()->setUrlDataObject($object);
             }
         }
     }
 }
Example #3
0
 /**
  * Render shopping cart content as hidden meta data if the module is
  * enabled for the current store.
  *
  * @return string
  */
 protected function _toHtml()
 {
     /** @var Nosto_Tagging_Helper_Account $helper */
     $helper = Mage::helper('nosto_tagging/account');
     if (!Mage::helper('nosto_tagging')->isModuleEnabled() || !$helper->existsAndIsConnected()) {
         return '';
     }
     // If we have items in the cart, then update the Nosto customer quote
     // link. This is done to enable server-to-server order confirmation
     // requests once the quote is turned into an order.
     // We do it here as this will be run on every request when we have a
     // quote. This is important as the Nosto customer ID will change after
     // a period of time while the Mage quote ID can be the same.
     // The ideal place to run it would be once when the customer goes to
     // the `checkout/cart` page, but there are no events that are fired on
     // that page only, and the cart page recommendation elements we output
     // come through a generic block that cannot be used for this specific
     // action.
     if (count($this->getItems()) > 0) {
         /** @var Nosto_Tagging_Helper_Customer $customerHelper */
         $customerHelper = Mage::helper('nosto_tagging/customer');
         $customerHelper->updateNostoId();
     }
     return parent::_toHtml();
 }
 /**
  * Returns all visible cart items.
  * Fixed price bundle products are not supported.
  *
  * @return Mage_Sales_Model_Quote_Item[]
  */
 public function getItems()
 {
     if (!$this->_items) {
         $items = array();
         foreach (parent::getItems() as $item) {
             /** @var Mage_Sales_Model_Quote_Item $item */
             $product = $item->getProduct();
             if ($product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && (int) $product->getPriceType() === Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
                 continue;
             }
             $items[] = $item;
         }
         $this->_items = $items;
     }
     return $this->_items;
 }
Example #5
0
 /**
  * Return customer quote items
  *
  * @return array
  */
 public function getItems()
 {
     if ($this->getCustomItems()) {
         return $this->getCustomItems();
     }
     return parent::getItems();
 }
Example #6
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->addItemRender('default', 'checkout/cart_item_renderer', 'checkout/cart/sidebar/default.phtml');
 }
Example #7
0
 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $html = '';
     if ((bool) Mage::app()->getStore()->getConfig('checkout/sidebar/display')) {
         $html = parent::_toHtml();
     }
     return $html;
 }
Example #8
0
 /**
  * Get cache key informative items
  *
  * @return array
  */
 public function getCacheKeyInfo()
 {
     $cacheKeyInfo = parent::getCacheKeyInfo();
     $cacheKeyInfo['item_renders'] = $this->_serializeRenders();
     return $cacheKeyInfo;
 }
Example #9
0
 public function _prepareLayout()
 {
     return parent::_prepareLayout();
 }
Example #10
0
 public function _construct()
 {
     return parent::_construct();
 }
Example #11
0
 /**
  * Retrieve block cache tags
  *
  * @return array
  */
 public function getCacheTags()
 {
     $quoteTags = $this->getQuote()->getCacheIdTags();
     $items = array();
     /** @var $item Mage_Sales_Model_Quote_Item */
     foreach ($this->getItems() as $item) {
         $items[] = $item->getProduct();
     }
     return array_merge(parent::getCacheTags(), !$quoteTags ? array() : $quoteTags, $this->getItemsTags($items));
 }
Example #12
0
 /**
  * Return the quote item id
  *
  * @param Mage_Checkout_Block_Cart_Sidebar $block
  * @return int
  */
 protected function _getQuote(Mage_Checkout_Block_Cart_Abstract $block)
 {
     $quote = $block->getCustomQuote() ? $block->getCustomQuote() : $block->getQuote();
     return $quote;
 }
Example #13
0
 /**
  * Return customer quote items
  *
  * @return array
  */
 public function getItems()
 {
     if ($this->getCustomQuote()) {
         return $this->getCustomQuote()->getAllVisibleItems();
     }
     return parent::getItems();
 }
Example #14
0
 public function getAddToCartUrl($product, $additional = array())
 {
     if ($this->helper('icart')->isEnabled()) {
         return $this->helper('icart')->getAddUrl($product, $additional);
     } else {
         return parent::getAddToCartUrl($product, $additional);
     }
 }