VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: man.of.earth 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: man.of.earth 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:

vmJsApi::jPrice();
vmJsApi::cssSite();


becomes

if ($show_price or $show_addtocart ) {
vmJsApi::jPrice();
vmJsApi::cssSite();
}


echo vmJsApi::writeJS();

becomes

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 echo '<div class="productdetails">';

if ($show_price || $show_addtocart ){
echo '<div class="productdetails">';


(...)

and after echo '</div>';

echo '</div>';
}?>