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
 public function increaseUseCount(Pap_Contexts_Action $context) {
     if ($context->getDoCommissionsSave() == false) {
         $context->debug('Coupon increase usecount: commissions were not saved. stopping');
         return;
     }
     $transaction = $context->getTransaction();
     $couponId = $transaction->getCouponID();
     if ($couponId == null || $couponId == '') {
         $context->debug('Coupon increase usecount: coupon is not used for this commission. stopping');
         return;
     }
     $coupon = new Pap_Db_Coupon();
     $coupon->setId($couponId);
     try {
         $coupon->load();
         $coupon->increaseUseCount();
         $context->debug('Coupon increase usecount: usecount for coupon '.$couponId.' is increased.');
     } catch (Gpf_Exception $e) {
         $context->debug('Coupon increase usecount: loading coupon: '.$couponId.' exception: ' . $e->getMessage());
     }
 }
Beispiel #3
0
 	/**
 	 * saves lifetime referral.
 	 * It requires the sale parameter data1 to be filler. This is the identifier
 	 * that identifies the customer, for example his email.
 	 *
 	 * @param Pap_Contexts_Action $context
 	 */
 	public function saveLifetimeReferral(Pap_Contexts_Action $context) {
    	$context->debug(Gpf_Lang::_runtime('PLUGIN LifetimeCommissions saveLifetimeReferral started'));

    	if($context->getDoCommissionsSave()) {
    		$this->saveReferral($context);
    	} else {
    		$context->debug('  Commissions are not saved, stopping');
    	}

    	$context->debug(Gpf_Lang::_runtime('PLUGIN LifetimeCommissions ended'));
    	$context->debug('');

    	return Gpf_Plugins_Engine::PROCESS_CONTINUE;
 	}