CalcBuilder Forum

In Shopping Cart version, no Add to Cart if result is 0

User moon_1892 2014-12-31 04:12:37

I would like to hide the Add to Cart button is the calculator returns no value.

Moonsoft support 2014-12-31 14:00:54

Hi,
you would need to hide/show the button using javascript at 'after execution' tab. In order to hide buttons

CB("").hide();

for hikashop button, and

CB("").hide();

for virtuemart button.

After that, you can use your condition to show the button only if needed. If you have your price at the code at the variable $price, for ex, you can output it inside a hidden input at the calculator ouput, for ex:

input type="hidden" id="myresult" value="##price##"

and add to the javascript tab the condition to show, something like:

if(CB("#myresult").val()!="0"){

CB("").show(); //for hika
CB("").show(); //for virtue

}


Please place a ticket at the helpdesk if you need more help with this, we can share there html code which is not allowed at the forum.


Thanks, regards

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!