コード例 #1
0
<?php

if ($REQUEST_METHOD == 'GET') {
    $offers = cw_ps_get_offers(false);
    $smarty->assign('offers', $offers);
    //var_dump($offers);
    if ($contentsection_id) {
        $cms_offers = cw_ab_get_cms_restrictions($contentsection_id, 'PS');
        $smarty->assign('cms_offers', array_column($cms_offers, 'object_id'));
    }
    if ($contentsections_filter['offers']) {
        $smarty->assign('cms_offers', $contentsections_filter['offers']);
    }
}
コード例 #2
0
<?php

if (!isset($addons['promotion_suite'])) {
    return;
}
if (AREA_TYPE != 'C') {
    return;
}
$location[] = array(cw_get_langvar_by_name('lbl_ps_cust_offers'), '');
$smarty->assign('main', 'promosuite');
$smarty->assign('ps_img_type', PS_IMG_TYPE);
// get the list of the available offers
$smarty->assign('ps_offers', cw_ps_get_offers());
return;
コード例 #3
0
function cw_ps_on_cms_check_restrictions_PS($data)
{
    static $active_offers_ids;
    if (!isset($active_offers_ids)) {
        $active_offers = cw_ps_get_offers();
        $active_offers_ids = array_column($active_offers, 'offer_id');
    }
    // Get offers related to cms
    $cms_offers = cw_ab_get_cms_restrictions($data['contentsection_id'], 'PS');
    if (empty($cms_offers)) {
        return true;
    }
    $cms_offers_ids = array_column($cms_offers, 'object_id');
    // Check if at least one offer is active now
    $is_valid = array_intersect($cms_offers_ids, $active_offers_ids);
    return $is_valid;
}