コード例 #1
0
 /**
  * @return BusinessCatalyst_Tracker
  */
 public function getInstance() {
     $tracker = new BusinessCatalyst_Tracker();
     $tracker->setTrackerName("BusinessCatalyst");
     return $tracker;
 }
コード例 #2
0
    private function processOrder($xmlOrder) {
        $entityId = (int)$xmlOrder->entityId;
        $lastDateUpdate = (string)$xmlOrder->lastUpdateDate;

        if (strtotime($lastDateUpdate) <= strtotime($this->lastDateUpdate)) {
            Pap_Contexts_Action::getContextInstance()->debug('Processing old entity ID '.$entityId.' skipped.');
            return;
        }

        Pap_Contexts_Action::getContextInstance()->debug('Processing order; getting visitorid from actual xml: '.$xmlOrder->asXML());
        $visitorId = $this->parseVisitorId($xmlOrder->asXML(), Gpf_Settings::get(BusinessCatalyst_Config::PAP_CUSTOM_FIELD_NAME));

        if ($visitorId == null || $visitorId == '') {
            $retrieveCase = new BusinessCatalyst_RetrieveCase();
            $visitorId = $retrieveCase->retrieveVisitorId($entityId);
            Pap_Contexts_Action::getContextInstance()->debug('Processing order; processing visitorid - after laoad entity request: '.$visitorId);
        }

        if ($visitorId == null || $visitorId == '') {
            Pap_Contexts_Action::getContextInstance()->debug('No visitorId found');
            return;
        }

        Pap_Contexts_Action::getContextInstance()->debug('Processing order; cookie:'.
        $visitorId.'; entityId:'.(string)$xmlOrder->entityId.' orderId:'.(string)$xmlOrder->orderId.'; totalCost:'.(string)$xmlOrder->totalOrderAmount);
        Pap_Contexts_Action::getContextInstance()->debug('Processing order; datetime-lastupdate:'.$lastDateUpdate);

        $tracker = new BusinessCatalyst_Tracker();
        $tracker->setTransactionID((string)$xmlOrder->orderId);
        $tracker->setTotalCost((string)$xmlOrder->totalOrderAmount);
        $tracker->setCookie($visitorId);
        $tracker->setDateTime(BusinessCatalyst_Config::getPapDateFormat($lastDateUpdate));
        $tracker->process();

        $this->lastDateUpdate = $lastDateUpdate;
        $this->lastProcessedEntityId = $entityId;

        Pap_Contexts_Action::getContextInstance()->debug('BusinessCatalyst save last update time: '.$this->lastDateUpdate.' and entity id: '.$this->lastProcessedEntityId);
        Gpf_Settings::set(BusinessCatalyst_Config::BC_LAST_CHECK, $this->lastDateUpdate);
        Gpf_Settings::set(BusinessCatalyst_Config::BC_LAST_ENTITY_ID, $this->lastProcessedEntityId);
    }