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

Custom fields in orders_products_attributes are not written #222

Closed daphilli224 closed 4 months ago

daphilli224 commented 1 year ago

If custom fields have been added to the orders_products_attributes table, edit orders does not write the data after editing the product or editing another aspect of the order such as shipping cost, etc. This is similar to the same problem for the orders_products table reported previously. It would be helpful if a notifier were placed within the foreach loop around line 1098 in function eo_add_product_to_order in admin/includes/functions/extra_functions/edit_orders_functions.php to allow an observer to properly calculate or look up custom field values.

I suspect the same problem exists if a custom field is added to the orders_products_download table.

I understand edit orders is undergoing a major revision where this problem may be fixed, but depending on the changes to the product, the old value of custom fields may not be correct and the user will need to recalculate or lookup new values. So an appropriately placed notifier is still needed. In my case, the custom field is related to product attribute cost, so editing a product attribute will necessitate recalculating or looking up a new cost.

Thank you for a great plug-in Cindy!

Dave zc157c, php 8.0.22, eo 4.6.2

lat9 commented 1 year ago

That's a known issue with EO's current design. There's this plugin that helps to work around the issue. It might need updating to deal with additional attribute-related fields as well.

daphilli224 commented 1 year ago

Hi Cindy,

I started with your referenced plugin but quickly determined it was not suitable for me because it simply copied the custom field from the deleted orders_product record. I need the custom field to be recalculated or rather looked up from the products and products_attributes tables. I wrote my own observer with a notifier to an observer on the store side that fills the custom field. (Thanks for your answer to my post a few days ago asking whether an observer can contain a notifier to another observer!).

Dave

On Jun 25, 2023, at 12:56 PM, lat9 @.***> wrote:

That's a known issue with EO's current design. There's this https://www.zen-cart.com/downloads.php?do=file&id=2292 plugin that helps to work around the issue. It might need updating to deal with additional attribute-related fields as well.

— Reply to this email directly, view it on GitHub https://github.com/lat9/edit_orders/issues/222#issuecomment-1606156649, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXNN2F2RG7PYAKOO3JZXRLXNBUVFANCNFSM6AAAAAAZTG7QG4. You are receiving this because you authored the thread.