Hey all,
Been setting up an online shop and i need to ftp the emails over to a company that send the stuff to them.
I used the automated packing slip addon which works a treat but wont work if people use paypal.
Anyone got any ideas ?
Cheers
Mike
Hey all,
Been setting up an online shop and i need to ftp the emails over to a company that send the stuff to them.
I used the automated packing slip addon which works a treat but wont work if people use paypal.
Anyone got any ideas ?
Cheers
Mike
How do you ftp an email? File Transfer Protocol is used to transfer files from one server to another such as Your Computer to Remote Server and vise versa. FTP has nothing to do with emails.
If you are wanting to email orders to your suppliers (drop ship), there is a module called Purchase Order which allow you to select an order and email it to your supplier/suppliers.
um sorry didnt make that clear.. the addon script ive used creates an xml file on the server called the orderid date n then order ie
107072011order.xml
which is what the automated packing slip addon does.
ive got the ftp working too problem i have is when people use paypal it doesnt do it. if they pay using cash on delivery it works.
Not sure as to how or why..
Any ideas ?
The ideas will be far too numerous to consider.
I think the best idea in this case is to post your code/scripts into one of these postings so that we can see exactly how you are achieving what *is* working, and from there we may be able to offer suggestions or ideas as to why PayPal isn't.
I don't think there is really any other way to solve this.
Cheers
Rod
Ok the code is below
PHP Code:<?php
##class ps_generate extends base {
#### function ps_generate() {
#### ## global $zco_notifier;
#### ## $zco_notifier->attach($this, array('NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES'));
#### }
#### function ps_config_switch() {
#### ## ## return true;
#### }
#### function update(&$callingClass, $eventID) {
#### ## ## if (!$this->ps_config_switch()) return;
#### ## ## global $order, $insert_id, $db;
## //Begin Shipping Weight Calculation
## $shipping_weight = $order->total_weight;
## $za_tare_array = split("[:,]" , SHIPPING_BOX_WEIGHT);
#### ## ## $zc_tare_percent= $za_tare_array[0];
#### ## ## $zc_tare_weight= $za_tare_array[1];
#### ## ## $za_large_array = split("[:,]" , SHIPPING_BOX_PADDING);
#### ## ## $zc_large_percent= $za_large_array[0];
#### ## ## $zc_large_weight= $za_large_array[1];
## switch (true) {
#### ## ## ##// large box add padding
#### ## ## ##case(SHIPPING_MAX_WEIGHT <= $shipping_weight):
#### ## ## ##$shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight;
#### ## ## ##break;
#### ## ## ##default:
#### ## ## ##// add tare weight < large
#### ## ## ##$shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight;
#### ## ## ##break;
#### ## ##} //End Shipping Weight Calculation
$oID = $insert_id;
$display_images = 1;
####
$html_doc = '<?xml version="1.0" encoding="Windows-1252"?>' . "\r\n";
$html_doc .= '<AVXML>' . "\r\n";
$html_doc .= ' ##<SIGNONMSGSRQ>' . "\r\n";
$html_doc .= ' ## ##<SONRQ>' . "\r\n";
$html_doc .= ' ## ## ##<DTCLIENT>09-02-2011T16:50:38</DTCLIENT>' . "\r\n";
$html_doc .= ' ## ## ##<USERID>WEBSRV</USERID>' . "\r\n";
$html_doc .= ' ## ## ##<USERPASS>2173780105</USERPASS>' . "\r\n";
$html_doc .= ' ## ## ##<ADMIN>S11</ADMIN>' . "\r\n";
$html_doc .= ' ## ## ##<APPID>ACCOUNTVIEW</APPID>' . "\r\n";
$html_doc .= ' ## ## ##<APPVER>0700A</APPVER>' . "\r\n";
$html_doc .= ' ## ##</SONRQ>' . "\r\n";
$html_doc .= ' ##</SIGNONMSGSRQ>' . "\r\n";
$html_doc .= ' ##<EBUSMSGSRQ>' . "\r\n";
$html_doc .= ' ## ##<EBUSTRNRQ>' . "\r\n";
$html_doc .= ' ## ## ## <TRNUID>ps' . $oID . ''. strftime('%Y%b%d%H%M') .'.xml</TRNUID>' . "\r\n";
$html_doc .= ' ## ## ## <BUSOBJ>So1</BUSOBJ>' . "\r\n";
$html_doc .= ' ## ## ## <ROWADDRQ>' . "\r\n";
$html_doc .= ' ## ## ## ##<RPL_DEL>EF_MADEX</RPL_DEL>' . "\r\n";
$html_doc .= ' ## ## ## ##<COMMENT1>Order id : ' . $oID . ' </COMMENT1>' . "\r\n";
$html_doc .= ' ## ## ## ##<COMMENT2></COMMENT2>' . "\r\n";
$html_doc .= ' ## ## ## ## <INV_CP>' . $order->customer['email_address'] . '</INV_CP>' . "\r\n";
$html_doc .= ' ## ## ## ## <DEL_CP>' . $order->customer['telephone'] . '</DEL_CP>' . "\r\n";
$html_doc .= ' ## ## ## ## <SEL_CODE>SMORD</SEL_CODE>' . "\r\n"; // EFULL --- CURRENTLY ON TEST ---
$html_doc .= ' ## ## ## ## <ORD_DATE>' . strftime('%Y-%m-%d') . '</ORD_DATE>' . "\r\n";
$html_doc .= ' ## ## ## ## <INV_DATE>' . strftime('%Y-%m-%d') . '</INV_DATE>' . "\r\n";
$html_doc .= ' ## ## ## ## <DEL_DATE>' . strftime('%Y-%m-%d') . '</DEL_DATE>' . "\r\n";
$html_doc .= ' ## ## ## ## <DEL_ADDR>' . zen_address_format($order->customer['format_id'], $order->billing, 1, '', ', ') . '</DEL_ADDR>' . "\r\n";
$html_doc .= ' ## ## ## ## <CNT_CODE>GB</CNT_CODE>' . "\r\n";
$html_doc .= ' ## ## ## ## <CAMPAIGN>STD</CAMPAIGN>' . "\r\n";
######
#### ## ##for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
$html_doc .= ' ## ## ## ## <SO_LINE>' . "\r\n";
$html_doc .= ' ## ## ## ## ## <ORG_OF_ORD>9</ORG_OF_ORD>' . "\r\n";
$html_doc .= ' ## ## ## ## ## <ART_CODE>' . $order->products[$i]['model'] . '</ART_CODE>' . "\r\n";
$html_doc .= ' ## ## ## ## ## <ORD_QTY>' . $order->products[$i]['qty'] . '</ORD_QTY>' . "\r\n";
$html_doc .= ' ## ## ## ## </SO_LINE>' . "\r\n";
#### ## ##}
$post = $order->info['shipping_module_code'];
if($post == "flat_flat"){
$html_doc .= ' ## ##<SO_LINE>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ORG_OF_ORD>9</ORG_OF_ORD>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ART_CODE>EF_1STCLASS</ART_CODE>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ORD_QTY>1</ORD_QTY>' . "\r\n";
$html_doc .= ' ## ## ## ##</SO_LINE>' . "\r\n";
} else if($post == "flatClone_flatClone"){
$html_doc .= ' ## ##<SO_LINE>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ORG_OF_ORD>9</ORG_OF_ORD>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ART_CODE>EF_1STTRACKED</ART_CODE>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ORD_QTY>1</ORD_QTY>' . "\r\n";
$html_doc .= ' ## ## ## ##</SO_LINE>' . "\r\n";
} else if($post == "flatClone1_flatClone1"){
$html_doc .= ' ## ##<SO_LINE>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ORG_OF_ORD>9</ORG_OF_ORD>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ART_CODE>EF_SPECDELND</ART_CODE>' . "\r\n";
$html_doc .= ' ## ## ## ## ##<ORD_QTY>1</ORD_QTY>' . "\r\n";
$html_doc .= ' ## ## ## ##</SO_LINE>' . "\r\n";
}
$html_doc .= ' ## ## ##</ROWADDRQ>' . "\r\n";
$html_doc .= ' ## ##</EBUSTRNRQ>' . "\r\n";
$html_doc .= ' ##</EBUSMSGSRQ>' . "\r\n";
$html_doc .= '</AVXML>' . "\r\n";
//<!-- body_text_eof //-->
//<!-- Generate HTML File //-->
$htmlFile = "orders" . "/ps" . $oID . "" . strftime('%Y%b%d%H%M') . ".xml"; //Setting path n file name to saving location
$fhtml = fopen($htmlFile, 'a');
$fouthtml = fwrite( $fhtml , $html_doc );
fclose($fhtml);
$ftp_server = "epos.smiffys.com";
// set up basic connection
$conn_id = ftp_connect($ftp_server);##
ftp_pasv($conn_id, true);
$ftp_user_name = "EF_MADEX";
$ftp_user_pass = "";
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);##
// check connection
if ((!$conn_id) || (!$login_result)) {##
#### ##echo "FTP connection has failed!";
#### ##echo "Attempted to connect to $ftp_server for user $ftp_user_name";##
#### ##exit;##
} else {
}
// upload the file
$destination_file = "ps" . $oID . "" . strftime('%Y%b%d%H%M') . ".xml";
$source_file = "/home/fancydre/www/orders/ps" . $oID . "" . strftime('%Y%b%d%H%M') . ".xml";
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);##
// check upload status
if (!$upload) {##
} else {
}
// close the FTP stream##
ftp_close($conn_id);##
####}
####
####
####
}
?>
This is all working along it's a cash payment i.e cash on delivery then it all works but when you put it on paypal it doesn't work...wish I could work out why
Cheers
Mike
Is is possible for you to determine whether the problem is with the .xml file being created (not being created), or is it a problem with the reading and/or FTP'ing the file to the server?
I've not looked at your code in great detail, and you're postings have been a little ambiguous in this regard, but what I HAVE seen from your code is that this determination will help narrow down the part of your code where we need to be concentrating.
Cheers
Rod
Thanks for the reply,
Through all my testing when it's a paypal payment it doesn't even create the XML file. However like I said if you pay with cash on delivery it creates it and uploads. So it's something to do with how paypal handles the payments whithin zen cart
Sorry i just saw my coding i posted it looks a state
Hopefully this one looks better.PHP Code:<?php
class ps_generate extends base {
function ps_generate() {
global $zco_notifier;
$zco_notifier->attach($this, array('NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES'));
}
function ps_config_switch() {
return true;
}
function update(&$callingClass, $eventID) {
if (!$this->ps_config_switch()) return;
global $order, $insert_id, $db;
//Begin Shipping Weight Calculation
$shipping_weight = $order->total_weight;
$za_tare_array = split("[:,]" , SHIPPING_BOX_WEIGHT);
$zc_tare_percent= $za_tare_array[0];
$zc_tare_weight= $za_tare_array[1];
$za_large_array = split("[:,]" , SHIPPING_BOX_PADDING);
$zc_large_percent= $za_large_array[0];
$zc_large_weight= $za_large_array[1];
switch (true) {
// large box add padding
case(SHIPPING_MAX_WEIGHT <= $shipping_weight):
$shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight;
break;
default:
// add tare weight < large
$shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight;
break;
} //End Shipping Weight Calculation
$oID = $insert_id;
$display_images = 1;
$html_doc = '<?xml version="1.0" encoding="Windows-1252"?>' . "\r\n";
$html_doc .= '<AVXML>' . "\r\n";
$html_doc .= ' <SIGNONMSGSRQ>' . "\r\n";
$html_doc .= ' <SONRQ>' . "\r\n";
$html_doc .= ' <DTCLIENT>09-02-2011T16:50:38</DTCLIENT>' . "\r\n";
$html_doc .= ' <USERID>WEBSRV</USERID>' . "\r\n";
$html_doc .= ' <USERPASS>2173780105</USERPASS>' . "\r\n";
$html_doc .= ' <ADMIN>S11</ADMIN>' . "\r\n";
$html_doc .= ' <APPID>ACCOUNTVIEW</APPID>' . "\r\n";
$html_doc .= ' <APPVER>0700A</APPVER>' . "\r\n";
$html_doc .= ' </SONRQ>' . "\r\n";
$html_doc .= ' </SIGNONMSGSRQ>' . "\r\n";
$html_doc .= ' <EBUSMSGSRQ>' . "\r\n";
$html_doc .= ' <EBUSTRNRQ>' . "\r\n";
$html_doc .= ' <TRNUID>ps' . $oID . ''. strftime('%Y%b%d%H%M') .'.xml</TRNUID>' . "\r\n";
$html_doc .= ' <BUSOBJ>So1</BUSOBJ>' . "\r\n";
$html_doc .= ' <ROWADDRQ>' . "\r\n";
$html_doc .= ' <RPL_DEL>EF_MADEX</RPL_DEL>' . "\r\n";
$html_doc .= ' <COMMENT1>Order id : ' . $oID . ' </COMMENT1>' . "\r\n";
$html_doc .= ' <COMMENT2></COMMENT2>' . "\r\n";
$html_doc .= ' <INV_CP>' . $order->customer['email_address'] . '</INV_CP>' . "\r\n";
$html_doc .= ' <DEL_CP>' . $order->customer['telephone'] . '</DEL_CP>' . "\r\n";
$html_doc .= ' <SEL_CODE>SMORD</SEL_CODE>' . "\r\n"; // EFULL --- CURRENTLY ON TEST ---
$html_doc .= ' <ORD_DATE>' . strftime('%Y-%m-%d') . '</ORD_DATE>' . "\r\n";
$html_doc .= ' <INV_DATE>' . strftime('%Y-%m-%d') . '</INV_DATE>' . "\r\n";
$html_doc .= ' <DEL_DATE>' . strftime('%Y-%m-%d') . '</DEL_DATE>' . "\r\n";
$html_doc .= ' <DEL_ADDR>' . zen_address_format($order->customer['format_id'], $order->billing, 1, '', ', ') . '</DEL_ADDR>' . "\r\n";
$html_doc .= ' <CNT_CODE>GB</CNT_CODE>' . "\r\n";
$html_doc .= ' <CAMPAIGN>STD</CAMPAIGN>' . "\r\n";
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
$html_doc .= ' <SO_LINE>' . "\r\n";
$html_doc .= ' <ORG_OF_ORD>9</ORG_OF_ORD>' . "\r\n";
$html_doc .= ' <ART_CODE>' . $order->products[$i]['model'] . '</ART_CODE>' . "\r\n";
$html_doc .= ' <ORD_QTY>' . $order->products[$i]['qty'] . '</ORD_QTY>' . "\r\n";
$html_doc .= ' </SO_LINE>' . "\r\n";
}
$post = $order->info['shipping_module_code'];
if($post == "flat_flat"){
$html_doc .= ' <SO_LINE>' . "\r\n";
$html_doc .= ' <ORG_OF_ORD>9</ORG_OF_ORD>' . "\r\n";
$html_doc .= ' <ART_CODE>EF_1STCLASS</ART_CODE>' . "\r\n";
$html_doc .= ' <ORD_QTY>1</ORD_QTY>' . "\r\n";
$html_doc .= ' </SO_LINE>' . "\r\n";
} else if($post == "flatClone_flatClone"){
$html_doc .= ' <SO_LINE>' . "\r\n";
$html_doc .= ' <ORG_OF_ORD>9</ORG_OF_ORD>' . "\r\n";
$html_doc .= ' <ART_CODE>EF_1STTRACKED</ART_CODE>' . "\r\n";
$html_doc .= ' <ORD_QTY>1</ORD_QTY>' . "\r\n";
$html_doc .= ' </SO_LINE>' . "\r\n";
} else if($post == "flatClone1_flatClone1"){
$html_doc .= ' <SO_LINE>' . "\r\n";
$html_doc .= ' <ORG_OF_ORD>9</ORG_OF_ORD>' . "\r\n";
$html_doc .= ' <ART_CODE>EF_SPECDELND</ART_CODE>' . "\r\n";
$html_doc .= ' <ORD_QTY>1</ORD_QTY>' . "\r\n";
$html_doc .= ' </SO_LINE>' . "\r\n";
}
$html_doc .= ' </ROWADDRQ>' . "\r\n";
$html_doc .= ' </EBUSTRNRQ>' . "\r\n";
$html_doc .= ' </EBUSMSGSRQ>' . "\r\n";
$html_doc .= '</AVXML>' . "\r\n";
//<!-- body_text_eof //-->
//<!-- Generate HTML File //-->
$htmlFile = "orders" . "/ps" . $oID . "" . strftime('%Y%b%d%H%M') . ".xml"; //Setting path n file name to saving location
$fhtml = fopen($htmlFile, 'a');
$fouthtml = fwrite( $fhtml , $html_doc );
fclose($fhtml);
/*
$ftp_server = "epos.smiffys.com";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
ftp_pasv($conn_id, true);
$ftp_user_name = "EF_MADEX";
$ftp_user_pass = "6e0fbdea7d";
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
}
// upload the file
$destination_file = "ps" . $oID . "" . strftime('%Y%b%d%H%M') . ".xml";
$source_file = "/home/fancydre/www/orders/ps" . $oID . "" . strftime('%Y%b%d%H%M') . ".xml";
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
} else {
}
// close the FTP stream
ftp_close($conn_id);
*/
}
}
?>
Does anyone have any ideas ?
i use this in auto config
still no joy. Any thoughts ?PHP Code:<?php
$autoLoadConfig[90][] = array('autoType'=>'class',
'loadFile'=>'observers/class.ps_generate.php');
$autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
'className'=>'ps_generate',
'objectName'=>'ps_generate');
?>
Mike
I was wondering these hooks that check the script, does paypal not use these ? is there anything that all payment methods use regardless to hook too ?
Mike