Post by fredJ » Thu Aug 29, 2019 5:45 pm

OpenCart 3

There will be an exception when trying to save a product that has a value field that is a textbox.
Sorry if I can't explain it, my store is in Swedish. I mean this:
Image

So what I did was to add this hack in admin/model/catalog/product.php
line 194

Code: Select all

				try {
					$this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_option_id = '" . (int)$product_option['product_option_id'] . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', value = '" . $this->db->escape($product_option['value']) . "', required = '" . (int)$product_option['required'] . "'");
				}
				catch (Exception $e) {
					$this->db->query("INSERT INTO " . DB_PREFIX . "product_option SET product_option_id = '" . (int)$product_option['product_option_id'] . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id']  . "', required = '" . (int)$product_option['required'] . "'");
				}
Because the problem is that "value" can't be saved when we have a textbox, so if we get an exception, we try again without the value.

Maybe it helps someone.

New member

Posts

Joined
Fri Jan 18, 2019 11:10 pm

Post by developer@avi » Fri Aug 30, 2019 1:00 am

Can you share admin details so I can help you to solve this

Newbie

Posts

Joined
Mon Aug 20, 2018 1:05 am
Who is online

Users browsing this forum: No registered users and 96 guests