if (isset($HTTP_GET_VARS['sort']) && empty($HTTP_GET_VARS['sort'])) {
    if (tep_session_is_registered('sort')) {
        $sort = '';
        tep_session_unregister('sort');
    }
}
$content_id = '';
$content_type = '';
$use_page_template = false;
// currency
if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $currency) {
    if (!tep_session_is_registered('currency')) {
        tep_session_register('currency');
    }
    if (isset($HTTP_GET_VARS['currency'])) {
        if (!($currency = tep_currency_exists($HTTP_GET_VARS['currency']))) {
            $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
        }
    } else {
        $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : $HTTP_GET_VARS['currency'];
    }
}
if (!in_array($currency, $available_currencies)) {
    $currency = DEFAULT_CURRENCY;
}
// navigation history
if (tep_session_is_registered('navigation')) {
    if (PHP_VERSION < 4) {
        $broken_navigation = $navigation;
        $navigation = new navigationHistory();
        $navigation->unserialize($broken_navigation);
Example #2
0
        $lng->set_language($_GET['language']);
    } else {
        $lng->get_browser_language();
    }
    $language = $lng->language['directory'];
    $languages_id = $lng->language['id'];
}
// include the language translations
require DIR_WS_LANGUAGES . $language . '.php';
// currency
if (!tep_session_is_registered('currency') || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $currency) {
    if (!tep_session_is_registered('currency')) {
        tep_session_register('currency');
    }
    if (isset($_GET['currency'])) {
        if (!($currency = tep_currency_exists($_GET['currency']))) {
            $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
        }
    } else {
        $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
    }
}
// navigation history
if (tep_session_is_registered('navigation')) {
    if (PHP_VERSION < 4) {
        $broken_navigation = $navigation;
        $navigation = new navigationHistory();
        $navigation->unserialize($broken_navigation);
    }
} else {
    tep_session_register('navigation');
Example #3
0
function b_shop_cart()
{
    global $cart, $xoopsConfig, $xoopsDB, $currencies, $languages_id, $language;
    if (!isset($_SESSION['languages_id'])) {
        $lang_query = "select languages_id from " . TABLE_LANGUAGES . " where directory ='" . $xoopsConfig['language'] . "'";
        $lang = tep_db_query($lang_query);
        $lang_id = tep_db_fetch_array($lang);
        $languages_id = $lang_id['languages_id'];
    } else {
        $languages_id = $_SESSION['languages_id'];
    }
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/database_tables.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/database.php";
    require_once XOOPS_ROOT_PATH . '/modules/osC/includes/functions/general.php';
    require_once XOOPS_ROOT_PATH . '/modules/osC/includes/classes/shopping_cart.php';
    require_once XOOPS_ROOT_PATH . '/modules/osC/includes/classes/currencies.php';
    require_once XOOPS_ROOT_PATH . '/modules/osC/includes/functions/sessions.php';
    $block = array("title" => "Shopping Cart", "datum" => "2003-09-03", "content" => "");
    $cart2 = serialize($cart);
    $cart = unserialize($cart2);
    $cart_contents = $cart->contents;
    if (!session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $currency) {
        if (!session_is_registered('currency')) {
            session_register('currency');
        }
        if (isset($HTTP_GET_VARS['currency'])) {
            if (!($currency = tep_currency_exists($HTTP_GET_VARS['currency']))) {
                $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
            }
        } else {
            $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
        }
    }
    if ($currency == '') {
        if (!($currency = tep_currency_exists($_GET['currency']))) {
            $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
        }
    }
    if (!isset($currencies) || !is_object($currencies)) {
        $currencies = new currencies();
    }
    $i = 0;
    foreach ($cart_contents as $key => $value) {
        $i++;
        $prod_query = "select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id='" . $languages_id . "' and products_id='" . $key . "'";
        $result = $xoopsDB->query($prod_query, 1, 0);
        $product_result = $xoopsDB->fetchArray($result);
        if (tep_session_is_registered('new_products_id_in_cart') && $new_products_id_in_cart == $products[$i]['id']) {
            $block['content'] .= '<span class="newItemInCar">';
        } else {
            $block['content'] .= '<span class="infoBoxContents">';
        }
        $block['content'] .= $value['qty'] . "x <a href=" . XOOPS_URL . "/modules/osC/product_info.php?products_id=" . $key . ">" . $product_result['products_name'] . "</a></span><br>";
    }
    if ($i == 0) {
        $block['content'] = BOX_SHOPPING_CART_EMPTY . "<br>";
    } else {
        $block['content'] .= "<hr>";
        $block['content'] .= _MB_BOX_ZSUMME . "<br /><b>" . $currencies->format($cart->show_total()) . "</b><br>";
    }
    // ############ Added CCGV Contribution ##########
    if (tep_session_is_registered('customer_id')) {
        $gv_query = $xoopsDB->query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $_SESSION['customer_id'] . "'");
        $gv_result = $xoopsDB->fetchArray($gv_query);
        if ($gv_result['amount'] > 0) {
            $block['content'] .= '<span class="smalltext">' . VOUCHER_BALANCE . '&nbsp;' . $currencies->format($gv_result['amount']) . '</span><br>';
            $block['content'] .= '<span class="smalltext"><a href="' . tep_href_link(FILENAME_GV_SEND) . '">' . BOX_SEND_TO_FRIEND . '</a></span></br>';
            //      $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
            //      $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_BALANCE . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($gv_result['amount']) . '</td></tr></table>');
            //      $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext"><a href="'. tep_href_link(FILENAME_GV_SEND) . '">' . BOX_SEND_TO_FRIEND . '</a></td></tr></table>');
        }
    }
    if (tep_session_is_registered('gv_id')) {
        $gv_query = $xoopsDB->query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'");
        $coupon = $xoopsDB->fetchArray($gv_query);
        $block['content'] .= '<span class="smalltext">' . VOUCHER_REDEEMED . '&nbsp;' . $currencies->format($coupon['coupon_amount']) . '</span></br>';
        //    $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
        //    $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_REDEEMED . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($coupon['coupon_amount']) . '</td></tr></table>');
    }
    /*if (tep_session_is_registered('cc_id') && $cc_id) {
        $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
        $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . CART_COUPON . '</td><td class="smalltext" align="right" valign="bottom">' . '<a href="javascript:couponpopupWindow(\'' . tep_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $cc_id) . '\')">' . CART_COUPON_INFO . '</a>' . '</td></tr></table>');
    
      }*/
    /* Serialio.com Edit Begin */
    if (tep_session_is_registered('cc_id') && $cc_id) {
        $coupon_query = $xoopsDB->query("select * from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'");
        $coupon = $xoopsDB->fetchArray($coupon_query);
        $coupon_desc_query = $xoopsDB->query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $cc_id . "' and language_id = '" . $languages_id . "'");
        $coupon_desc = $xoopsDB->fetchArray($coupon_desc_query);
        $text_coupon_help = sprintf("%s", $coupon_desc['coupon_name']);
        //  $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
        $block['content'] .= '<span class="smalltext">' . CART_COUPON . $text_coupon_help . '</span><br>';
        //   $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="infoBoxContents">' . CART_COUPON . $text_coupon_help . '<br>' . '</td></tr></table>');
    }
    /* Serialio.com Edit End */
    // ############ End Added CCGV Contribution ##########
    return $block;
}
Example #4
0
function b_specials()
{
    global $currency, $currencies, $languages_id, $xoopsDB, $xoopsConfig, $customer_group, $customer_id, $_GET;
    /* if(!defined("XOSC_BLOCK") && !defined("XOSC_CONFIG")) {
      define("XOSC_BLOCK",1);
      require_once(XOOPS_ROOT_PATH."/modules/osC/includes/application_top.php");
     }
    */
    // Config Part
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/configure.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/database_tables.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/filenames.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/database.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/general.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/html_output.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/boxes.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/currencies.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/product.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/customer_group.php";
    require_once XOOPS_ROOT_PATH . "/modules/osC/includes/languages/" . $xoopsConfig['language'] . ".php";
    //$currencies = new currencies();
    if (!isset($customer_group)) {
        if (!isset($_SESSION['customer_id'])) {
            $customer_group = new customer_group(0);
        } else {
            $customer_group = new customer_group($_SESSION['customer_id']);
        }
    }
    if (!defined('XBLOCK_CONFIG')) {
        $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
        while ($configuration = tep_db_fetch_array($configuration_query)) {
            define($configuration['cfgKey'], $configuration['cfgValue']);
        }
        define('XBLOCK_CONFIG', "1");
    }
    if (!isset($_SESSION['languages_id'])) {
        $lang_query = "select languages_id from " . TABLE_LANGUAGES . " where directory ='" . $xoopsConfig['language'] . "'";
        $lang = tep_db_query($lang_query);
        $lang_id = tep_db_fetch_array($lang);
        $languages_id = $lang_id['languages_id'];
    } else {
        $languages_id = $_SESSION['languages_id'];
    }
    // currency
    if (isset($_GET['currency'])) {
        $currency = $_GET['currency'];
    }
    if (!session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $currency) {
        if (!session_is_registered('currency')) {
            session_register('currency');
        }
        if (isset($HTTP_GET_VARS['currency'])) {
            if (!($currency = tep_currency_exists($HTTP_GET_VARS['currency']))) {
                $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
            }
        } else {
            $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
        }
    }
    if ($currency == '') {
        if (!($currency = tep_currency_exists($HTTP_GET_VARS['currency']))) {
            $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
        }
    }
    //$currencies = new currencies();
    if (!isset($currencies) || !is_object($currencies)) {
        $currencies = new currencies();
    }
    //echo "CUR:".$currencies.":".$currency;
    //print_r($currencies);
    // Box Part
    if ($random_product = tep_random_select("select p.products_distributor_id,p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int) $languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
        $sproduct = new product($random_product["products_id"]);
        $add_text = '';
        if ($customer_group->getdisplaytax() == '1') {
            $add_text = '<br>' . TEXT_VAT_INFO . ' ' . $sproduct->get_tax() . ' % ' . $sproduct->get_tax_title();
        }
        if ($customer_group->getdisplayshipment() == '1') {
            $add_text .= '<br>' . TEXT_SHIPPING_HANDLING_INFO;
        }
        $image_path = DIR_WS_IMAGES;
        switch ($random_product['products_distributor_id']) {
            case 1:
                $image_path = 'http://ec.ingrammicro.de/jpg/';
                break;
            case 2:
                $image_path = '';
                break;
        }
        $info_box_contents = array();
        $info_box_contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image($image_path . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>' . $add_text);
        $block = new infoBox($info_box_contents);
    }
    return $block->content;
}