示例#1
0
 /**
  * Register products source 'Related Products' for 'Add to Cart popup' module
  *
  * @return array
  */
 protected function getSources()
 {
     $sources = parent::getSources();
     $sources['REL'] = array('method' => 'getSourceRelatedProducts', 'position' => 100);
     return $sources;
 }
示例#2
0
 /**
  * Register products source 'Customers also bought...' for 'Add to Cart popup' module
  *
  * @return array
  */
 protected function getSources()
 {
     $sources = parent::getSources();
     $sources['PAB'] = array('method' => 'getSourceCustomerBought', 'position' => 200);
     return $sources;
 }
示例#3
0
 /**
  * Get list of targets where 'Add to Cart' popup should not be displayed
  *
  * @param boolean
  */
 protected static function getAdd2CartPopupExcludedTargets()
 {
     $targets = parent::getAdd2CartPopupExcludedTargets();
     $targets[] = 'amazon_checkout';
     return $targets;
 }
示例#4
0
 /**
  * Return true if products list shoud be displayed in popup
  *
  * @return boolean
  */
 protected function isProductsListEnabled()
 {
     $options = \XLite\Module\XC\Add2CartPopup\Core\Add2CartPopup::getInstance()->getSelectedSourcesOption();
     return !empty($options);
 }
示例#5
0
 /**
  * Return products list
  *
  * @param \XLite\Core\CommonCell $cnd       Search condition
  * @param boolean                $countOnly Return items list or only its size OPTIONAL
  *
  * @return mixed
  */
 protected function getData(\XLite\Core\CommonCell $cnd, $countOnly = false)
 {
     if (!isset($this->products)) {
         $productIds = $this->getExcludedProductIds();
         $methods = \XLite\Module\XC\Add2CartPopup\Core\Add2CartPopup::getInstance()->getActiveSources();
         foreach ($methods as $method) {
             $products = \XLite\Module\XC\Add2CartPopup\Core\Add2CartPopup::getInstance()->{$method}($this->getProductId(), $productIds, static::PARAM_MAX_PRODUCT_COUNT);
             if ($products) {
                 foreach ($products as $product) {
                     $this->products[] = $product;
                     $productIds[] = $product->getProductId();
                     if (static::PARAM_MAX_PRODUCT_COUNT <= count($this->products)) {
                         break;
                     }
                 }
             }
             if (static::PARAM_MAX_PRODUCT_COUNT <= count($this->products)) {
                 break;
             }
         }
     }
     return $countOnly ? count($this->products) : $this->products;
 }
示例#6
0
 /**
  * Check if widget is visible
  *
  * @return boolean
  */
 protected function isVisible()
 {
     return parent::isVisible() && \XLite\Module\XC\Add2CartPopup\Core\Add2CartPopup::isAdd2CartPopupEnabled();
 }
示例#7
0
 /**
  * Return options list
  *
  * @param \XLite\Core\CommonCell $cnd       Search condition
  * @param boolean                $countOnly Return items list or only its size OPTIONAL
  *
  * @return array|integer
  */
 protected function getData(\XLite\Core\CommonCell $cnd, $countOnly = false)
 {
     $options = \XLite\Module\XC\Add2CartPopup\Core\Add2CartPopup::getInstance()->getSourcesOptions();
     return $countOnly ? count($options) : $options;
 }