Esempio n. 1
0
 /**
  * Plugin event listener function which fired after a customer
  * has ordered articles in the store front.
  * This function is used to increment the sales count in the
  * s_articles_top_seller table.
  *
  * @param Enlight_Event_EventArgs $arguments
  * @return mixed
  */
 public function incrementTopSeller(Enlight_Event_EventArgs $arguments)
 {
     if (Shopware()->Session()->Bot || !$this->isTopSellerActivated()) {
         return $arguments->getReturn();
     }
     $details = $arguments->getDetails();
     foreach ($details as $article) {
         if ($article['mode'] != 0 || empty($article['articleID'])) {
             continue;
         }
         $this->TopSeller()->incrementTopSeller($article['articleID'], $article['quantity']);
     }
     return $arguments->getReturn();
 }
 /**
  * add purchase tracking
  * @param Enlight_Event_EventArgs $arguments
  * @return boolean
  */
 public function purchase(Enlight_Event_EventArgs $arguments)
 {
     if ($this->Config()->get('boxalino_tracking_enabled')) {
         $products = array();
         foreach ($arguments->getDetails() as $detail) {
             $products[] = array('product' => $detail['articleDetailId'], 'quantity' => $detail['quantity'], 'price' => $detail['priceNumeric']);
         }
         Shopware_Plugins_Frontend_Boxalino_EventReporter::reportPurchase($products, $arguments->getSubject()->sOrderNumber, $arguments->getSubject()->sAmount, Shopware()->Shop()->getCurrency());
     }
     return $arguments->getReturn();
 }