Ejemplo n.º 1
0
 /**
  * Save requested product ID in the recently viewed statistics
  *
  * @return void
  */
 public function handleRequest()
 {
     if (\XLite\Core\Config::getInstance()->CDev->ProductAdvisor->rv_enabled) {
         \XLite\Module\CDev\ProductAdvisor\Main::saveProductIds($this->getProductId());
     }
     return parent::handleRequest();
 }
Ejemplo n.º 2
0
 /**
  * Order placement is success
  *
  * @return void
  */
 public function processSucceed($doCloneProfile = true)
 {
     $this->saveProductStats(\XLite\Module\CDev\ProductAdvisor\Main::getProductIds());
     parent::processSucceed($doCloneProfile);
 }
Ejemplo n.º 3
0
 /**
  * Returns true if product is classified as a new product
  * 
  * @return boolean
  */
 public function isNewProduct()
 {
     $currentDate = static::getUserTime();
     $daysOffset = \XLite\Module\CDev\ProductAdvisor\Main::getNewArrivalsOffset();
     return \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->na_enabled && $this->getArrivalDate() && $this->getArrivalDate() < $currentDate && $this->getArrivalDate() > $currentDate - 86400 * $daysOffset;
 }
Ejemplo n.º 4
0
 /**
  * Return product labels
  *
  * @param \XLite\Model\Product $product The product to look for
  *
  * @return array
  */
 protected function getLabels(\XLite\Model\Product $product)
 {
     $labels = parent::getLabels($product);
     $targets = array(\XLite\Module\CDev\ProductAdvisor\View\ANewArrivals::WIDGET_TARGET_NEW_ARRIVALS, \XLite\Module\CDev\ProductAdvisor\View\AComingSoon::WIDGET_TARGET_COMING_SOON);
     if (!in_array(static::getWidgetTarget(), $targets)) {
         // Add ProductAdvisor's labels into the begin of labels list
         $labels = array_reverse($labels);
         $labels += \XLite\Module\CDev\ProductAdvisor\Main::getLabels($product);
         $labels = array_reverse($labels);
     }
     return $labels;
 }
Ejemplo n.º 5
0
 /**
  * Check if widget is visible
  *
  * @return boolean
  */
 protected function isVisible()
 {
     $result = \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->rv_enabled && \XLite\Module\CDev\ProductAdvisor\Main::getProductIds() && parent::isVisible();
     if ($result) {
         if (!\XLite\Core\CMSConnector::isCMSStarted()) {
             if (self::WIDGET_TYPE_SIDEBAR == $this->getParam(self::PARAM_WIDGET_TYPE)) {
                 $result = in_array($this->viewListName, array('sidebar.second', 'sidebar.single'));
             } elseif (self::WIDGET_TYPE_CENTER == $this->getParam(self::PARAM_WIDGET_TYPE)) {
                 $result = 'center.bottom' == $this->viewListName;
             }
         }
     }
     return $result;
 }