Thread: Ftp Orders

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Jul 2011
    Posts
    8
    Plugin Contributions
    0

    Default 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

  2. #2
    Join Date
    Feb 2008
    Posts
    1,336
    Plugin Contributions
    1

    Default 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.

  3. #3
    Join Date
    Jul 2011
    Posts
    8
    Plugin Contributions
    0

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

  4. #4
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Ftp Orders

    Quote Originally Posted by smithygotlost View Post
    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

  5. #5
    Join Date
    Jul 2011
    Posts
    8
    Plugin Contributions
    0

    Default Re: Ftp Orders

    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->billing1''', ') . '</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_idtrue);
    $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_fileFTP_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

  6. #6
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Ftp Orders

    Quote Originally Posted by smithygotlost View Post
    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

  7. #7
    Join Date
    Jul 2011
    Posts
    8
    Plugin Contributions
    0

    Default 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

  8. #8
    Join Date
    Jul 2011
    Posts
    8
    Plugin Contributions
    0

    Default Re: Ftp Orders

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

    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->billing1''', ') . '</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 Code:
    <?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

  9. #9
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Ftp Orders

    Quote Originally Posted by smithygotlost View Post
    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

  10. #10
    Join Date
    Jul 2011
    Posts
    8
    Plugin Contributions
    0

    Default 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

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h FTP question
    By keyherbals in forum Upgrading to 1.5.x
    Replies: 3
    Last Post: 14 Aug 2012, 09:31 PM
  2. FTP limit
    By Justin3085 in forum General Questions
    Replies: 4
    Last Post: 14 Mar 2010, 05:55 AM
  3. FTP Help!!!
    By paddy100 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 25 Apr 2007, 09:19 PM
  4. ftp
    By snarkys in forum General Questions
    Replies: 3
    Last Post: 19 May 2006, 09:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg