Thread: Ftp Orders

Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    Oct 2010
    Posts
    4
    Plugin Contributions
    0

    Default 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
    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;
       }
    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;
       }
    
       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>&nbsp;</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 .= '&nbsp;';
            }
    
            $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();
    //_//}
      }
    }
    ?>

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

    Default 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 :)

  3. #13
    Join Date
    Oct 2010
    Posts
    4
    Plugin Contributions
    0

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

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

    Default 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

  5. #15
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

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

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 2 of 2 FirstFirst 12

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