I posted this message to the forum on using the override system. But it seems to me now, that the forum on the community contributed add-ons will be more suitable as there is no separate forum on the zen cart architecture.
I apologize for asking such an elementary question, but I am just working on my first php code. And I do not understand how I can refer to the class objects constructed as session variables.
I would like to prepare the observe class attached to certain events. I have prepared the file config.sellingwarehouse.php which contains the following code:
PHP Code:
$autoLoadConfig[180][]= array('autoType' => 'class',
'loadFile' => 'observers/class.sellingwarehouse.php');
$autoLoadConfig[180][]= array('autoType' => 'classInstantiate',
'className' => 'sellingwarehouse',
'objectName' => 'sellingWarehouse',
'checkInstantiated' => true,
'classSession' => true);
As I uderstand the API tutorial in that way I will get new object instatiated in the following way:
PHP Code:
$_SESSION['sellingWarehouse']= new sellingwarehouse();
The class.sellingwarehouse.php looks like this:
PHP Code:
class sellingwarehouse extends base {
var $id, $address, $tax_idno, $licence_id, $telephone, $fax, $extraflags;
function sellingwarehouse () {
global $zco_notifier;
$zco_notifier -> attach($this,
array('NOTIFY_HEADER_START_CHECKOUT_PAYMENT',
'NOTIFY_HEADER_START_ACCOUNT_HISTORY_INFO',
'NOTIFY_HEADER_END_CHECKOUT_SUCCESS'));
} /* end constructor method */
function update(...) {
}
But I do not understand how I shall refer in the observer class and in the update() method there to the object variables.
Shal I use simply
PHP Code:
$this->address['postcode']="abcde";
or use $_SESSION like this:
PHP Code:
$_SESSION['sellingWarehouse']->address['postcode']="abcde";
If it is necessary to refer them using $_SESSION, shall then I declare in the constructor method the array for the address?
PHP Code:
$_SESSION['sellingWarehouse']->address= array();
It would be great if I could use also message_stack class for displaying debugging info. But I do not understand how does it work. I would appreciate any example on that subject too.
Thanks in advance for any help.
wdrwc
Bookmarks