I have the same problem. It shoould generate the file after order confirmation and do it very well when is cash on delivery, but doesn't when it's paid trough PayPal Standard. This php file even not activate I think. I need this code for every order.
Maybe as solution I could put this code in the php file which generates e-mail order ? At the end of the e-mail generation code.
Sorry that code is dumpy, but I'm not IT guy at all.
I think the problem is somewhere here, but not sure
Here is full code. It will be very nice if somebody suggest where to look.Code:<?php class ps_generate extends base { function ps_generate() { global $zco_notifier; $zco_notifier->attach($this, array('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL')); } function ps_config_switch() { if ( defined('GENERATE_PS') && (GENERATE_PS == 'false') ) { return false; } return true; }
Code:<?php class ps_generate extends base { function ps_generate() { global $zco_notifier; $zco_notifier->attach($this, array('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL')); } function ps_config_switch() { if ( defined('GENERATE_PS') && (GENERATE_PS == 'false') ) { return false; } return true; } function update(&$callingClass, $eventID) { if (!$this->ps_config_switch()) return; global $order, $insert_id, $db; $txt_doc .= '#11*'; $mainigie=array("Collection (Collection at shop)","FREE DELIVERY! (Free Delivery)"); $izejoshie=array("2","1"); $txt_doc .= '' . str_replace ($mainigie, $izejoshie, $order->info['shipping_method']) . ''; $txt_doc .= '*'; $oID = $insert_id; $txt_doc .= $oID; $txt_doc .= '*' . '%%%'; if ($display_images) { $txt_doc .= '<td class="dataTableHeadingContent">Picture of Item</td>' . "\r\n"; $txt_doc .= '<td class="dataTableHeadingContent">Quantity</td>' . "\r\n"; $txt_doc .= '<td class="dataTableHeadingContent">Item Name</td>' . "\r\n"; } else { $txt_doc .= ''; } $txt_doc .= ''; $txt_doc .= ''; for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { $txt_doc .= ''; if ($display_images && isset($order->products[$i]['id']) ) { $products = $db->Execute("SELECT products_image FROM " . TABLE_PRODUCTS . " WHERE products_id ='" . $order->products[$i]['id'] . "'"); $txt_doc .= ' <td class="dataTableContent" align="left"><img src="' . DIR_WS_CATALOG . DIR_WS_IMAGES . $products->fields['products_image'] . '" alt="' . $products->fields['products_image'] . '" title="' . $order->products[$i]['name'] . '" width="200" height="160" /></a> </td>' . ""; } // $txt_doc .= ' <td class="dataTableContent" valign="middle" align="center">'; if ($split) { if (isset($_GET['incl_product_' . $i])) { if ($reverse_split == 'odd') { $txt_doc .= zen_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS); } else { $txt_doc .= zen_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK); } } else { if ($reverse_split == 'odd') { $txt_doc .= zen_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK); } else { $txt_doc .= zen_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS); } } $txt_doc .= ' '; } $txt_doc .= '%%%' . $order->products[$i]['qty'] . 'x'; $mainigie3=array("<span style=", "color : #00FF00;",">(V)</span>"); $izejoshie3=array("","V",""); $txt_doc .= '' . str_replace ($mainigie3, $izejoshie3, $order->products[$i]['name']) . ' '; // $txt_doc .= '' . $order->products[$i]['name'] . ':'; if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) { for ($j=0, $k=sizeof($order->products[$i]['attributes']); $j<$k; $j++) { $mainigie5=array("None"); $izejoshie5=array("","",""); $txt_doc .= '/' . str_replace ($mainigie5, $izejoshie5, $order->products[$i]['attributes'][$j]['value']) . ' '; $txt_doc .= ''; } } $txt_doc .= ''; $txt_doc .= '-' . $order->products[$i]['final_price'] *$order->products[$i]['qty'] . ';'; } $txt_doc .= '*' . ' '; // uztaisiju formulu total-subtotal, jo nevareju atrast low order fee kur ir. principa tas ir nepareizi $txt_doc .= $order->info['total']-$order->info['subtotal'] . ';'; // te vajag delivery charge // handling charge // un tikai tad total $txt_doc .= '%%%TOTAL: ' . $order->info['total'] . $order->info['currency'] . ''; // te ir jabut verified vai ne. tas nozime, cik pirms tam ir bijis sutijumu. pagaidam ir verified visiem //$txt_doc .= '4;'; $txt_doc .= '%%%%%%Customer Info:%%%' . $order->customer['firstname']; $txt_doc .= ' '; $txt_doc .= $order->customer['lastname']; $txt_doc .= ''; //te ir visi parejie dati pie piegades adresem $txt_doc .= '%%%' . $order->delivery['street_address'] . ' '; $txt_doc .= $order->delivery['city'] . ' '; $txt_doc .= $order->delivery['state'] . ' '; $txt_doc .= $order->delivery['postcode'] . ' '; $mainigie2=array("Cash on Delivery", "Credit Card"); $izejoshie2=array("ORDER NOT PAID","ORDER PAID"); $txt_doc .= '%%%%%%' . str_replace ($mainigie2, $izejoshie2, $order->info['payment_method']) . ';'; //$txt_doc .= $order->customer['email_address']; $txt_doc .= '%%%%%%Phone No.' . $order->customer['telephone'] . '%%%%%%*'; $txt_doc .= '%%%' . $order->info['comments'] . '%%%'; $txt_doc .= '#'; $txt_doc .= '0x0d0x0a'; $txt_sms .= 'Balti Hut'; $oID = $insert_id; $txt_sms .= $oID; $txt_sms .= ' Customer: ' . $order->customer['firstname']; $txt_sms .= ' '; $txt_sms .= $order->customer['lastname']; $txt_sms .= ' '; $txt_sms .= 'Phone ' . $order->customer['telephone'] . ' '; $txt_sms .= $order->delivery['street_address'] . ' '; $txt_sms .= 'TOTAL: ' . $order->info['total'] . $order->info['currency'] . ' '; $mainigie4=array("Cash on Delivery", "Credit Card"); $izejoshie4=array("ORDER NOT PAID","ORDER PAID BY CARD"); $txt_sms .= '' . str_replace ($mainigie4, $izejoshie4, $order->info['payment_method']) . ''; //<!-- body_text_eof //--> //<!-- Generate HTML File //--> $txtFile = "printer" . "/testorder".".txt"; //Setting path n file name to saving location $ftxt = fopen($txtFile, 'w'); $fouttxt = fwrite( $ftxt , utf8_encode($txt_doc)); fclose($ftxt); ///$teksts = "$fprint$txt_sms"; ///$newteksts = wordwrap($teksts, 10, "\n", true); ///$failsFile = "printer" . "/fails".".txt"; ///$ffails = fopen($failsFile, 'w'); ///$fouttxt = fwrite($ffails, $newteksts); ///fclose($ffails); //_//$user = "vpshop"; //_//$password = "22222222222"; //_//$api_id = "33333333333333"; //_//$baseurl ="http://api.clickatell.com"; //_//$text = urlencode("$fprint($txt_sms)"); //_//$to = "111111111111111"; // auth call //_//$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id"; // do auth call //_//$ret = file($url); // split our response. return string is on first line of the data returned //_//$sess = split(":",$ret[0]); //_//if ($sess[0] == "OK") { //_//$sess_id = trim($sess[1]); // remove any whitespace //_//$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text"; // do sendmsg call //_//$ret = file($url); //_//$send = split(":",$ret[0]); //_//if ($send[0] == "ID") //_//echo "success //_//message ID: ". $send[1]; //_//else //_//echo "send message failed"; //_//} else { //_//echo "Authentication failure: ". $ret[0]; //_//exit(); //_//} } } ?>


Reply With Quote
