I have developed a 'spare parts' system for our online shop, at http://www.premierrange.co.uk/index....in_page=spares. I'm a pretty capable developer and have been working with ZC for 2 or 3 years now.
Each spare part is an individual product, e.g. products_id = 123 and has a simple name like products_name = 'Glass Canopy'. A more useful product name can be generated by some custom lookups in our database to include the spare part category tree it's in, e.g. "H76 -> 60cm -> Stainless Steel -> Glass Canopy".
http://www.premierrange.co.uk/index....roducts_id=278
A quick fix would be to simply store more detailed product names, e.g zen_products_description.products_name = 'H76 -> 60cm -> Stainless Steel -> Glass Canopy' .. I could work around the problems this causes when I need to show just "Glass Canopy" (e.g. on the spares diagram page http://www.premierrange.co.uk/index....cat_path=1_2_6) .. but I'd really like to use the observer system, if possible.
I want to be able to modify the products_name that's put into the Order. Preferably, it should also modify the name seen in the Shopping Cart. So the products_name stays as 'Glass Canopy' in the zen_products_description table, but when you click Add To Cart, you see "H76 -> 60cm -> Stainless Steel -> Glass Canopy" and that's what appears on the order too.
In this way, the customer sees a short name like 'Glass Canopy', and our back office staff see a detailed name that they need to pick the correct item.
1/ for the shopping cart:
I can see that the shopping_cart.php code only stores the products_id, so it only knows which product is in the cart, not its name. The Shopping Cart page gets the name during modules/pages/shopping_cart/header_php.php and only uses it for one-time rendering on the cart page.
I cannot see any notifier/observer hooks in this code. Is it possible to use an observer to modify the product names seen on the Shopping Cart or would we have to hack the core files?
2/ for the order:
And, the order.php code also does not extract the products_name during initialisation - pages/checkout_confirmation/header_php.php creates $order = new order() which would run $order->cart() and only store the products_id in memory. It's not until checkout_process.php is run that $order->create_add_products is run and the products_name is ripped from zen_products_description straight into zen_order without being seen by the user.
It seems that when the the order is committed to the database, I could use NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM (per product in the order) or NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS (for post processing the whole order) to modify the product names in the order table. This would be a rather late stage, but would at least make the more specific name visible to our back office staff.
What would you recommend?
This may be related to this recent post, but I didn't want to jump in there if it's unrelated:
http://www.zen-cart.com/forum/showthread.php?t=182403
Thanks
Nick
Bookmarks