For those using this with Zen Cart 1.5.6 and above.
Found an issue while trying to clean up the code a little.
In Zen Cart 1.5.6 a notifier was added into the includes/functions/functions_lookup.php file that adds functionality of adjusting/determining the quantity to be returned when attempting to determine the stock available and another to determine if the product is in stock.
These two notifiers were incorporated into the plugin which means that the file no longer needs to be modified or supplied with the plugin.
Unfortunately, the as provided observer load point (again for Zen Cart 1.5.6 and above) is incorrect to properly report the quantity response during cart operations (add and update). In order for the observer to realize that the notifier has been triggered, it needs to be loaded before the notifier. The includes/extra_cart_actions file which is processed to handle SBA product manipulations gets loaded at load point 140. In order for the additional code to trigger when manipulating the cart contents, the load point of the observer needs to be moved up to at highest of 139, but am thinking that 135 would be sufficient. Of course, also need to now look to see what, if anything, uses those functions earlier.
So the change as identified so far is to modify includes/auto_loaders/config.products_with_attributes_stock.php line 45 from:
Code:
$autoLoadConfig[199][] = array(
To:
Code:
$autoLoadConfig[135][] = array(
Now, because that code uses the class code that is also loaded at load point 199 into a session variable, that code (line 29) should also be loaded sooner (same load point) to support the first page load.
A brief review of items loaded in config.core.php does identify that perhaps these items could be loaded before loading the shopping_cart class; however, review of the code there along with the notifiers present doesn't clearly identify points where the "early" use of the stock related notifiers would be of benefit. I'm not saying it's not possible to end up removing the extra_cart_actions file, but it seems like it would take a little effort to eliminate it's need. Currently to some extent it operates independent of the code in the shopping_cart class. If integrated more then there is the concern of modifications by other software affecting it's operation. Will still look into that but wanted to post these findings while working up the changes for github.
Bookmarks