Beispiel #1
0
    public function setSaleCookie(Pap_Contexts_Click $context) {
        $userObject = $context->getUserObject();
        $campaignObject = $context->getCampaignObject();
        $channelValue = null;
        if($context->getChannelObject() != null) {
            $channelValue = $context->getChannelObject()->getId();
        }
    	
    	$campaignId = 0;
        $lifetime = 0;
        if($campaignObject != null) {
            $campaignId = $campaignObject->getId();
        } else {
            $this->debug("No campaign recognized");
        }
         
        $lifetime = time() + self::getCookieLifetime($context);
         
        $cookie = new Pap_Tracking_Cookie_Sale();
        $cookie->setAffiliateId($userObject->getId());
        $cookie->setCampaignId($campaignId);
        $cookie->setChannelId($channelValue);

        $this->setCookie(self::SALE_COOKIE_NAME,
                         $cookie,
                         $lifetime,
                         $this->isOverwriteEnabled($campaignObject, $userObject));
    }