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 03-30-2010 08:13:19

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Including additional info in confirmation e-mail

Hi,

We frequently include promotional items with the products we sell e.g. "GPS navigator including free case".

As the Item name gets used all over the place and the offers change, we don't generally want to add "....including free case' or whatever to the item name. We just include the offer in the text of the product page.

This works well enough for sales purposes but we get a small number of e-mails saying something like, " ... I have my order confirmation e-mail and it says you have the order for .... but it doesn't mention the free item ...please confirm blah blah".

So what I would like to do is modify the code to include the free item in the confirmation e-mail.

My thoughts on this is to add a user defined column to the product database, called say, "promoitem", where I can include the desired text.

Then when the confirmation mail is created if "promoitem" is not empty the text gets printed.

I have found the following in the include > Order Summary (Order Confirmation)

Code:

foreach ($order['items'] as $num => $item) {
                   // +--
                   // | Print our cell opener and the item information.
                   // +--

                   print '<tr class="khxc_regtable">' . $eol;

                   // Print the Quntity.
                       print '<td class="khxc_regtable" style="width: 10%">' . $eol;
                      print $this->xhtml_encode($item['itemquan']) . $eol;
                   print '</td>' . $eol;
                       // Print Product Details
                   print '<td class="khxc_regtable" style="width: 60%">' . $eol;
                   if ($shownums) {$name = $item['itemnum'] . ' - ' . $item['itemname'];}
                   else           {$name = $item['itemname'];}

                   $name = $this->xhtml_encode($name);

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

                   if (!(empty($item['itemopts']))) {

                       print '<p>' . $this->xhtml_encode($item['itemopts']) . '</p>';

                   } // End of if statement.

As I really have very little idea about PHP I was thinking about copying the item option part of the code for my new text. So I would have:-

Code:

foreach ($order['items'] as $num => $item) {
                   // +--
                   // | Print our cell opener and the item information.
                   // +--

                   print '<tr class="khxc_regtable">' . $eol;

                   // Print the Quntity.
                       print '<td class="khxc_regtable" style="width: 10%">' . $eol;
                      print $this->xhtml_encode($item['itemquan']) . $eol;
                   print '</td>' . $eol;
                       // Print Product Details
                   print '<td class="khxc_regtable" style="width: 60%">' . $eol;
                   if ($shownums) {$name = $item['itemnum'] . ' - ' . $item['itemname'];}
                   else           {$name = $item['itemname'];}

                   $name = $this->xhtml_encode($name);

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

                   if (!(empty($item['promoitem']))) {

                       print '<p>' . $this->xhtml_encode($item['promoitem']) . '</p>';

                  if (!(empty($item['itemopts']))) {

                       print '<p>' . $this->xhtml_encode($item['itemopts']) . '</p>';

                   } // End of if statement.

However this may be way to simplistic!

The site is live so I can do some experimentation in the small hours but it would be good to know I had a chance of success before changing things.

Any advice on how to actually make this work would be much appreciated.

Rob

Offline

 

#2 03-30-2010 15:42:53

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Re: Including additional info in confirmation e-mail

I don't see why that should not work, provided that you also made it so that promoitem got added to the cart automatically if some other item was present. - I am not sure how to do that but, personally, I would do it through a modification to the display used for the promotional items.

You would first have to find the part that dealt with adding the product to the cart and you would then have to modify it with an if statement or the like, so...

// add to cart code

if ($proddisp['name'] == someitem) {

// add to cart process ($proddisp ['promoitem']); }

To avoid complications with promoitem not being recognised as an item it would also be easier to make an actual item listing for promoitem, and to set the visibility to no-one for the item - so it would still be an item in the database, only not visible in the shop.

Last edited by Design_Wholesale (03-30-2010 15:45:28)

Offline

 

#3 03-30-2010 16:24:12

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

Re: Including additional info in confirmation e-mail

Your problem here is that your new product column entry is not in the order array. When an item is pulled from the database for the product detail display all database columns are pulled and placed into the product array and are available, but only the bare essential information for a product makes it into the order array for that product. If you really want to do it the way you have posted here you will need to edit the build_item function located in the CCP(GBU)_Cart.php script to get that field into the array which is part of the order array.
In may case I created a list of product options which defaults to the free product included in the sale which gets placed automatically into the array as product options and also is printed in emails and order summaries.

John

Offline

 

#4 03-31-2010 03:22:11

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: Including additional info in confirmation e-mail

Thanks guys!

John, great idea to work this this through the product options function since it already exists and has the functionality to do what I need it to.

I will take a look at this and also at the gbu_cart.php script.

Rob

Offline

 

#5 04-01-2010 19:20:06

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Re: Including additional info in confirmation e-mail

No problem. - I am glad that that you were able to understand what I was trying to tell you. - I've probably been driving John (yes, dh783 is called John, too smile ) to distraction this last week with questions about if statements, so it is only fair that I unleash some of that new-found know-how in confusing the hell out of someone else big_smile ...

Last edited by Design_Wholesale (04-01-2010 19:20:46)

Offline

 

Board footer