Zen Cart Logo
Forums / General Questions / Is notifier/observer system good for this?

Is notifier/observer system good for this?

Locked

Views: 2,033

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
15 May 2006, 11:18 AM
#1
s_p_ike avatar

s_p_ike

Zen Follower

Join Date:
Feb 2005
Location:
Italy
Posts:
178
Plugin Contributions:
0

Is notifier/observer system good for this?

Hello, I need to modify the download process (regarding virtual products).

The mod needed is that the filename of the file to be downloaded must be custom for each order.

Example: product A, filename: test.txt

I want the customer to download this file: order_id_test.txt

This is easy to achieve, simply modifying order.php, but since I have to create, on the fly, the file too (not a problem) and don't want to modify the core file if not needed I was wondering if I could use

$zco_notifier->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_BEGIN');

to call a class where I put

  • $filename = what I want
  • call external script passing filename, that create the file

May I use that notifier to modify the filename and call the external script?
Is this the correct way to proceed?

Thanks!

15 May 2006, 4:37 PM
#2
s_p_ike avatar

s_p_ike

Zen Follower

Join Date:
Feb 2005
Location:
Italy
Posts:
178
Plugin Contributions:
0

Re: Is notifier/observer system good for this?

Well, I need help on writing the update function of my class:

From the example (wiki)

  /**
   * Update Method
   * 
   * Called by observed class when any of our notifiable events occur
   *
   * @param object $class
   * @param string $eventID
   */
  function update(&$class, $eventID) {

Ok does $class must be $class or have I to name it according to the class I want to access?

$eventID: what's this? in wiki is said that this is the name of the notifier... well I don't understand how I have to define the name of my notifier, since in the example $eventID isn't used through the update function O_o

I think I'm missing a lot....

besides the definiton of function parameters, then I'd need to get what in order.php is defined this way: $attributes_values->fields['products_attributes_filename']

and change that variable value with something else

how may I access to that value and then replace it with something else?

I understood how to work with session variables (maybe) and how to access simple variables, but the one I need to access is beyond my knowledge of OOP.

Thank you very much!

18 May 2006, 9:58 AM
#3
s_p_ike avatar

s_p_ike

Zen Follower

Join Date:
Feb 2005
Location:
Italy
Posts:
178
Plugin Contributions:
0

Re: Is notifier/observer system good for this?

Hmmm... no one is using the notifier/observer system?

7 Aug 2006, 8:45 PM
#4
superprg avatar

superprg

Totally Zenned

Join Date:
Feb 2006
Location:
Chicago
Posts:
1,349
Plugin Contributions:
0

Re: Is notifier/observer system good for this?

s_p_ike:

Hmmm... no one is using the notifier/observer system?
Can someone explain more about it?
There is nothing much on google about it?
Is it a new concept or just being used in zen-cart?

7 Aug 2006, 9:15 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: Is notifier/observer system good for this?

I'm not sure the notifier system is what you need here.

You want the customer to download a file whose filename (when they receive it) is comprised of their order number and some text.

When does this file get uploaded to your server for them to be able to access?

7 Aug 2006, 9:16 PM
#6
drbyte avatar

drbyte

Sensei

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

Re: Is notifier/observer system good for this?

superprg:

Can someone explain more about it?
There is nothing much on google about it?
Is it a new concept or just being used in zen-cart?
Separate topic, but here's the information you seek:
http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#Observer_Class