Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 12-12-2007 11:53:28

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Processing of Orders

Hello,

Most of my orders are done through PayPal.  When the arrive in my admin the of course say "Pending Shippment"  What I then do is look at items and the go back and update that order to "Complete" as I always have the items.. smile  At this point I then print out the invoice that mails with order as I ship all through mail.  I do this at this time because invoice shows everything shipped and completed.

Now if I were to go to Post Order Update and mail a Order conformation email to customer ,  the email itself would show updates but I hate that default subject line.  I ould much rater it say Linux CD Shop - Order Shipped - ORD200711223344 rather than the old default one that we all know.

Currently what I do is email an internal Post Order Update to myself and then reply to it as it goes to customer and change the subject line manually.

How could we add a true Post Order Update that we could define the subject line and still be able to send the default completed email included?  But have a field box in ost Update Order that we could change subject line??

Any ideas??  This could all be worked at Post Order Update screen.


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#2 12-12-2007 12:48:21

cyberws
Member
From: Atlanta, GA
Registered: 02-05-2004
Posts: 756

Re: Processing of Orders

You may alter mail subjects under "Mail: Messages, Mail and Subscriptions" then "Manage Mail Messages".


Jeremy O

Production CCP .:. Version 6 w/QuickBuy and many in house hacks
Skills: PHP & Perl programming, Solaris & Linux server administration, Oracle OCP training and MySQL experience

Offline

 

#3 12-12-2007 12:56:39

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

I could do that but I still want an Order Confirmation Message send at time of order and at Post order a different subject line.  Wont this change for all in this area??


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#4 12-12-2007 13:00:51

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Processing of Orders

I have done what you want but right now I will have to go back and document the steps I did and get it to you.

John

Offline

 

#5 12-12-2007 13:02:45

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

Thanks John


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#6 12-13-2007 16:34:00

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

Hi dh783

Hows the docs going... smile


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#7 12-13-2007 23:08:58

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Processing of Orders

I will see if I can lay this out in an understandable way.

First go to you admin Home > Kryptronic Hybrid X Core > Database: Connections, Backups and Raw Admin > Raw Database Admin and click Browse for khxc_mail database and clone ccp0.ordconfcust .

I named mine: 
id = ccp0.ordershipedcust (you can name it what you like but in the next part it refers to this email so if you name it differently you will need to change a part of the code).

You can place what you like in the Name* field and the defaultsubject* field, you can also change what will get printed in the email message in both the textincid (text message) and xhtmlincid (xhtml message) if you want.

If you want to change the summary of the order then you will need to make a duplicate of both CCP/includes/ ordersummarytxt.php and ordersummaryxhtml.php (which is what I did and named them ordersummaryshiptxt.php and ordersummaryshipxhtml.php and then include them in the call in the new email you created) so you could have a totally different order layout if you want but you don't have to do this.

Next go to your private_dir/khxc/apps/{app}/CCP_Order/ext and create a new extension named 0921_mailcustomership.php and insert this code:

Code:

<?php

// +------------------------------------------------------------------+
// | Class Definition                                                 |
// +------------------------------------------------------------------+

