lat9 / edit_orders

Edit Orders: Updates for continued operation on Zen Cart v1.5.8 and later
GNU General Public License v2.0
5 stars 9 forks source link

read only attributes get deleted. #220

Closed proseLA closed 7 months ago

proseLA commented 1 year ago

PRODUCTS_OPTIONS_TYPE_READONLY_IGNORED is set to 1, so an item can be added to the cart, and that attribute remains with the item.

if you now edit the order, and just press update, that read only attribute is now gone from the order.

i have tracked that down to here:

https://github.com/lat9/edit_orders/blob/917318f80a716a0f7503853d7683c2cdbd50c9f8/YOUR_ADMIN/includes/functions/extra_functions/edit_orders_functions.php#L594-L601

now, $readonly will always be false (based on the code). if that gets set to true, the read only attribute will get displayed. BUT if you click update, you then get an sql error:

PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND options_values_id = 
          LIMIT 1' at line 5 :: SELECT products_attributes_weight, products_attributes_weight_prefix
           FROM products_attributes
          WHERE products_id = 2435
            AND options_id = 
            AND options_values_id = 
          LIMIT 1 ==> (as called by) /var/www/somewhereInSpace/ADMIN/includes/functions/extra_functions/edit_orders_functions.php on line 798
lat9 commented 1 year ago

Whew, the description for that configuration setting is very, very confusing: image

It appears that when that setting is '1', that the read-only attribute is (a) displayed in the cart and (b) added to the order; not when it's '0'. Additionally, but not pertinent to the EO issue, when the setting is '0' and a product has only read-only attributes, the product can't be added directly to the cart from listing pages. For an example, refer to the demo products' product # 172.