The code gives no errors when processing an order, but no results either. At this point I am stumped, as I have added tracer output that should add a bit to the e-mail output no matter how well the code works, as long as the update method fires at all and $class->products_ordered_attributes is able to be updated from the method.
PHP Code:
class orderTagBuilder extends base {
function __construct() {
$this->attach($this, array('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM','NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS'));
//--------------------------^--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($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($this->tag_info)) {//add tags if they exist
foreach($this->tag_info[] as $tag_qty_out,$tag_text) {
$custom_insertable_text .= '<br /><br /><br />';
if(strpos($tag_text,'Vehicle') /== false) {//add car tag
$custom_insertable_text .= '
<br /><br /><br /><h2><strong>------------------------------------------<br />CAR TAG</strong></h2><br />' . $tag_text . '<br /><br /><br />';
}
//add tent tag
$custom_insertable_text .= '
<h2><strong>------------------------------------------<br />TENT TAG</strong></h2><br />' . $tag_text . '<br /><br /><br />';
}
}
$custom_insertable_text .= ' <br />testing output.<br /> ';//debug
$class->products_ordered_attributes .= $custom_insertable_text . ' <br />testing text output.<br /> ';//debug
unset $this->tag_info, $this->tag_qty, $tag_qty_out, $tag_text;//in case the customer wants to make another order
}//end add tag text to content
$class->products_ordered_attributes .= ' <br />testing text output - method run.<br /> ';//debug
}// /update
}
//eof
Bookmarks