Page 1 of 1

Product option help

Posted: Wed Nov 08, 2017 5:22 am
by derewith
Hello guys, i'm a new user in the Forum and i'm developing a website using opencart and i'm wondering if you can help me with a problem.
So, the problem is with the Option Value for every product of the cart as i show in this image :
Image
If i set a Product Option to "0" opencart won't show me the option but instead i want to disable them like this image :
Image
I was thinking about adding something alike this inside "product.twig " ;

Code: Select all

{% if option.option_value_id == '0' %} disabled {% endif %} 
but I don't know if is correct.
Can anyone help me?

Thanks,
J.D

Re: Product option help

Posted: Wed Nov 08, 2017 3:45 pm
by webmedialdh
Hi,

In order to show but disable you need to do some code in your controller file as well.

in Controller Product.php file (link no. 313)

Code: Select all

if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
replace above code with

Code: Select all

if (true) {
in Controller Product.php file (link no. 320)

Code: Select all

$product_option_value_data[] = array(
add a new line after above line

Code: Select all

'optionquantity'          => $option_value['quantity'],
Then in your product.twig file

Code: Select all

{% if option.optionquantity == '0' %} disabled {% endif %} 
Hope this will help you

Regards