class CCP_Order_mailcustomership extends CCP_Order {

var $class   = 'CCP_Order_mailcustomership';
var $version = '6.0.0';
var $cerror;

var $KHXC_DB;
var $KHXC_File;
var $KHXC_Mail;

var $app;

// +------------------------------------------------------------------+
// | Constructor Function                                             |
// +------------------------------------------------------------------+

function CCP_Order_mailcustomership () {

// +--
// | This is the class constructor function.
// +--

if ($this->debug) {$this->debugger("constructor: Accessed.");}

// +--
// | Determine the application we're running under and set the $app
// | class var to that app.
// +--

$this->app = $this->app_id(__FILE__);

if ($this->debug) {$this->debugger("constructor: Determined application id as '{$this->app}'");}

// +--
// | Quick object load: KHXC_DB
// +--

$this->KHXC_DB =& $this->quick_object('KHXC_DB','khxc','KHXC_DB_1');

if ($this->IsError($this->KHXC_DB)) {$this->cerror = $this->KHXC_DB; return;}

// +--
// | Quick object load: KHXC_File
// +--

$this->KHXC_File =& $this->quick_object('KHXC_File','khxc');

if ($this->IsError($this->KHXC_File)) {$this->cerror = $this->KHXC_File; return;}

// +--
// | Quick object load: KHXC_Mail
// +--

$this->KHXC_Mail =& $this->quick_object('KHXC_Mail','khxc');

if ($this->IsError($this->KHXC_Mail)) {$this->cerror = $this->KHXC_Mail; return;}

// +--
// | Return $this.
// +--

return;

} // End of function.

// +------------------------------------------------------------------+
// | Function: exec                                                   |
// +------------------------------------------------------------------+

function exec ($order = array()) {

// +--
// | This function contains code that sends a customer order email
// | message for an order.
// +--

if (empty($order['order']['id'])) {

     $message = "The exec() method in the {$this->class} class was 
                 accessed without a valid order array.";

     $result = $this->RaiseError($message);

     if ($this->debug) {$this->debugger("exec: {$message}");}

     return $result;

} // End of if statement.

$trackingid = '';

if (!(empty($order['order']['trackupstools']))) { $trackingid = 1;}
if (!(empty($order['order']['trackusps']))) { $trackingid = 1;}
if (!(empty($order['order']['trackfedex']))) { $trackingid = 1;}

if (empty($trackingid)) {

     return $order;

} // End of if statement.

// +--
// | Take care of processing downloads (if we have any to process).
// +--

$order = $this->process_downloads($order);

// +--
// | Globalize the order for our includes.
// +--

$this->globals('ecom.order_summary',$order);

// +--
// | Send the email message.
// +--

$result = $this->KHXC_Mail->make_email_fromdb(array('id'       => $this->app . '.ordershipedcust',
                                                    'to'       => $order['order']['email'],
                                                    'from'     => $this->globals('khxc_settings.' . $this->app . '.primordemail'),
                                                    'presub'   => $this->globals('khxc_settings.' . $this->app . '.site_name') . ' - ',
                                                    'appsub'   => ' - ' . $order['order']['id']));

if ($this->IsError($result)) {

     if ($this->debug) {$this->debugger("exec: Error encountered while forumulating message.");}

     return $order;

} // End of if statement.

$result = $this->KHXC_Mail->send_email($result);

if ($this->IsError($result)) {

     if ($this->debug) {$this->debugger("exec: Error encountered while sending message.");}

     return $order;

} // End of if statement.

// +--
// | Log that we were here.
// +--

if ($this->debug) {$this->debugger("exec: Ran {$this->class} module for order '{$order['order']['id']}'.");}

// +--
// | Return the order array.
// +--

return $order;

} // End of function.

// +------------------------------------------------------------------+
// | End of Class                                               [KHXC]|
// +------------------------------------------------------------------+

} // End of class.

// +------------------------------------------------------------------+
// | End Of File                                                [KHXC]|
// +------------------------------------------------------------------+

?>

this is just a copy of the original mail extension except it will only tiger if there is a order tracking number for the order. If you named the new email anything other than what I called it you will have to edit this part of the above code:

Code:

// +--
// | Send the email message.
// +--

