[dev] mod_virtuemart_product bug loading VM js when prices and addtocart are off

Started by man.of.earth, July 11, 2021, 02:48:57 AM

Previous topic - Next topic

man.of.earth

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>';
}?>