当前位置: 首页>>代码示例>>PHP>>正文


PHP BFCHelper::getCriteoConfiguration方法代码示例

本文整理汇总了PHP中BFCHelper::getCriteoConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP BFCHelper::getCriteoConfiguration方法的具体用法?PHP BFCHelper::getCriteoConfiguration怎么用?PHP BFCHelper::getCriteoConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BFCHelper的用法示例。


在下文中一共展示了BFCHelper::getCriteoConfiguration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

    function display($tpl = null, $preparecontent = false)
    {
        $document = JFactory::getDocument();
        $language = $document->getLanguage();
        $config = JComponentHelper::getParams('com_bookingforconnector');
        $app = JFactory::getApplication();
        // add stylesheet
        $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor.css');
        $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
        $document->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
        // load scripts
        $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
        // Initialise variables
        $state = $this->get('State');
        $params = $state->params;
        $items = $this->get('Items');
        $pagination = $this->get('Pagination');
        $sortColumn = $state->get('list.ordering');
        $sortDirection = $state->get('list.direction');
        $startswith = $params['startswith'];
        $searchseed = $params['searchseed'];
        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            JError::raiseWarning(500, implode("\n", $errors));
            return false;
        }
        $merchantsCriteo = isset($items) && !empty($items) ? array_unique(array_map(function ($a) {
            return $a->MerchantId;
        }, $items)) : array();
        $criteoConfig = BFCHelper::getCriteoConfiguration(1, $merchantsCriteo);
        if (isset($criteoConfig) && isset($criteoConfig->enabled) && $criteoConfig->enabled && count($criteoConfig->merchants) > 0) {
            $document->addScript('//static.criteo.net/js/ld/ld.js');
            $document->addScriptDeclaration('window.criteo_q = window.criteo_q || []; 
			window.criteo_q.push( 
				{ event: "setAccount", account: ' . $criteoConfig->campaignid . '}, 
				{ event: "setSiteType", type: "d" }, 
				{ event: "setEmail", email: "" }, 
				{ event: "viewList", item: ' . json_encode($criteoConfig->merchants) . ' }
			);');
        }
        $analyticsEnabled = count($items) > 0 && $this->checkAnalytics("Merchants List") && $config->get('eecenabled', 0) == 1;
        $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
        $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
        $pagination->setAdditionalUrlParam("startswith", $startswith);
        $pagination->setAdditionalUrlParam("searchseed", $searchseed);
        $this->assignRef('state', $state);
        $this->assignRef('params', $params);
        $this->assignRef('items', $items);
        $this->assignRef('pagination', $pagination);
        $this->assignRef('language', $language);
        $this->assignRef('config', $config);
        $this->assignRef('analyticsEnabled', $analyticsEnabled);
        // Display the view
        parent::display($tpl);
    }
开发者ID:Bookingfor,项目名称:joomla-extension-v-2,代码行数:58,代码来源:view.html.php

