Open lat9 opened 6 years ago
As identified in this Zen Cart support-thread posting, the removal/reinsertion processing has the unwanted side-effect of enabling products that were disabled on entry.
Is there anything I can do to help move this issue forward? It's a major pain point for customers who use Dropshipping (which adds fields to orders_products that are lost during editing).
If no changes have been made to the list of products in an order, it would be great if OPC could skip the step of deleting and re-adding the rows in the orders_products table. The reason is, some mods (such as dropshipping) add data to those records which is not easily recreated.
I know. The thing is that this is going to require a major structural change to EO and I'll need time to (a) formulate the approach, keeping backward compatibility and (b) code, code, code.
:( rats - I thought I had come up with a shortcut.
@lat9
i have come up with a "simple" solution that is available here:
https://www.zen-cart.com/downloads.php?do=file&id=2292
i think it would be better if the EDIT_ORDERS_ADD_PRODUCT
notifier had the actual field names being updated as opposed to/in addition to the $product
object. in that way, the observer would not need to get updated if there was some sort of change to the fields in this plugin.
Noting that EO v5.0.0 will be released as an "encapsulated" plugin for zc200 and later (fully supported by zc210). For zc20x installations, the following base ZC PRs will be required for proper operation:
/ajax.php
This file, updated in releases following Zen Cart 2.0.0 via this PR enables an encapsulated plugin to provide additional AJAX handlers. An additional PR corrects a potential PHP error. If your site runs on Zen Cart 2.0.0, you can safely replace the file with its updated version.
/includes/classes/PluginSupport/ScriptedInstaller.php
This file, updated in the release following Zen Cart 2.0.1 via this PR correctly supplies an encapsulated plugin its currently-installed version on any upgrade. While not required for the initial version of EO's encapsulated version, it'll be required for any future upgrade. You can safely replace the file with its changed version.
All seven files 'touched' by this PR can be safely replaced with the changes in this PR:
The current EO processing removes and reinserts all
orders_products
andorders_products_attributes
records on an order update. This can cause grief to stores that include modifications to those tables by other order-related plugins.In the next major version, restructure to reuse existing records, where possible, while keeping existing functionality for plugins that are using the
EDIT_ORDERS_ADD_PRODUCT
and/orEDIT_ORDERS_REMOVE_PRODUCT
notifications.