Пример #1
0
function zen_get_products_quantity_min_units_display($product_id, $include_break = true, $shopping_cart_msg = false)
{
    $check_min = zen_get_products_quantity_order_min($product_id);
    $check_units = zen_get_products_quantity_order_units($product_id);
    $the_min_units = '';
    if ($check_min != 1 or $check_units != 1) {
        if ($check_min != 1) {
            $the_min_units .= PRODUCTS_QUANTITY_MIN_TEXT_LISTING . ' ' . $check_min;
        }
        if ($check_units != 1) {
            $the_min_units .= ($the_min_units ? ' ' : '') . PRODUCTS_QUANTITY_UNIT_TEXT_LISTING . ' ' . $check_units;
        }
        if (($check_min > 0 or $check_units > 0) and !zen_get_products_quantity_mixed($product_id)) {
            if ($include_break == true) {
                $the_min_units .= '<br />' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_OFF : TEXT_PRODUCTS_MIX_OFF_SHOPPING_CART);
            } else {
                $the_min_units .= '&nbsp;&nbsp;' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_OFF : TEXT_PRODUCTS_MIX_OFF_SHOPPING_CART);
            }
        } else {
            if ($include_break == true) {
                $the_min_units .= '<br />' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_ON : TEXT_PRODUCTS_MIX_ON_SHOPPING_CART);
            } else {
                $the_min_units .= '&nbsp;&nbsp;' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_ON : TEXT_PRODUCTS_MIX_ON_SHOPPING_CART);
            }
        }
    }
    // quantity max
    $check_max = zen_get_products_quantity_order_max($product_id);
    if ($check_max != 0) {
        if ($include_break == true) {
            $the_min_units .= ($the_min_units != '' ? '<br />' : '') . PRODUCTS_QUANTITY_MAX_TEXT_LISTING . '&nbsp;' . $check_max;
        } else {
            $the_min_units .= ($the_min_units != '' ? '&nbsp;&nbsp;' : '') . PRODUCTS_QUANTITY_MAX_TEXT_LISTING . '&nbsp;' . $check_max;
        }
    }
    return $the_min_units;
}
Пример #2
0
function zen_get_buy_now_qty($product_id)
{
    global $cart;
    $check_min = zen_get_products_quantity_order_min($product_id);
    $check_units = zen_get_products_quantity_order_units($product_id);
    $buy_now_qty = 1;
    // works on Mixed ON
    switch (true) {
        case $_SESSION['cart']->in_cart_mixed($product_id) == 0:
            if ($check_min >= $check_units) {
                $buy_now_qty = $check_min;
            } else {
                $buy_now_qty = $check_units;
            }
            break;
        case $_SESSION['cart']->in_cart_mixed($product_id) < $check_min:
            $buy_now_qty = $check_min - $_SESSION['cart']->in_cart_mixed($product_id);
            break;
        case $_SESSION['cart']->in_cart_mixed($product_id) > $check_min:
            // set to units or difference in units to balance cart
            $new_units = $check_units - fmod_round($_SESSION['cart']->in_cart_mixed($product_id), $check_units);
            //echo 'Cart: ' . $_SESSION['cart']->in_cart_mixed($product_id) . ' Min: ' . $check_min . ' Units: ' . $check_units . ' fmod: ' . fmod($_SESSION['cart']->in_cart_mixed($product_id), $check_units) . '<br />';
            $buy_now_qty = $new_units > 0 ? $new_units : $check_units;
            break;
        default:
            $buy_now_qty = $check_units;
            break;
    }
    if ($buy_now_qty <= 0) {
        $buy_now_qty = 1;
    }
    return $buy_now_qty;
}
Пример #3
0
}
//--></script>
<script>
var FRIENDLY_URLS='true';
var symbolLeft='<?php 
echo $currencies->display_symbol_left($_SESSION['currency']);
?>
';
var symbolRight='';
var min_quantity=<?php 
echo zen_get_products_quantity_order_min($_GET['products_id']);
?>
;
var discount = new Array();
discount[0] ="<?php 
echo zen_get_products_quantity_order_min($_GET['products_id']);
?>
-<?php 
echo number_format(zen_get_products_base_price($_GET['products_id']) == 0 ? zen_get_products_sample_price($_GET['products_id']) : zen_get_products_base_price($_GET['products_id']), 2);
?>
-0-0";
function formatC(s, flag){
if(flag == null){
flag =true;
 }
 s = s + '';
 if(/[^0-9\.]/.test(s)) return "invalid value";
 s=s.replace(/^(\d*)$/,"$1.");
 s=(s+"00").replace(/(\d*\.\d\d)\d*/,"$1");
 s=s.replace(".",",");
 var re=/(\d)(\d{3},)/;