function listCart() { global $xoopsTpl, $uid; $cartForTemplate = $discountsDescription = array(); $emptyCart = false; $shippingAmount = $commandAmount = $vatAmount = $commandAmountTTC = $discountsCount = $ecotaxeAmount = $discountAmount = $totalSavings = 0; $goOn = ''; $reductions = new oledrion_reductions(); $reductions->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount, $ecotaxeAmount, $discountAmount, $totalSavings); $oledrion_Currency =& oledrion_Currency::getInstance(); $xoopsTpl->assign('emptyCart', $emptyCart); // Caddy Vide ? $xoopsTpl->assign('caddieProducts', $cartForTemplate); // Produits dans le caddy $xoopsTpl->assign('shippingAmount', $oledrion_Currency->amountForDisplay($shippingAmount)); // Montant des frais de port $xoopsTpl->assign('ecotaxeAmount', $oledrion_Currency->amountForDisplay($ecotaxeAmount)); // Montant des frais de port $xoopsTpl->assign('commandAmount', $oledrion_Currency->amountForDisplay($commandAmount)); // Montant HT de la commande $xoopsTpl->assign('discountAmount', $oledrion_Currency->amountForDisplay($discountAmount)); // Total Discount $xoopsTpl->assign('totalSavings', $oledrion_Currency->amountForDisplay($totalSavings)); // Total Savings $xoopsTpl->assign('vatAmount', $oledrion_Currency->amountForDisplay($vatAmount)); // Montant de la TVA $xoopsTpl->assign('discountsCount', $discountsCount); // Nombre de réductions appliquées $xoopsTpl->assign('goOn', $goOn); // Adresse à utiliser pour continuer ses achats $xoopsTpl->assign('commandAmountTTC', $oledrion_Currency->amountForDisplay($commandAmountTTC, 'l')); // Montant TTC de la commande $xoopsTpl->assign('discountsDescription', $discountsDescription); // Liste des réductions accordées $showOrderButton = true; $showRegistredOnly = false; if (oledrion_utils::getModuleOption('restrict_orders', false) && $uid == 0) { $showRegistredOnly = true; $showOrderButton = false; } $xoopsTpl->assign('showRegistredOnly', $showRegistredOnly); $xoopsTpl->assign('showOrderButton', $showOrderButton); }
/** * block to display items in cart * * @param integer $options[0] Count of items to show (0 = no limit) * @return array Block's content */ function b_oledrion_cart_show($options) { global $mod_pref, $xoopsConfig; include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; $productsCount = intval($options[0]); $cartForTemplate = $block = array(); $emptyCart = false; $shippingAmount = $commandAmount = $vatAmount = $discountsCount = 0; $goOn = ''; $commandAmountTTC = 0; $discountsDescription = array(); // Calcul du montant total du caddy $reductions = new oledrion_reductions(); $reductions->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount); $dec = oledrion_utils::getModuleOption('decimals_count'); if ($emptyCart) { return ''; } $block['block_money_full'] = oledrion_utils::getModuleOption('money_full'); $block['block_money_short'] = oledrion_utils::getModuleOption('money_short'); $block['block_shippingAmount'] = sprintf("%0." . $dec . 'f', $shippingAmount); // Montant des frais de port $block['block_commandAmount'] = sprintf("%0." . $dec . 'f', $commandAmount); // Montant HT de la commande $block['block_vatAmount'] = sprintf("%0." . $dec . 'f', $vatAmount); // Montant de la TVA $block['block_commandAmountTTC'] = sprintf("%0." . $dec . 'f', $commandAmountTTC); // Montant TTC de la commande $block['block_discountsDescription'] = $discountsDescription; // Liste des réductions accordées if ($productsCount > 0 && count($cartForTemplate) > $productsCount) { array_slice($cartForTemplate, 0, $productsCount - 1); } $block['block_caddieProducts'] = $cartForTemplate; // Produits dans le caddy return $block; }
function listCart() { global $cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription; $reductions = new oledrion_reductions(); $reductions->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount); }