Beispiel #1
0
    public function displayAffiliateTrackingCode(Pap_Contexts_Action $context) {
         
         
        if ($context->getDoCommissionsSave() == false) {
            $context->debug('AffiliateTrackingCode: commissions were not saved. stopping');
            return;
        }
        $commissionType = $context->getCommissionTypeObject();
        $affiliate = $context->getUserObject();
        if ($commissionType == null || $affiliate == null) {
            $context->debug('AffiliateTrackingCode: no affiliate or commission type. stopping');
            return;
        }
        if ($context->getTransactionObject()->getTransactionId() == '') {
            $context->debug('AffiliateTrackingCode: no transaction saved for affiliate: ' . $affiliate->getId() . '. stopping');
            return;
        }
        try {
            $affiliateTrackingCode = $this->loadAffiliateTrackingCode($commissionType, $affiliate);
        } catch (Gpf_Exception $e) {
            $context->debug('AffiliateTrackingCode: no approved code for this affiliate');
            return $context;
        }

        $affiliateTrackingCode->setCode($this->replaceTransactionConstants($affiliateTrackingCode->getCode(), $context->getTransactionObject()));

        $this->printAffiliateTrackingCode($affiliateTrackingCode);
    }
Beispiel #2
0
 protected function getNumberOfAllTransactionPerReferralFromContext(Pap_Contexts_Action $context, $commissionTypeId, $maxReferralTimePeriod) {
    return $this->getNumberOfAllTransactionPerReferral($context->getProductIdFromRequest(), 
         $context->getUserObject()->getId(), $commissionTypeId, $maxReferralTimePeriod);
 }