Joomla 3.x Получить значение общего веса товара в корзине

Discussion in 'Хаки и модификации' started by OlegK, Apr 30, 2020.

  1. OlegK
    Offline

    OlegK Russian Joomla! Team Staff Member ⇒ Профи ⇐

    Joined:
    Jan 17, 2011
    Messages:
    7,812
    Likes Received:
    771
    Gender:
    Male
    В файле макета корзины, который нужно переопределить в свой шаблон /components/com_virtuemart/views/cart/tmpl/default_pricelist.php
    И вверху
    Код (CODE):
    1. defined ('_JEXEC') or die('Restricted access');
    2. if (!class_exists('shopFunctionsF'))
    3.    require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
    4. $cart = VirtueMartCart::getCart();
    5. $to_weight_unit = "KG";
    6.    foreach ($cart->products as $product) {
    7.          $weight[$to_weight_unit]
    8. += (ShopFunctions::convertWeightUnit ($product->product_weight, $product->product_weight_uom, $to_weight_unit) * $product->quantity);
    9. }      
    10. echo "<pre>";var_dump($weight);echo "</pre>";//die('Ok 1');
    11.  
    12. ?>
     
  2.  

Share This Page

Loading...