• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

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

实用教程 开心洋葱 2887次浏览 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 ? '<br />' . $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 ? '<br />' . $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行增加

         <?php
  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);

  ?>
此行为修改的价格: <?php echo $currencies->display_price($products_free_price, $order->products[$i]['tax'], $products_quantity);
          if ($order->products[$i]['onetime_charges'] != 0 ) echo '<br /> ' . $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)

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

加载中……