Forums / General Questions / Using notifiers

Using notifiers

Locked

Started by arasii on 10 Aug 2006, 3:45 PM · Views: 1,666

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
10 Aug 2006, 3:45 PM
#1
arasii avatar

arasii

New Zenner

Join Date:
Feb 2006
Posts:
5
Plugin Contributions:
0

Using notifiers

Really I've tried several different ways just to get an indication that zc actually runs it.

I have had absolutely no luck so far.

I couldn't get it to work where I NEED it to work, so I backed up to test with a dummy variable put in the session cookie attached to the session'cart' class. That didn't work either!

The set up is:
in autoloaders/overrides/config.vendorProducts.php

<?php

$autoLoadConfig[90][] = array('autoType'=>'class',
                              'loadFile'=>'observers/class.vendorProducts.php');
$autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
                              'className'=>'vendorProducts',
                              'objectName'=>'vendorProducts');
?>

And in classes/observers/vendorProducts.php

<?php
 class vendorProducts extends base {
	 
	 function vendorProducts() {
$_SESSION['cart']->attach($this, array('NOTIFIER_CART_SHOW_TOTAL_END'));

	}
	function update(&$class, $eventID) {
	
		$_SESSION['vendorProducts'] = 'true';
	
	} // end function update
  }
?>

So what am I missing here?

TIA,
Arasii

10 Aug 2006, 5:36 PM
#2
arasii avatar

arasii

New Zenner

Join Date:
Feb 2006
Posts:
5
Plugin Contributions:
0

Re: Using notifiers

Never mind. Just how dim can I manage to be? LOL

file is named wrong.

In config.vendorProducts.php it calls:

$autoLoadConfig[90][] = array('autoType'=>'class',
                              'loadFile'=>'observers/class.vendorProducts.php');

Note the class.vendorProducts.php

The actual file was named just vendorProducts.php.

Well DUH.

Off and running again :-) Make no guarantees that I won't be back though LOL

Arasii

10 Aug 2006, 5:52 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Using notifiers

Thanks for the update! :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

10 Aug 2006, 6:18 PM
#4
arasii avatar

arasii

New Zenner

Join Date:
Feb 2006
Posts:
5
Plugin Contributions:
0

Re: Using notifiers

Okay, I fixed the error I found.

It's attaching to a class, so my understanding is that it does not have to use the stub notifier class.

It still does absolutely nothing. It does not even look like it's instantiating.

Here's the code:

in auto_loaders/overrides/config.vendorProducts.php

<?php

$autoLoadConfig[90][] = array('autoType'=>'class',
                              'loadFile'=>'observers/class.vendorProducts.php');
$autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
                              'className'=>'vendorProducts',
                              'objectName'=>'vendorProducts');
?>

in classes/observers/class.vendorProducts.php

<?php
/*
 *  Observer code used to track vendor/artist product sale
 *
 */
 class vendorProducts extends base {
 	/**  add date, product, and amt owed to vendor on product sale
	 *
	 */
	 
	 function vendorProducts() {
		 $this->attach('NOTIFY_ORDER_PROCESSING_CREDIT_ACCOUNT_UPDATE_BEGIN');
	}
	function update(&$class, $eventID) {
	
	$_SESSION['vendorProducts'] = 1;
	
		$amt_owed = 0;
		
		$vendor_product_id = $db->Insert_ID();
		
		$vendor_product_query = $db->Execute(" select manufacturers_id from " . TABLE_PRODUCTS . "
								where products_id = '" . zen_get_prid($this->products[$i]['id'] . "'");
								
		$vendor_order_query = $db->Execute(" select customers_id, date_purchased from " . TABLE_ORDERS . " 
								where orders_id = '" . $zf_insert_id "'");
								
		$vendor_amt_owed += $this->products[$i]['price'] * VENDOR_CUT;
								
 		sql_vendor_product_query = array('vendor_product_id') => $vendor_product_id,
										 'manufacturers_id' => $vendor_product_query->fields['manufacturers_id'],
										 'purchasers_customer_id' => $vendor_order_query->fields['customers_id'],
										 'order_id' => $zf_insert_id;
										 'product_id' => $this->products[$i]['id'],
										 'order_date' => $vendor_order_query->fields['date_purchased'],
										 'product_price' => $this->products[$i]['price'],
										 'vendor_order_amt_owed' => $vendor_amt_owed);
		
		zen_db_perform(TABLE_VENDOR_PRODUCTS, $sql_vendor_product_array);

	
	} // end function update
  }
?>

I'm missing something but I'm mystified as to what it is. Totally stumped. Help?

TIA
Arasii

11 Aug 2006, 1:39 AM
#5
arasii avatar

arasii

New Zenner

Join Date:
Feb 2006
Posts:
5
Plugin Contributions:
0

Re: Using notifiers

Well now I'm really embarrassed.

You know, it helps when you put the config file in the correct folder.

Not:
includes/auto_loaders/overrides

it's
includes/auto_loaders

GEEEEEEEEEZ

Posting in case some other makes the same mistake. :blush: