/**
  * @return Pap_Tracking_Cookie_Sale
  */
 public function getClientSaleCookie() {
     $cookie = new Pap_Tracking_Cookie_Sale();
     $cookie->decode($this->getRequestParameter(self::PARAM_ACTION_CLIENT_SALE_COOKIE));
     return $cookie;
 }    
示例#2
0
 /**
  * @throws Pap_Tracking_Exception
  * @return Pap_Tracking_Cookie_Sale
  */
 public function getSaleCookie() {
     $cookie = new Pap_Tracking_Cookie_Sale();
     $cookieValue = $this->getCookie(self::SALE_COOKIE_NAME);
     if ($cookieValue == '') {
         throw new Pap_Tracking_Exception('Error occured while parsing sale cookie.');
     }
     $cookie->decode($cookieValue);
     return $cookie;
 }
 protected function setVisitorAndAccount(Pap_Tracking_ActionTracker $saleTracker, $affiliateID, $campaignID, $cookie) {
     if($affiliateID != '' && $campaignID != '') {
         try {
             $saleTracker->setAccountId($this->getAccountIdFromCampaign($campaignID));
         } catch (Gpf_Exception $e) {
             throw new Gpf_Exception('Can not get accountId from campaign, error message:' . $e->getMessage());
         }
     } else {
         if ($this->isOldCookies($cookie)) {
             $saleTracker->setCookieValue($cookie);
             $newVisitorId = $this->generateNewVisitorId();
             try {
                 $cookieObj = new Pap_Tracking_Cookie_Sale();
                 $cookieObj->decode($cookie);
                 $this->fillAccountIdAndVisitorId($saleTracker, $this->getAccountIdFromCampaign($cookieObj->getCampaignId()), $newVisitorId);
             } catch (Gpf_Exception $e) {
                 $this->debug('Can not get accountId from campaign in old cookie format, error message:' . $e->getMessage() . '. Setting default one.');
                 $this->fillAccountIdAndVisitorId($saleTracker, Gpf_Db_Account::DEFAULT_ACCOUNT_ID, $newVisitorId);
             }
         } else {
             $this->processAccountIdAndVisitorId($saleTracker, $cookie);
         }
     }
     $this->debug("End registering sale");
 }