$result = $this->KHXC_Mail->make_email_fromdb(array('id'       => $this->app . '.ordershipedcust',

Now go to Home > Kryptronic Hybrid X Core > Database: Connections, Backups and Raw Admin > Raw Database Admin and click on Browse for khxc_selectcustom and clone ccp0.postordertasks.mailcustomer.

id* = ccp0.postordertasks.mailcustomership
selectname* = "what ever you want"
selectvalue* = mailcustomership (this has to be the same as what the new extension is named with out the numbers and under score)
selectorder = "what ever you want but I just placed it at the bottom which was 8"

Ok if I remembered every thing you should have a new email selection in you Post-Order Updates which when selected will send out the new email. Since I duplicated my ordersummary includes I also placed this code in the newly created includes to also print the tracking number in the customer shipped emails:

xhtml include

Code:

// +-----
// | Get the tracking numbers and setup the display.
// +-----

// +-----
// | Split the id's if we have more than one shipper, or
// | more than one tracking id.
// +-----

$xups = $order['order']['trackupstools'];
$ups = explode(",",$xups);

$xusps = $order['order']['trackusps'];
$usps = explode(",",$xusps);

$xfedex = $order['order']['trackfedex'];
$fedex = explode(",",$xfedex);

     if (!(empty($track_count))) {

          print '<div class="khxc_regtablehead">Tracking Information</div>' . $eol . $eol;

          print '<table id="TRACKINFO" class="khxc_regtable">' . $eol . $eol;

          print '<tr class="khxc_regtable">' . $eol;
          print '<td class="khxc_regtable" style="width: 100%"><p class="strong">Package Tracking Available</p>';
          print '<p>Tracking information is available online for this order.  To view ';
          print 'tracking information for this order you can login into your account and ';
          print 'access the Review Online Orders page in the Account Menu or check on the shipping status through the shippers ';
          print 'websit with the fellowing tracking numbers.</p>' . $eol;
          print '</td></tr>' . $eol;

        if (!(empty($xups))) {

             print '<tr class="khxc_regtable">' . $eol;
             print '<td class="khxc_regtable" style="width: 100%"><p class="strong">UPS Tracking</p>';

             foreach ($ups as $num => $upstrack) {

                  $tracknum = $ups[$num];

                  print '<p>' . $tracknum . '</p>' . $eol;

             } // End of for each statement.

                  print '</td></tr>' . $eol;

       } // End of if statement.

        if (!(empty($xusps))) {

             print '<tr class="khxc_regtable">' . $eol;
             print '<td class="khxc_regtable" style="width: 100%"><p class="strong">USPS Tracking</p>';

             foreach ($usps as $num => $uspstrack) {
       
                  print '<p>' . $usps[$num] . '</p>' . $eol;

             } // End of for each statement.

                  print '</td></tr>' . $eol;

       } // End of if statement.

        if (!(empty($xfedex))) {

             print '<tr class="khxc_regtable">' . $eol;
             print '<td class="khxc_regtable" style="width: 100%"><p class="strong">FEDEX Tracking</p>';

             foreach ($fedex as $num => $fedextrack) {
       
                  print '<p>' . $fedex[$num] . '</p>' . $eol;

             } // End of foreach statement.

                  print '</td></tr>' . $eol;

       } // End of if statement.

         print '</table>' . $eol;
         
     } // End of if statement.

text include

Code:

// +-----
// | Get the tracking numbers and setup the display.
// +-----

// +-----
// | Split the id's if we have more than one shipper, or
// | more than one tracking id.
// +-----



$xups = $order['order']['trackupstools'];
$ups = explode(",",$xups);

$xusps = $order['order']['trackusps'];
$usps = explode(",",$xusps);

$xfedex = $order['order']['trackfedex'];
$fedex = explode(",",$xfedex);

     if (!(empty($track_count))) {


          print '+----------------------------------------------------------+' . $eol;
          print '| Tracking Information                                     |' . $eol;
          print '+----------------------------------------------------------+' . $eol . $eol;

          print 'Tracking information is available online for this order.  To view ';
          print 'tracking information for this order you can login to your account and ';
          print 'access the Review Online Orders page in the Account Menu or check on the shipping ';
          print 'status through the shipper\'s websit with the fellowing tracking numbers.' . $eol . $eol;

        if (!(empty($xups))) {

             print 'UPS Tracking';

             foreach ($ups as $num => $upstrack) {

                  print $ups[$num] . $eol;

             } // End of for each statement.

       } // End of if statement.

        if (!(empty($xusps))) {

             print 'USPS Tracking';

             foreach ($usps as $num => $uspstrack) {

                  print $usps[$num] . $eol;

             } // End of for each statement.

       } // End of if statement.

        if (!(empty($xfedex))) {

             print 'FEDEX Tracking';

             foreach ($fedex as $num => $fedextrack) {

                  print $fedex[$num] . $eol;

             } // End of for each statement.

       } // end of if statement.


     } // End of if statement.

They need to be inserted after this code in the ordersummarys php includes:

Code:

     // +--
     // | Handle tracking numbers.
     // +--

     $track_count = 0;

     foreach ($order['order'] as $key => $data) {

          if ((preg_match('/^track/',$key)) && (!(empty($data)))) {

               $track_count++;

          } // End of if statement.

     } // End of foreach statement.

I hope that I explained it enough and I didn't forget anything, if I did forget something it wont brake anything until you select to send the email so it want effect the customer side of ccp6 and I would test the email by sending one to yourself to make sure every thing is working. The code posted here is what is running on my site so you shouldn't have a problem with that.

John

Edit to include the opening php tag in extension code.

Last edited by dh783 (12-14-2007 06:30:44)

Offline

 

#8 12-14-2007 00:06:00

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

I did everything as per instructions.  What happens.  Creates added Post Order checkbox.  But when I go thru a test order it fails and I get a mysql error.

I deleted what I did and tried a couple of times more with no luck.  Goes thru order process till last stage and then the final page in order process shows mysql error.  Emails are sent but still end up at end of order process with error.  I tried the checkbox in Post Order and it gives mysql error.

I do not use tracking at all so it could be that ext?

Anyhow could not get it to go..


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#9 12-14-2007 06:29:26

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Processing of Orders

After you posted that it wasn't working I have noticed that the extension code was missing the opening php tag, I have fixed the post above so it should work now, sorry.

John

Offline

 

#10 12-14-2007 12:46:58

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

Thanks the missing php tag solved mysql errors.  I cant believe I missed that.. smile  Since your 0921_mailcustomership.php relates to your tracking numbers having to be entered.  The "Shipped" confirmation email only gets sent if I enter anything into the UPS USPS tracking text fields in customer order area.

Since i want to send this email when I ship anything and do not want to enter stuff in the tracking fields how do I edit the 0921_mailcustomership.php to aviod this check.

Again email only sent when I have something in tracking field otherwise when I checkoff the Shipped confirmation in the Post Order area no email is sent..

Thanks again this is exactly what I wanted..


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#11 12-14-2007 12:57:45

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

Hi dh783

Ignore my last request.  I commented out the if statements for UPS USP FEDEX at beginning of 0921_mailcustomership.php and it seems to work fine.  Sends email when Post Order box is checked off..  Thanks again  One thing,  during an upgrade with installer.php will this all go away?  Or do upgrades not effect what we have done here?


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#12 12-14-2007 14:40:03

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

Hi dh783

Did some more testing and what happened when I commented out the tracking info it automatically at time of sale sent shipped email too.. smile  So I need to know what to edit in ext file to allow to send a Post Order email that does not contain tracking info?


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#13 12-14-2007 15:34:02

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

Hi dh783

Figured it out.  I used a custom Field area to enter Shipped in and changed your tracking call area to:

Code:

$shippedid = '';

if (!(empty($order['order']['customone']))) { $shippedid = 1;}


if (empty($shippedid)) {

     return $order;

} // End of if statement.

Now once I enter really anything in Custom Field One it will send the email when box checked off in Post Order.  Works for both my check and PayPal options.

Thanks again


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#14 12-14-2007 19:00:40

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Processing of Orders

Sorry I haven't pay much attention to this forum today but I have been trying to install an update that I missed last mouth. It's nice to know that you got it to work the way you wanted it to.

John

Offline

 

#15 12-14-2007 19:19:09

Perkster
Member
From: Parksville BC Canada
Registered: 10-05-2004
Posts: 349
Website

Re: Processing of Orders

Ya your code guided me..  Much appreciated.  Might not need Batch Shipping Mod now.. smile  I doubt it though as I will buy it when it is ready.  The mod you shared basically gives me a better and more unique Shipping Confirmation email rather than a repeat of the Order Confirmation that is in Post Order.Once I figured out the Custom Field One variable it gave the ext code a reason to hold off on sending email.  When I first used your code I tested with check order and no issues but then when I tested with a PayPal order it sent the shipping confirmation email right away probably due to order auto at Pending Shipment.  But now with the Custom Field switch,  sure one more thing to enter in order admin but now it sends the email when I check it off at Post Order.  I would think this might be a good thing to include in CCP6 default release as it does give a good email when order is done but may not work with everyone and all the shipping options that CCP6 contain and might be a nightmare to code.  For me it does what I want and is perfect..  Thanks

Last edited by Perkster (12-14-2007 19:20:37)


Mike Perks
Linux CD Shop - /shop for Linux distributions

ReviewLinux.Com - Linux OS News & Review Site

Offline

 

#16 03-26-2008 18:31:37

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: Processing of Orders

I tried this mod and it worked like a charm!  Thanks John & Perkster!

One minor change I made: I made the tracking number linkable to fedex.com:

old:

Code:

print '<p>' . $fedex[$num] . '</p>' . $eol;

new:

Code:

print '<p><a href="http://www.fedex.com/Tracking?&amp;cntry_code=ca_english&amp;language=english&amp;tracknumbers=' . $fedex[$num] . '">' . $fedex[$num] .  '</a></p>' . $eol;

My url is canadian (cntry_code=ca_english).  I guess I could have been fancy and set the url in a variable...but I don't know how smile  I just sent a test email and clicked the link, it works. 

Regards,

James...

Offline

 

#17 08-09-2008 23:54:41

greg_oz
Member
From: Adelaide, Australia
Registered: 01-20-2007
Posts: 102
Website

Re: Processing of Orders

This is a great mod

I changed the code as I had the same problem as perkster - I have no tracking and I was getting item shipped emails at time of order. I changed Perksters code so it just would not send an email until at least 120 seconds had elapsed since the order was placed.

Code:

 // see how long since the order has been made - if its less than 600 seconds then don't email:

if ((time() -$order['order']['epochorder']) <600) { 

return $order;

} // end check how long

Greg

Last edited by greg_oz (08-13-2008 23:58:28)

Offline

 

Board footer