Post by derewith » Wed Nov 08, 2017 5:22 am

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

Newbie

Posts

Joined
Tue Nov 07, 2017 8:26 pm


Post by webmedialdh » Wed Nov 08, 2017 3:45 pm

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

Webx IT Solutions
Tel: +91 99154 09292, Skype: webmedialdh, Email: support@webxitsolutions.com
Image


User avatar
New member

Posts

Joined
Fri Apr 22, 2016 5:52 pm
Location - Ludhiana, Punjab
Who is online

Users browsing this forum: makako1970 and 18 guests