Добрый день, использую модуль корзины VirtueMart, но он триста раз перелопаченный.
Стоимость товаров обновляется только после обновления страницы.
Вод где выводится стоимость
<?php if ($data->totalProduct ) { ?>
<?php echo "<span class='opc-salesPrice-total'>" . $currencyDisplay->createPriceDiv ('salesPrice', '', $cart->cartPrices['salesPrice'],True, FALSE). "</span>"?>
и пример общей суммы она обновляется
<span class="total">
<?php echo $data->billTotal; ?>
</span>
Вот срипт который обновляет корзину все обновляет (количество)
<script>
if (typeof VirtueMart === "undefined")
VirtueMart = {};
jQuery(function($) {
VirtueMart.customUpdateVirtueMartCartModule = function(el, options){
var base = this;
var $this = $(this);
base.$el = $(".vmCartModule");
base.options = $.extend({}, VirtueMart.customUpdateVirtueMartCartModule.defaults, options);
base.init = function(){
$.ajaxSetup({ cache: false })
$.getJSON(window.vmSiteurl + "index.php?option=com_virtuemart&nosef=1&view=cart&task=viewJS&format=json" + window.vmLang,
function (datas, textStatus) {
base.$el.each(function( index , module ) {
if (datas.totalProduct > 0) {
$(module).find(".vm_cart_products").html("");
$.each(datas.products, function (key, val) {
jQuery("#hiddencontainer .vmcontainer").clone().appendTo(".vmcontainer .vm_cart_products");
$(module).find(".hiddencontainer .vmcontainer .product_row").clone().appendTo( $(module).find(".vm_cart_products") );
$.each(val, function (key, val) {
$(module).find(".vm_cart_products ." + key).last().html(val);
});
});
}
$(module).find(".show_cart").html(datas.cart_show);
$(module).find(".total_products").html( datas.totalProductTxt);
$(module).find(".number").html(datas.totalProduct);
$(module).find(".total").html(datas.billTotal);
$(module).find(".total_sales").html(datas.salesPrice);
});
}
);
};
base.init();
};
// Definition Of Defaults
VirtueMart.customUpdateVirtueMartCartModule.defaults = {
name1: 'value1'
};
});
jQuery(document).ready(function( $ ) {
jQuery(document).off("updateVirtueMartCartModule","body",Virtuemart.customUpdateVirtueMartCartModule);
jQuery(document).on("updateVirtueMartCartModule","body",Virtuemart.customUpdateVirtueMartCartModule);
});
</script>
Что то связано с этими строчками $(module).find(".total_sales").html(datas.salesPrice); и $currencyDisplay->createPriceDiv ('salesPrice', '', $cart->cartPrices['salesPrice'],True, FALSE) как их связать чтоб обнвлялась не могу понять