Zen Cart Logo

Ftp Orders

Views: 3,448

Results 1 to 15 of 15
7 Jul 2011, 11:58 AM
#1
smithygotlost avatar

smithygotlost

New Zenner

Join Date:
Jul 2011
Posts:
8
Plugin Contributions:
0

Ftp Orders

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

7 Jul 2011, 12:40 PM
#2
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: Ftp Orders

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.

7 Jul 2011, 12:57 PM
#3
smithygotlost avatar

smithygotlost

New Zenner

Join Date:
Jul 2011
Posts:
8
Plugin Contributions:
0

Re: Ftp Orders

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 ?

7 Jul 2011, 2:18 PM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Ftp Orders

smithygotlost:

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

7 Jul 2011, 2:39 PM
#5
smithygotlost avatar

smithygotlost

New Zenner

Join Date:
Jul 2011
Posts:
8
Plugin Contributions:
0

Re: Ftp Orders

Ok the code is below

<?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

8 Jul 2011, 7:25 AM
#6
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Ftp Orders

smithygotlost:

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

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

8 Jul 2011, 9:28 AM
#7
smithygotlost avatar

smithygotlost

New Zenner

Join Date:
Jul 2011
Posts:
8
Plugin Contributions:
0

Re: Ftp Orders

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

14 Jul 2011, 8:30 AM
#8
smithygotlost avatar

smithygotlost

New Zenner

Join Date:
Jul 2011
Posts:
8
Plugin Contributions:
0

Re: Ftp Orders

Sorry i just saw my coding i posted it looks a state

<?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); 
*/
  }
  
  
  
}
?>

Hopefully this one looks better.

Does anyone have any ideas ?

i use this in auto config

<?php

$autoLoadConfig[90][] = array('autoType'=>'class',
                              'loadFile'=>'observers/class.ps_generate.php');
$autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
                              'className'=>'ps_generate',
                              'objectName'=>'ps_generate');

?>

still no joy. Any thoughts ?

Mike

15 Jul 2011, 12:21 PM
#9
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Ftp Orders

smithygotlost:

still no joy. Any thoughts ?

Sorry Mike, but I wasn't able to see anything that really stood out as being amiss, but I'm also no expert at this aspect of the code either, so I've had to place this in the 'too hard or time consuming' basket.

Perhaps someone else may have ideas?

Cheers
Rod

15 Jul 2011, 1:54 PM
#10
smithygotlost avatar

smithygotlost

New Zenner

Join Date:
Jul 2011
Posts:
8
Plugin Contributions:
0

Re: Ftp Orders

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

6 Nov 2011, 1:02 PM
#11
hl9758 avatar

hl9758

New Zenner

Join Date:
Oct 2010
Posts:
4
Plugin Contributions:
0

Re: Ftp Orders

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

<?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;
   }

Here is full code. It will be very nice if somebody suggest where to look.

<?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();
//_//}
  }
}
?>
6 Nov 2011, 1:06 PM
#12
smithygotlost avatar

smithygotlost

New Zenner

Join Date:
Jul 2011
Posts:
8
Plugin Contributions:
0

Re: Ftp Orders

I spent roughtly 16 hours sorting it, THe problem is using standard paypal doesnt active the hooks, I found that if you set it up as checkout express one the zen cart works better but this too makes the mod work. when i get a chance ill code this around standard paypal ipn but untill then that was my work around :)

8 Nov 2011, 9:34 AM
#13
hl9758 avatar

hl9758

New Zenner

Join Date:
Oct 2010
Posts:
4
Plugin Contributions:
0

Re: Ftp Orders

I think it's not easy to solve it out. here is link to the tutorials and this is exctraction > When paying with PayPal Standard, if the customer pays without making a PayPal account and closes their browser when presented with the invitation to make one, your store sits in limbo and never gets the order (due to a bug in PayPal's logic, which they've not fixed yet). https://www.zen-cart.com/tutorials/index.php?article=28 If somebody know how PayPal Standard (IPN) execute the e-mail order accepted send out to customer, please give me a note. I don't understand at the moment. Thanks in advance for any help.

8 Nov 2011, 9:38 AM
#14
smithygotlost avatar

smithygotlost

New Zenner

Join Date:
Jul 2011
Posts:
8
Plugin Contributions:
0

Re: Ftp Orders

i would dissagree, The paypal express still requires the ipn address and still fires a trigger hook to your site upon payment so whether or not they return to your site their order still goes into processing, I currently have like 6 sites running this and none has any issues :)

Mike

9 Nov 2011, 6:44 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Ftp Orders

Using Express Checkout will cause the notifiers to execute, and thus the code will perform properly.
Using PayPal Standard, those notifiers will not execute, so your custom code will not run.