コード例 #1
0
ファイル: general.php プロジェクト: stanislauslive/StanMarket
function smn_get_subcategories(&$subcategories_array, $parent_id = 0)
{
    global $store_id;
    $subcategories_query = smn_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int) $parent_id . "' and store_id = '" . (int) $store_id . "'");
    while ($subcategories = smn_db_fetch_array($subcategories_query)) {
        $subcategories_array[sizeof($subcategories_array)] = $subcategories['categories_id'];
        if ($subcategories['categories_id'] != $parent_id) {
            smn_get_subcategories($subcategories_array, $subcategories['categories_id']);
        }
    }
}
コード例 #2
0
    $select_str .= ", SUM(tr.tax_rate) as tax_rate ";
}
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
// if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (smn_not_null($pfrom) || smn_not_null($pto)) ) {
if (!smn_session_is_registered('customer_country_id')) {
    $customer_country_id = $store->get_store_country();
    $customer_zone_id = $store->get_store_zone();
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int) $customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int) $customer_zone_id . "')";
//}
$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id";
// systemsmanager begin
if (isset($_POST['categories_id']) && smn_not_null($_POST['categories_id'])) {
    if (isset($_POST['inc_subcat']) && $_POST['inc_subcat'] == '1') {
        $subcategories_array = array();
        smn_get_subcategories($subcategories_array, $_POST['categories_id']);
        $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '" . (int) $_POST['categories_id'] . "'";
        for ($i = 0, $n = sizeof($subcategories_array); $i < $n; $i++) {
            $where_str .= " or p2c.categories_id = '" . (int) $subcategories_array[$i] . "'";
        }
        $where_str .= ")";
    } else {
        $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and p2c.categories_id = '" . (int) $_POST['categories_id'] . "'";
    }
}
$select_str = "select p.*, pd.* ";
$from_str = " from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd ";
$where_str = " where p.products_id = pd.products_id and p.store_id!=1 ";
if (isset($_POST['store_category']) && $_POST['store_category'] != 0) {
    $from_str .= " , " . TABLE_STORE_TO_CATEGORIES . " sc ";
    //on p.store_id=sc.store_id and sc.store_categories_id=" . $_POST['store_category'];