示例2: display

 function display($tpl = null, $preparecontent = false)
 {
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $app = JFactory::getApplication();
     $sitename = $app->get('sitename');
     $item = $this->get('Item');
     $state = $this->get('State');
     $params = $state->params;
     $this->assignRef('document', $document);
     $this->assignRef('language', $language);
     $this->assignRef('config', $config);
     $this->assignRef('sitename', $sitename);
     $this->assignRef('item', $item);
     //		$params =  null;
     //		JModelLegacy::addIncludePath(JPATH_ROOT. DIRECTORY_SEPARATOR .'components' . DIRECTORY_SEPARATOR . 'com_bookingforconnector'. DIRECTORY_SEPARATOR . 'models', 'BookingForConnectorModel');
     //		$model = JModelLegacy::getInstance('Resource', 'BookingForConnectorModel');
     //
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $overrideFilters = array();
     $toExclude = array();
     $requiredOffers = array();
     //		$parentId = isset($item->CondominiumId) ? $item->CondominiumId : null;
     $parentId = null;
     $offer = null;
     if (!empty($state->params["offerId"])) {
         $requiredOffers[] = $state->params["offerId"];
         $offer = $this->get('Offer');
     }
     if (isset($offer) && $offer->HasValidSearch) {
         $daySpan = '+' . $offer->MinDuration . ' day';
         $dateparsed = BFCHelper::parseJsonDate($offer->FirstAvailableDate, 'Y-m-d');
         $overrideFilters['checkin'] = DateTime::createFromFormat('Y-m-d', $dateparsed);
         $checkInParsed = clone $overrideFilters['checkin'];
         $overrideFilters['checkout'] = $checkInParsed->modify($daySpan);
         $overrideFilters['duration'] = $offer->MinDuration;
         $params['checkin'] = $overrideFilters['checkin'];
         $params['duration'] = $offer->MinDuration;
         $params['checkout'] = $overrideFilters['checkout'];
     }
     $this->assignRef('params', $params);
     $alternatRes = BFCHelper::GetAlternateResources(0, 5, null, null, $item->MerchantId, $parentId, false, false, $toExclude, $requiredOffers, $overrideFilters);
     if (!isset($alternatRes)) {
         $alternatRes = array();
     }
     $allratePlans = array();
     foreach ($alternatRes as $ratePlanStay) {
         $rs = $ratePlanStay->RatePlan;
         $rs->ResourceId = $ratePlanStay->ResourceId;
         $rs->ResName = $ratePlanStay->ResName;
         $rs->MinCapacityPaxes = $ratePlanStay->MinPaxes;
         $rs->MaxCapacityPaxes = $ratePlanStay->MaxPaxes;
         $rs->MrcCategoryName = $ratePlanStay->DefaultLangMrcCategoryName;
         $rs->Availability = $ratePlanStay->Availability;
         $rs->ImageUrl = $ratePlanStay->ImageUrl;
         if ($ratePlanStay != null) {
             $rs->CalculatedPricesDetails = json_decode($rs->CalculatedPricesString);
             $rs->SelectablePrices = json_decode($rs->CalculablePricesString);
             $rs->CalculatedPackages = json_decode($rs->PackagesString);
             $rs->DiscountVariation = null;
             if (!empty($rs->Discount)) {
                 $rs->DiscountVariation = $rs->Discount;
             }
             $rs->SupplementVariation = null;
             if (!empty($rs->Supplement)) {
                 $rs->SupplementVariation = $rs->Supplement;
             }
             $allVar = json_decode($rs->AllVariationsString);
             $rs->Variations = [];
             $rs->SimpleDiscountIds = [];
             foreach ($allVar as $currVar) {
                 $rs->Variations[] = $currVar;
                 $rs->SimpleDiscountIds[] = $currVar->VariationPlanId;
                 /*
                 if(empty($currVar->IsExclusive)){
                 }
                 */
             }
         }
         $allratePlans[] = $rs;
     }
     //		echo "<pre>allratePlans";
     //		echo print_r($allratePlans);
     //		echo "</pre>";
     function cmp($a, $b)
     {
         return $a->SortOrder - $b->SortOrder;
     }
     $merchants = array();
     $merchants[] = $item->MerchantId;
     $criteoConfig = BFCHelper::getCriteoConfiguration(2, $merchants);
     usort($allratePlans, "cmp");
     $this->assignRef('allstays', $allratePlans);
     $analyticsEnabled = $this->checkAnalytics("");
     $this->assignRef('analyticsEnabled', $analyticsEnabled);
//.........这里部分代码省略.........
开发者ID:Bookingfor,项目名称:joomla-extension-v-2,代码行数:101,代码来源:view.search.php

示例3: display


//.........这里部分代码省略.........
                 $rs->DiscountVariation = $rs->Discount;
             }
             $rs->BookingType = 0;
             if (!empty($rs->SuggestedStay)) {
                 $rs->BookingType = $rs->SuggestedStay->BookingType;
             }
             $rs->SupplementVariation = null;
             if (!empty($rs->Supplement)) {
                 $rs->SupplementVariation = $rs->Supplement;
             }
             $allVar = json_decode($rs->AllVariationsString);
             $rs->Variations = [];
             $rs->SimpleDiscountIds = [];
             if (!empty($allVar)) {
                 foreach ($allVar as $currVar) {
                     $rs->Variations[] = $currVar;
                     $rs->SimpleDiscountIds[] = $currVar->VariationPlanId;
                     /*if(empty($currVar->IsExclusive)){
                     		}*/
                 }
             }
         }
         $newAllStays[] = $rs;
     }
     $toExclude = array();
     $toExclude[] = $item->ResourceId;
     $parentId = isset($item->CondominiumId) ? $item->CondominiumId : null;
     $alternatRes = $model->getSearchResults(0, 5, null, null, $item->Merchant->MerchantId, $parentId, false, false, $toExclude);
     if (!isset($alternatRes)) {
         $alternatRes = array();
     }
     $allratePlans = array();
     foreach ($alternatRes as $ratePlanStay) {
         $rs = $ratePlanStay->RatePlan;
         $rs->ResourceId = $ratePlanStay->ResourceId;
         $rs->ResName = $ratePlanStay->ResName;
         $rs->MrcName = $ratePlanStay->MrcName;
         $rs->MinCapacityPaxes = $ratePlanStay->MinPaxes;
         $rs->MaxCapacityPaxes = $ratePlanStay->MaxPaxes;
         $rs->Availability = $ratePlanStay->Availability;
         $rs->MrcCategoryName = $item->MerchantCategoryName;
         $rs->ImageUrl = $ratePlanStay->ImageUrl;
         if ($ratePlanStay != null) {
             $rs->CalculatedPricesDetails = json_decode($rs->CalculatedPricesString);
             $rs->SelectablePrices = json_decode($rs->CalculablePricesString);
             $rs->CalculatedPackages = json_decode($rs->PackagesString);
             $rs->DiscountVariation = null;
             $rs->BookingType = 0;
             if (!empty($rs->SuggestedStay)) {
                 $rs->BookingType = $rs->SuggestedStay->BookingType;
             }
             if (!empty($rs->Discount)) {
                 $rs->DiscountVariation = $rs->Discount;
             }
             $rs->SupplementVariation = null;
             if (!empty($rs->Supplement)) {
                 $rs->SupplementVariation = $rs->Supplement;
             }
             $allVar = json_decode($rs->AllVariationsString);
             $rs->Variations = [];
             $rs->SimpleDiscountIds = [];
             foreach ($allVar as $currVar) {
                 $rs->Variations[] = $currVar;
                 $rs->SimpleDiscountIds[] = $currVar->VariationPlanId;
                 /*
                 if(empty($currVar->IsExclusive)){
                 }
                 */
             }
         }
         $allratePlans[] = $rs;
     }
     function cmp($a, $b)
     {
         return $a->SortOrder - $b->SortOrder;
     }
     usort($allratePlans, "cmp");
     $merchants = array();
     $merchants[] = $item->MerchantId;
     $criteoConfig = BFCHelper::getCriteoConfiguration(2, $merchants);
     BFCHelper::setState($totalWithVariation, 'total', 'resource');
     $this->assignRef('stay', $stay);
     $this->assignRef('resstays', $newAllStays);
     $this->assignRef('allstays', $allratePlans);
     $this->assignRef('total', $total);
     $this->assignRef('totalDiscounted', $totalDiscounted);
     $this->assignRef('totalWithVariation', $totalWithVariation);
     $analyticsEnabled = $this->checkAnalytics("") && $config->get('eecenabled', 0) == 1;
     $this->assignRef('analyticsEnabled', $analyticsEnabled);
     $this->assignRef('criteoConfig', $criteoConfig);
     //$Extras =  null;		//$this->get('ExtrasFromService');
     $PriceTypes = $model->getPriceTypesFromServiceRatePlan($allstays);
     //$this->get('PriceTypesFromServiceRatePlan');
     $MerchantBookingTypes = $this->get('MerchantBookingTypesFromService');
     $this->assignRef('Extras', $Extras);
     $this->assignRef('PriceTypes', $PriceTypes);
     $this->assignRef('MerchantBookingTypes', $MerchantBookingTypes);
     $this->setLayout('calc');
     parent::display($tpl, $preparecontent);
 }
开发者ID:Bookingfor,项目名称:joomla-extension-v-2,代码行数:101,代码来源:view.calc.php


注:本文中的BFCHelper::getCriteoConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。