Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Custom fulfillment per category?

Custom fulfillment per category?

Locked

Views: 1,169

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
17 Aug 2006, 5:23 PM
#1
xerosphere avatar

xerosphere

New Zenner

Join Date:
Aug 2006
Location:
Denver, CO
Posts:
5
Plugin Contributions:
0

Custom fulfillment per category?

I'm a zencart newb, but well-versed in PHP, database, etc...

I have a category of products that needs an email sent out to the manufacturer for fulfillment. I don't see a way through the UI to do so. I imagine this would be a pretty common scenario. Has someone developed a module to handle this situation? (I see the options to CC people on orders, but this is only for one category of products -- I don't want to send them ALL orders... Also consider that there will be mixed orders, some items from this category, some from other categories.)

Any advice as to a good approach for this? I'd be happy to develop & contribute a module that handles it, if that's the best way. I'd like to avoid modifying anything in the zencart "core", so that updates/upgrades can be installed without breaking my site.

Thanks in advance for any insight.

Best,
x

18 Aug 2006, 7:05 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Custom fulfillment per category?

There are many ways to tackle this, but the one that's most innovative and plug-in-like (not touching core) would be to use the notifier/observer system described here:
http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials

You could hook into the NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL notifier in the order class, and loop through the order's products, checking whether to notify the manufacturer, and sending the appropriate notices, perhaps also sending a copy to the administrator for record-keeping purposes.

18 Aug 2006, 6:25 PM
#3
xerosphere avatar

xerosphere

New Zenner

Join Date:
Aug 2006
Location:
Denver, CO
Posts:
5
Plugin Contributions:
0

Re: Custom fulfillment per category?

Thank you! The observer/notifier system seems very slick.

I've created my observer class with some help from the wiki, but need to check.. I don't see NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL in the list of notifiers on the wiki. I'm assuming outdated documentation, but when testing with the NOTIFIER_CART_ADD_CART_END event everything works fine.

When attaching to the NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL event using the same methods, I get a "The script tried to execute a method or access a property of an incomplete object" fatal PHP error (happens on adding an item to the cart). My code below.

In my auto load config for the observer class, i am using offset 90.. This may be the problem, I don't quite understand what that offset refers to. Got 90 from one of the examples.

Any insights or advice? Thanks again!

Best,
x

  
  class myObserver extends base {
    function myObserver() {
      $_SESSION['cart']->attach($this, array('NOTIFIER_CART_ADD_CART_END'));
    }
    function update(&$class, $eventID) {
      // do what you gotta do
    }
  }