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 08-12-2011 13:36:54

JDLS88
Member
From: Maryland, USA
Registered: 07-06-2011
Posts: 102
Website

Include custom fields from prod database in order mail

I've created two custom columns in the products table that I need to be displayed in the order email that gets sent out to the shipper. I'm slightly overwhelmed by there being 5 different ordersummary php files and not knowing what the proper CCP7 way of calling something from the database would be.

Thanks in advance.


Jeremy D.

Offline

 

#2 08-12-2011 21:54:08

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

Re: Include custom fields from prod database in order mail

First you would need to make an edit to the ECOM_Cart/ECOM_Cart.PHP in the function build_item to get your culumns in the order items array ( the array that is built is at the end of the function). Once you done that then you can pull the information in the order summary.

John

Offline

 

#3 08-15-2011 11:14:24

JDLS88
Member
From: Maryland, USA
Registered: 07-06-2011
Posts: 102
Website

Re: Include custom fields from prod database in order mail

I was running a test to see if I could properly pass data onto the email. I put a bit of test data into the array and tried to call it in the productsummary.php (also productsummaryxhtml.php)...aaand nothing happens. So I tried print_r just to see if it was even able to access the array and it printed the entire array correctly, including the test data I put into the array. Yet when I try to specifically call on the test data, nothing happens. I tried calling on the product ID in the same array and still nothing.

Any ideas why this is happening?

To go over exactly what I'm trying to do, there's an alternative vendor name and vendor price for each product that I need to be mailed out via the shipper email.

Last edited by JDLS88 (08-15-2011 12:23:59)


Jeremy D.

Offline

 

#4 08-16-2011 04:27:46

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

Re: Include custom fields from prod database in order mail

Not knowing where (exact place in the script) and how you tried to call the information, and or what your array looks like then one can only guess that your not calling it correctly.
Within the standard ordersummaryxhtml.php script there would be this section

Code:

               // +--
               // | Print our item information cell.
               // +--

               if ($ship_type != 'NOTSHIPPED') {print '<td class="regtable" style="width: 50%">' . $eol;}
               elseif ($ship_count == 0)       {print '<td class="regtable" style="width: 100%">' . $eol;}
               else                            {print '<td class="regtable" style="width: 100%" colspan="2">' . $eol;}

               foreach ($ship_items as $key_num => $item_num) {

                    foreach ($order['items'] as $num => $item) {

If your within the last foreach statement then the call should be something like (your_data = new column)

Code:

print $item['your_data'];

but this is a guess at this time since I don't know  your exact array.

John

Offline

 

#5 08-18-2011 10:28:45

JDLS88
Member
From: Maryland, USA
Registered: 07-06-2011
Posts: 102
Website

Re: Include custom fields from prod database in order mail

Here's what I've got:

I used some text as test values for the array to see if I could properly pass them through (around line 1537):

Code:

// +--
// | Formulate the item.
// +--

$item = array('randid'          => $this->random_key(12),
              'id'              => $product['id'],
              'quantity'        => $quantity,
              'name'            => $product['name'],
              'number'          => $product['prodnum'],
              'imgsm'           => $product['imgsm'],
              'prodinv'         => $product['useinv'],
              'optdisp'         => $optnamevals,
              'optselids'       => $optselids,
              'optids'          => $optids,
              'optinv'          => $optinv,
              'dlfiles'         => $dlfiles,
              'delmethod'       => $product['delmethod'],
              'sinshipinfo'     => $sinshipinfo,
              'shipemail'       => $shipemail,
              'sinprodprice'    => $sinprodprice,
              'sinoptprice'     => $sinoptprice,
              'sinaffcomm'      => $sinaffcomm,
              'taxinfo'         => $taxinfo,
              'subtotal'        => $subtotal,
              'subtotalrec'     => $subtotalrec,
              'url'             => $url,
                 'vendorname'          => "vendor name test",
                 'vendorprice'          => "vendor price test",
              'addemtext'       => $product['addemtext']);

And where I'm calling it...around line 513 in ordersummaryxhtml:

// +--
                              // | Print the item name.
                              // +--

                              if ($shownums) {$name = $item['itemnum'] . ' - ' . $item['itemname'];}
                              else           {$name = $item['itemname'];}

                              $name = $this->xhtml_encode($name);
                              $quan = $this->xhtml_encode($item['itemquan']);

                              print '<p class="strong">' . $name . '</p>' . $eol;
                              print 'Vendor Name:' . $item['vendorname'];
                              print 'Vendor Price:' . $item['vendorprice'];

The result is sadly nothing.

Last edited by JDLS88 (08-18-2011 10:29:36)


Jeremy D.

Offline

 

#6 08-23-2011 10:39:38

JDLS88
Member
From: Maryland, USA
Registered: 07-06-2011
Posts: 102
Website

Re: Include custom fields from prod database in order mail

Any ideas, advice, etc?

Thanks.


Jeremy D.

Offline

 

#7 09-02-2011 12:17:17

JDLS88
Member
From: Maryland, USA
Registered: 07-06-2011
Posts: 102
Website

Re: Include custom fields from prod database in order mail

Can anyone give any help on this?


Jeremy D.

Offline

 

#8 09-02-2011 12:23:53

JayCR48
Member
From: Ohio
Registered: 03-27-2008
Posts: 87
Website

Re: Include custom fields from prod database in order mail

You've definately been chatting with the correct guy about this.  Jon is probably pretty busy, but if he was sitting there next to you see exactly what you were trying to do I'd bet he'd have the answer right off the top of his head.


We distribute high quality steel auto body panels for use in the rust repair industry.

Offline

 

#9 09-02-2011 12:46:40

JDLS88
Member
From: Maryland, USA
Registered: 07-06-2011
Posts: 102
Website

Re: Include custom fields from prod database in order mail

Oh I'm sure. He's been very helpful in various topics (both ones posted by me or by others) throughout me learning how to use the CCP system.


Jeremy D.

Offline

 

#10 09-02-2011 13:55:41

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

Re: Include custom fields from prod database in order mail

Can you post an example of the array your seeing with the new fields or email me a copy it you don't want to post it here?

John

Offline

 

#11 09-02-2011 14:19:17

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

Re: Include custom fields from prod database in order mail

In looking at a array off my site try printing the inforamtion (from the same place you said you where trying form) like:

Code:

                              print 'Vendor Name:' . $item['cartdata']['vendorname'];
                              print 'Vendor Price:' . $item['cartdata']['vendorprice'];

John

Offline

 

#12 09-06-2011 09:41:01

JDLS88
Member
From: Maryland, USA
Registered: 07-06-2011
Posts: 102
Website

Re: Include custom fields from prod database in order mail

John you are amazing. It's working perfectly. Thank you!


Jeremy D.

Offline

 

Board footer