From "require(DIR_WS_CLASSES . 'order.php');" it is obvious that there will not be an autoload breakpoint for the order class; the question is how to instantiate orderTagBuilder.php in a way that it attaches to the order class. It seems like this can't be done until after the order class is instantiated. Can I use the notifier mentioned to activate it in some way, or will a super-high breakpoint that instantiates orderTagBuilder.php allow it to come after the order class is active (if it is)? If the order class never activates, my class can sit there with nothing to do without harming anything or taking up (much) processing time, right? Ideally I'd like to instantiate orderTagBuilder.php only if the order class is active.
The last line in config.base.php is
PHP Code:
$autoLoadConfig[180][] = array('autoType'=>'init_script',
'loadFile'=> 'init_header.php');
?>
Would a class referenced in another config file with a breakpoint of 180 fire after this, or would 190 be needed to reliably do so? I'll try 200 anyway. My copy of config.core.php doesn't say anything about mod breakpoint setup.
The mention of non-modifiable parameters threw me for a few minutes, until I realized that it never had anything to do with what I was trying to do, but I didn't have enough time left to modify my original question.
I have refactored my code after study of order.php for better output, changed the breakpoint to 200, tried using the zco_notifier version of the update, and I still get no result. My current orderTagBuilder.php:
PHP Code:
class orderTagBuilder extends base {
public $tag_info = array();
public $tag_qty = 0;
public $tags_text = '';
public $tags_html = '';
function __construct() {
//$this->attach($this, array('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM','NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS','NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND'));
global $zco_notifier;//alternate version of constructor
$zco_notifier->attach($this, array('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM','NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS','NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND'));
//--------------------------^--to build tag info-----------------------------------^--to add tag text to content
}
function update(&$class, $eventID, $paramsArray) {//$sql_data_array is loaded into $paramsArray
//if(!isset($this->tag_qty)) $this->tag_qty = 0;
if($eventID == 'NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM') {
if(in_array((int)$paramsArray['products_prid'], array(7,15,17,18,24,25))) {//process tag info
if($paramsArray['products_options'] == 'Name') {
$this->tag_info[$this->tag_qty] .= '<br /><strong>-----------------------------------<br />' . $paramsArray['products_options_values'] . '</strong><br />';
$this->tag_qty++;
}
if(in_array($paramsArray['products_options'], array('Dates','Onsite phone','Vehicle','Zone preference'))) {
$this->tag_info[$this->tag_qty] .= $paramsArray['products_options'] . ': <strong>' . $paramsArray['products_options_values'] . '</strong><br />';
}
}
}//end build tag info
if ($eventID == 'NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS') {
if(/*is_array ????????*/ !empty($this->tag_info)) {//add tags if they exist
foreach($this->tag_info as $tag_qty_out=>$tag_text) {
$this->tags_text .= '
PLEASE PRINT THIS E-MAIL AND BRING IT WITH YOU FOR USE AS CAR AND TENT TAGS.
';
$this->tags_html .= '<br /><br /><br />PLEASE PRINT THIS E-MAIL AND BRING IT WITH YOU FOR USE AS CAR AND TENT TAGS.<br /><br /><br />';
if(strpos($tag_text,'Vehicle') !== false) {//add car tag
$this->tags_text .= '
------------------------------------------
CAR TAG
' . $tag_text . '
';
$this->tags_html .= '<br /><br /><br /><h2><strong>------------------------------------------<br />CAR TAG</strong></h2><br />' . $tag_text . '<br /><br /><br />';
}
//add tent tag
$this->tags_text .= '
------------------------------------------
TENT TAG
' . $tag_text . '
';
$this->tags_html .= '<h2><strong>------------------------------------------<br />TENT TAG</strong></h2><br />' . $tag_text . '<br /><br /><br />';
}
}
}//end create tag text
if ($eventID == 'NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS') {//attach welcome letter @ line 887
$class->products_ordered .= '
Tag text attaches here.
' . $this->tags_text;
$class->products_ordered_html .= '<br />Tag HTML attaches here.<br />' . $this->tags_html;
$class->products_ordered .= ' Camper welcome letter text attaches here. ';//CAMPER_WELCOME_LETTER;//todo - define a constant containing the welcome text (text version)
$class->products_ordered_html .= ' Camper welcome letter HTML attaches here. ';//CAMPER_WELCOME_LETTER;//todo - define a constant containing the welcome text (HTML version)
unset ($this->tag_info, $this->tag_qty, $tag_qty_out, $tag_text, $this->tags_text, $this->tags_html);//in case the customer wants to make another order
}//end add tags & welcome to content
$class->products_ordered_attributes .= ' <br />testing text output - method run.<br /> ';//debug
}// /update
}
//eof
Bookmarks