コード例 #1
0
function cw_check_condition_Z($bonusid)
{
    global $userinfo, $tables;
    $zones = cw_get_customer_zones_avail($userinfo, "");
    $conditions = cw_query_column("SELECT objid FROM {$tables['bonus_conditions']} WHERE bonusid='{$bonusid}' AND type='Z'");
    if (!empty($conditions) && is_array($conditions)) {
        foreach ($conditions as $k => $v) {
            if (isset($zones[$v])) {
                return true;
            }
        }
        # one match found - conndition is met
        return false;
        # there are Z conditions, but they don't match customer's zones
    }
    return true;
    # there are no Z conditions at all
}
コード例 #2
0
// CartWorks.com - Promotion Suite
if (!defined('XCART_START')) {
    header("Location: ../../");
    die("Access denied");
}
if (empty($addons["Promotion_Suite"])) {
    return;
}
if ($config['Promotion_Suite']['display_offers_cat'] != 'Y' && $config['Promotion_Suite']['display_offers_product'] != 'Y') {
    return;
}
include_once $xcart_dir . '/addons/Promotion_Suite/user_bonuses.php';
$bonuses = $user_bonuses;
if ($_GET['showmedebug'] == 'Y') {
    x_load("debug");
    $zones = cw_get_customer_zones_avail($userinfo, "");
    echo 'Promotion Suite addon ', PS_VERSION, " \n<br />";
    echo __FILE__, ' : Customer $zones, List of appropriated $bonuses before zones and categories filter';
    cw_print_r($zones, $bonuses);
}
/*
	For current category show first offer, where this category mentioned in conditions. If there are no such offers, then show first offer.
*/
if (!empty($cat) && !empty($bonuses) && empty($productid)) {
    if ($config['Promotion_Suite']['display_offers_cat'] != 'Y') {
        return;
    }
    $featured = array();
    $pos = cw_query_first("SELECT lpos, rpos FROM {$tables['categories']} WHERE categoryid='{$cat}'");
    $lpos = $pos['lpos'];
    $rpos = $pos['rpos'];