コード例 #1
0
 /**
  * Event listener function of the Shopware_Modules_Articles_SetLastArticle event.
  * This event is fired after a user visit an article detail page.
  * This listener function is used to increment the counter value of
  * the s_articles_similar_shown_ro table.
  *
  * @param Enlight_Event_EventArgs $arguments
  * @return mixed
  */
 public function beforeSetLastArticle(Enlight_Event_EventArgs $arguments)
 {
     if (Shopware()->Session()->Bot || !$this->isSimilarShownActivated()) {
         return $arguments->getReturn();
     }
     $articleId = $arguments->getArticle();
     $sql = "SELECT COUNT(id)\n                FROM s_emarketing_lastarticles\n                WHERE sessionID = :sessionId\n                AND   articleID = :articleId";
     $alreadyViewed = Shopware()->Db()->fetchOne($sql, array('sessionId' => Shopware()->SessionID(), 'articleId' => $articleId));
     if ($alreadyViewed > 0) {
         return $arguments->getReturn();
     }
     $sql = "\n            SELECT\n                articleID as articleId\n            FROM s_emarketing_lastarticles\n            WHERE sessionID = :sessionId\n            AND   articleID != :articleId\n        ";
     $articles = Shopware()->Db()->fetchCol($sql, array('sessionId' => Shopware()->SessionID(), 'articleId' => $articleId));
     foreach ($articles as $id) {
         $this->SimilarShown()->refreshSimilarShown($articleId, $id);
         $this->SimilarShown()->refreshSimilarShown($id, $articleId);
     }
     return $arguments->getReturn();
 }
コード例 #2
0
 /**
  * add "add to basket" tracking
  * @param Enlight_Event_EventArgs $arguments
  * @return boolean
  */
 public function addToBasket(Enlight_Event_EventArgs $arguments)
 {
     if ($this->Config()->get('boxalino_tracking_enabled')) {
         $article = $arguments->getArticle();
         $price = $arguments->getPrice();
         Shopware_Plugins_Frontend_Boxalino_EventReporter::reportAddToBasket($article['articledetailsID'], $arguments->getQuantity(), $price['price'], Shopware()->Shop()->getCurrency());
     }
     return $arguments->getReturn();
 }