注册 登录
  • 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!

ot_better_together在zencart里,把购物车里的价格不显示

实用教程 开心洋葱 4031次浏览 已收录 0个评论 手机上查看

购物车里修改
includes\modules\pages\shopping_cart\header_php.php 第159行增加

include_once(“./includes/modules/order_total/ot_better_together.php”);
$free_products_class = new ot_better_together();
$free_products_array = $free_products_class->calculate_deductions_cart();
//print_r( $products[$i][‘id’].’–‘);
//var_dump($cartShowTotal);
//print_r( $_SESSION[‘cart’]->total.’–‘);

//print_r($free_products_array);

$products_free_price = $products[$i][‘final_price’];

$products_quantity = $products[$i][‘quantity’];

if($free_products_array[$products[$i][‘id’]]>0){
if($products[$i][‘quantity’]>1)
{
$products_quantity = $products_quantity-1;
}
else
{
$products_free_price = $products[$i][‘final_price’] – $free_products_array[$products[$i][‘id’]] ;
}
$_SESSION[‘cart’]->total -= $free_products_array[$products[$i][‘id’]];
$_SESSION[‘cart’]->free_better_together += $free_products_array[$products[$i][‘id’]];
}
$cartShowTotal = $currencies->format($_SESSION[‘cart’]->total);
//var_dump($_SESSION[‘cart’]);
unset($free_products_class);


并修改下面这行
$productsPrice = $currencies->display_price($products[$i][‘final_price’], zen_get_tax_rate($products[$i][‘tax_class_id’]), $products_quantity) . ($products[$i][‘onetime_charges’] != 0 ? ‘
’ . $currencies->display_price($products[$i][‘onetime_charges’], zen_get_tax_rate($products[$i][‘tax_class_id’]), 1) : ”);}
修改为:

$productsPrice = $currencies->display_price($products_free_price, zen_get_tax_rate($products[$i][‘tax_class_id’]), $products[$i][‘quantity’]) . ($products[$i][‘onetime_charges’] != 0 ? ‘
’ . $currencies->display_price($products[$i][‘onetime_charges’], zen_get_tax_rate($products[$i][‘tax_class_id’]), 1) : ”);}


这样修改后 购物车里的产品价格都可以修改并且小计(总价格)也会发生变化。

到下一步修改最后结账的地方和物流配送时
includes\templates\ladyidiy\templates\tpl_checkout_shipping_default.php 454行增加

include_once(“./includes/modules/order_total/ot_better_together.php”);
$free_products_class = new ot_better_together();
$free_products_array = $free_products_class->calculate_deductions_cart();
//print_r( $free_products_array);
//var_dump($cartShowTotal);
//print_r( $_SESSION[‘cart’]->total.’–‘);

$products_free_price = $order->products[$i][‘final_price’];
$products_quantity = $order->products[$i][‘qty’];

if($free_products_array[$order->products[$i][‘id’]]>0){

if($order->products[$i][‘qty’]>1)
{
$products_quantity = $products_quantity-1;
}
else
{
$products_free_price = $order->products[$i][‘final_price’] – $free_products_array[$order->products[$i][‘id’]];
}

}
// var_dump($b);
unset($free_products_class);

?>
此行为修改的价格: display_price($products_free_price, $order->products[$i][‘tax’], $products_quantity);
if ($order->products[$i][‘onetime_charges’] != 0 ) echo ‘
‘ . $currencies->display_price($order->products[$i][‘onetime_charges’], $order->products[$i][‘tax’], 1);
?>


修改includes\modules\pages\checkout_shipping\header_php.php 第152行修改小计价格
$showTotal = $_SESSION[‘cart’]->show_total();

改为 $showTotal = $_SESSION[‘cart’]->show_total(); – $_SESSION[‘cart’]->free_better_together;


最后把includes\classes\order_total.php 115行增加if($GLOBALS[$class]->code ==’ot_better_together’) continue;
去掉显示的Better Together Discount: -US$108.00


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明ot_better_together在zencart里,把购物车里的价格不显示
喜欢 (0)
[开心洋葱]
分享 (0)
关于作者:
开心洋葱,开心洋葱头,水墨

您必须 登录 才能发表评论!

……
加载中……