Author Topic: [dev] mod_virtuemart_product bug loading VM js when prices and addtocart are off  (Read 473 times)

arcturus

  • Jr. Member
  • **
  • Posts: 119
  • VirtueMart Version: 3.8.9 10514
Hello everyone,

I noticed that, if the virtuemart product module is set to not show prices and addtocart, it still loads a few VM javascripts uselessly.
To solve that, a few conditions must be set.

In the mod_virtuemart_product.php:

Code: [Select]
vmJsApi::jPrice();
vmJsApi::cssSite();

becomes

Code: [Select]
if ($show_price or $show_addtocart ) {
vmJsApi::jPrice();
vmJsApi::cssSite();
}

Code: [Select]
echo vmJsApi::writeJS();
becomes

Code: [Select]
if ($show_price or $show_addtocart ) {
echo vmJsApi::writeJS();
}

In the tmpl/default.php, there are two places where this condition must be set: before
Code: [Select]
echo '<div class="productdetails">';
Code: [Select]
if ($show_price || $show_addtocart ){
echo '<div class="productdetails">';

(...)

and after
Code: [Select]
echo '</div>';
Code: [Select]
echo '</div>';
}?>
Cheers,
George
https://www.proxima-mundi.ro

Currentl using Joomla! 3.9.28 and VM 3.8.9 10514 on PHP 7.4