VirtueMart Forum

VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: arcturus on July 11, 2021, 02:48:57 am

Title: [dev] mod_virtuemart_product bug loading VM js when prices and addtocart are off
Post by: arcturus on July 11, 2021, 02:48:57 am
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>';
}?>