Zen Cart Logo
Forums / Managing Customers and Orders / Add Product Description to Invoice/orders/emails ect;

Add Product Description to Invoice/orders/emails ect;

Views: 17,715

Results 1 to 20 of 41
3 Aug 2006, 2:10 AM
#1
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Add Product Description to Invoice/orders/emails ect;

I am a stamp dealer and am looking for the code changes needed to add the Products text description to invoices and orders and packing slips ect;. PRODUCTS_DESCRIPTION/PRODUCTS_DESCRIPTION_TEXT is the database table needed. Presently the Zencart only shows the NAME and MODEL and so forth. Would like to add DESCRIPTION after the NAME column on these. Text descriptions show pertinant information on condition of stamps flaws, types, ect;.:unsure:
Here is example:
Present::down:
NAME MODEL PRICE
Scott#34 - .50

Would like this::yes:
NAME DESCRIPTION MODEL PRICE
Scott#34 F/VF MINT - .50

Any help with getting the proper PHP pages to change this and the code to put into them would GREATLY be appreciated. Believe this may help many other merchants in the future as well.:smartass: This ZENCART is a masterpiece!
BEST!
John
http://golowesstamps.com
Cart not live....YET! Will be soon linked to "SALES" links.

3 Aug 2006, 4:21 AM
#2
wolfsz avatar

wolfsz

Zen Follower

Join Date:
Mar 2006
Location:
Australia
Posts:
286
Plugin Contributions:
3

Re: Add Product Description to Invoice/orders/emails ect;

Hi there
Have a look at invoice.php and orders.php

4 Aug 2006, 3:21 AM
#3
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

These are in the admin folder correct? Have looked but still do not understand what to do. I know I need to add a couple of lines of code to them but am not sure what/how. Advise greatly appreciated.:lookaroun

5 Aug 2006, 2:27 AM
#4
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

Went into the Admin section. Found 2 invoice.php files. One is
ADMIN/INVOICE.PHP
The other I found in
ADMIN/INCLUDES/LANGUAGES/ENGLISH/INVOICE.PHP
I added the following line in the "define" section of the ENGLISH file:

define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');

Then added the following line to the td class list in the ADMIN file before the "Model" class:

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>

This put "description" perfectly in the title row on the invoices.

I then researched into accessing the text data needed and to my dismay I see there is no PRODUCTS_DESCRIPTION table under the ORDERS_PRODUCTS section in the MySQL Database...thus I cannot call the description. It appears to be more complex than I thought to do this modification. The processes used when a customer orders a product need to be changed so that the database places the "TEXT" description into another table in the ORDERS_PRODUCTS CATEGORY of the MySQL database and then we can call it to be shown on invoices/orders/ect;

Any advise and/or help with this would be greatly appreciated.
Best regards.
John(golowenow):blink:

5 Aug 2006, 6:12 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Add Product Description to Invoice/orders/emails ect;

There are a few ways to do this.

First a comment: For shopowners who use the products-description field to show detailed, colorful, lengthy details about their products, this would be a bad idea. You don't want a 1/2 screen of information coming up under each product ... you'd annoy more customers than you'd please.
However, in the case of your stamp store, you likely only need a small amount of information and likely rely more on images than text. Thus, perhaps the products-description content could be sufficient.

Possible approaches:

  1. Use READONLY attributes to describe the components. This is ideal if there are common things that can be attributed to these products. It's not ideal for one-off details.

  2. Add a custom field to the product which is editable in the admin area when entering/editing products, and is optionally displayed in the shop. It would be primarily used for displaying order details on invoice/packing-slip etc.
    You would have to modify the order class to populate the orders_products.details field from the products_description.details field when the order is placed. The order class also sends the order-confirmation email, so would have to accomodate this as well. The invoice/packing-slip would need to pull the info for display too.

  3. Build information into the products_name. However, this is by default limited to 100 characters. This may not produce the desired visual. You could override the long name using per-product-metatags settings and set an override title for the product for more pleasant title display in browser and search engines.

  4. You could extend the orders_products.products_name field to much longer and then tell the order class to append the description to the name, up to a maximum of XX characters total. You'd need to do some special coding to handle the insertion of a suitable line-break character (emails vs browser issues) or other separator notation, and pull the description from the database (ie: zen_get products_description($products_id), etc).

I think #4 is likely the least overall work but may produce some odd results in reports, etc.

5 Aug 2006, 11:57 PM
#6
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

Thank you DrByte for this information! The 4th option is the key. I am pretty confused as to how to do this though. There are several order classes so do not know which to edit. Am not to concerned with reports ect; because the descriptions will not be very long at all. most would be like

Scott #1113-34 VF MNH(1115 has a small crease)

Temember I only want to pull
PRODUCT_DESCRIPTION/PRODUCT_DESCRIPTION (TEXT)
No images ect;

I looked into the data base and the ORDER_PRODUCTS/PRODUCTS_NAME field is set at VARCHAR 64.
Would I change it to say 150?

I am not very good with PHP code. Most I copy and paste into apropriate areas. Could you please leave some examples I can insert and play aroud with? The breaking point issue really has me stumped. Also PRODUCT_DESCRIPTION($PRODUCT_ID).

Really appreciate your time in this DrByte. I rhink this thread will help others with similar issues like mine. I sell stamps individually, not in bulk and my site is designed to be the most honest and descriptive on the web. Most I sell have no faults thus a DESCRIPTION noted on invoices, ect; looks like this:

NAME:!970 Cayman Island 1113-34 FULL SET DESCRIPTION: Scott #1113-34 VF MNH

BUT some require additional Descriptive content that needs to be printed out on invoices ect; to guarantee the invoice is accurate to protect me when someone purchases a single or set WITH a fault.

I presently have PayPal shopping cart buttons that I put this into. It requires I type these descriptions twice(one for the page and one for the button) Zencart among MANY other things will solve that problem if I can get this one issue resolved.

Once again, thank you for your responses to my issue.:wink2:

6 Aug 2006, 5:41 PM
#7
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

OK, I am starting to get a grasp on this issue. I changed the Headings for "MODEL" to "DESCRIPTION" which positions everything perfectly. Before the "TAX" amount ect; were positioning under the headings in the wrong areas ie; tax was under model, price was under tax ect;.
In my case I do not use "MODEL" numbers so this field is not needed on invoices ect;.

I have created a new field in the ORDERS_PRODUCTS table called PRODUCTS_DESCRIPTION.

What I need to know is WHERE/HOW when one places an order and/or adds to the cart a product.....WHAT file copies the said products information from the PRODUCTS table to the ORDERS_PRODUCTS table.Also need to know the line numbers in that file that do this. I use HTML kit to edit pages.

I need to know the exact code to include transferring ONLY the PRODUCTS_DESCRIPTION("table")PRODUCTS_DESCRIPTION("field" text only) to ORDERS_PRODUCTS/(the new field)PRODUCTS_DESCRIPTION.

Then I can change in invoice.php ect; instead of calling the "MODEL" field....call the "DESCRIPTION" field instead.

Hopefully this description is more understandable of what I am trying to do. REALLY appreciate the help on this. Once I have this modification I can go live with Zencart at any time.

P.S. Please do not take any offense to Capitalization and colors as I am only trying to make things clear, hehe I am NOT yelling.:cool:

8 Aug 2006, 2:27 AM
#8
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

Tinkered with the order.php class page in the INCLUDES folder again and actually got the thing to change the row in the database but still no text being populated into the products_description field in orders_products table. I am so close I can taste it! Gave up again tonight though. I don't have a lot of time to do this as I work and drive about 13 hours a day. Hopefully tommorrow night there will be a response to this.:shocking: Thank you in advance for any help to my little dilema:blush:

10 Aug 2006, 2:56 AM
#9
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

OK I am totally confused. This seems to really be a simple process but I cannot figure out where the ORDER_PRODUCTS TABLE is being populated from...:down: Like stated above I created a new FIELD called PRODUCTS_DESCRIPTION in the ORDER_PRODUCTS TABLE. We need to populate it at the same time that the PRODUCT_ID, PRODUCT_MODEL, ect; ect; is being populated into the ORDER_PRODUCTS TABLE during either when the customer ADDS a product or in the CHECK-OUT phase. I do not know when nor where this population is being activated. Once this new field is populated from PRODUCTS_DESCRIPTION/PRODUCTS_DESCRIPTION<-----this is the TEXT ONLY fieldno images,ect;....we can call this new field into INVOICES/PACKING SLIPS/EMAILS very easily!

PLEASE PLEASE can anyone define where the code is that does this transfer of fields and present some lines of code to add to the new field? Judging by the number of views on this topic there are a lot of Zenners out there looking for answers on this. Thank you for any help on this:wacko:

10 Aug 2006, 4:34 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Add Product Description to Invoice/orders/emails ect;

Perhaps you may consider a friendly donation to the Zen Cart project for taking the time to come up with the answer for you:

includes/classes/order.php
line 692 has:php $sql_data_array = array('orders_id' => $zf_insert_id, 'products_id' => zen_get_prid($this->products[$i]['id']), 'products_model' => $this->products[$i]['model'], 'products_name' => $this->products[$i]['name'], 'products_price' => $this->products[$i]['price'], 'final_price' => $this->products[$i]['final_price'], 'onetime_charges' => $this->products[$i]['onetime_charges'], 'products_tax' => $this->products[$i]['tax'], 'products_quantity' => $this->products[$i]['qty'], 'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'], 'product_is_free' => $this->products[$i]['product_is_free'], 'products_discount_type' => $this->products[$i]['products_discount_type'], 'products_discount_type_from' => $this->products[$i]['products_discount_type_from'], 'products_prid' => $this->products[$i]['id']); zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); change that to:```php
$sql_data_array = array('orders_id' => $zf_insert_id,
'products_id' => zen_get_prid($this->products[$i]['id']),
'products_model' => $this->products[$i]['model'],
'products_name' => $this->products[$i]['name'],
'products_description' => zen_get_products_description($this->products[$i]['id']),
'products_price' => $this->products[$i]['price'],
'final_price' => $this->products[$i]['final_price'],
'onetime_charges' => $this->products[$i]['onetime_charges'],
'products_tax' => $this->products[$i]['tax'],
'products_quantity' => $this->products[$i]['qty'],
'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
'product_is_free' => $this->products[$i]['product_is_free'],
'products_discount_type' => $this->products[$i]['products_discount_type'],
'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
'products_prid' => $this->products[$i]['id']);
zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);


And add an additional field in your orders_products table:```
alter table orders_products add column products_description text NOT NULL;

Now you can use the contents of that field in your invoice/packing-slip in the Admin.

To include the info on your order-confirmation emails:
includes/classes/order.php
around line 718 you have:php $this->products_ordered_attributes = ''; change to:```php
$this->products_ordered_attributes .= "\n\t" . zen_get_products_description($this->products[$i]['id']);

12 Aug 2006, 12:54 AM
#11
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

THE CODE WORKS PERFECTLY!!!!:thumbsup: A donation was posted today. All I could give ATM. THANK YOU DrBYTE!! Made my day! Hopefully this will help other Zenners in the future.:smile:

11 Jul 2007, 4:06 AM
#12
marknew avatar

marknew

Zen Follower

Join Date:
Oct 2005
Posts:
274
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

Hi,
I want to do something similar but with the product order images in the order email. Does anyone know what additional field in the order_products table i would use
To add the description i use this -

alter table orders_products add column products_description text NOT NULL;

so to add the image must be something similar.

Help anyone?
Thanks,
M

11 Jul 2007, 5:12 AM
#13
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

Hello Marknew,
I was going to post what I did to add descriptions to emails ect; Perhaps this will help you find what you need to make it work for you. I made this mod up on the fly and by following it it should work as of this zencart version 1.3.7.

Zencart answer to adding description field

How to add a description to email invoices, invoices and packing slips.

First look at:
includes/classes/order.php
line 715(line numbers may change in future versions) has:

$sql_data_array = array('orders_id' => $zf_insert_id, 
                              'products_id' => zen_get_prid($this->products[$i]['id']), 
                              'products_model' => $this->products[$i]['model'], 
                              'products_name' => $this->products[$i]['name'], 
                              'products_price' => $this->products[$i]['price'], 
                              'final_price' => $this->products[$i]['final_price'], 
                              'onetime_charges' => $this->products[$i]['onetime_charges'], 
                              'products_tax' => $this->products[$i]['tax'], 
                              'products_quantity' => $this->products[$i]['qty'], 
                              'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'], 
                              'product_is_free' => $this->products[$i]['product_is_free'], 
                              'products_discount_type' => $this->products[$i]['products_discount_type'], 
                              'products_discount_type_from' => $this->products[$i]['products_discount_type_from'], 
                              'products_prid' => $this->products[$i]['id']); 
      zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);  

CHANGE THAT TO:

$sql_data_array = array('orders_id' => $zf_insert_id, 
                              'products_id' => zen_get_prid($this->products[$i]['id']), 
                              'products_model' => $this->products[$i]['model'], 
                              'products_name' => $this->products[$i]['name'], 
                              'products_description' => zen_get_products_description($this->products[$i]['id']), 
                              'products_price' => $this->products[$i]['price'], 
                              'final_price' => $this->products[$i]['final_price'], 
                              'onetime_charges' => $this->products[$i]['onetime_charges'], 
                              'products_tax' => $this->products[$i]['tax'], 
                              'products_quantity' => $this->products[$i]['qty'], 
                              'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'], 
                              'product_is_free' => $this->products[$i]['product_is_free'], 
                              'products_discount_type' => $this->products[$i]['products_discount_type'], 
                              'products_discount_type_from' => $this->products[$i]['products_discount_type_from'], 
                              'products_prid' => $this->products[$i]['id']); 
      zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);  

NOW GO TO THE MySQL database and add an additional field in your orders_products table:

alter table orders_products add column products_description text NOT NULL;

Now you can use the contents of that field in your invoice/packing-slip in the Admin.

To include the info on your order-confirmation emails:
includes/classes/order.php
around line 740 (line number may change in future versions) you have:

$this->products_ordered_attributes = ''; 

CHANGE TO:

$this->products_ordered_attributes = "\n\t" . zen_get_products_description($this->products[$i]['id']);

go to about line 842 (line numbers may change in future versions) and change the following:

($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' . 

CHANGE TO:

($this->products[$i]['description'] != '' ? ' (' . $this->products[$i]['description'] . ') ' : '') . ' = ' .

GOTO line 849 and do the same change from "model" to "description".

The above code changes are the basics for adding a description.

NOW the key to adding the description to invoices and packing slips ect; is:

OPEN:
admin\includes\classes\order.php

On line 121 add "products_description," without the quotes to the line

$orders_products = $db->Execute("select orders_products_id, products_id, products_name, products_model,ect;ect;.

THEN on line 153 add under the line

'model' => $orders_products->fields['products_model'],

ADD THIS LINE:

'description' => $orders_products->fields['products_description'],

This connects the description to all invoices, packing slips ect; REMEMBER ALL ARE CASE SENSITIVE.

Now to add the TITLE to the invoice page and position it correctly do the following:

OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/INVOICE.PHP

ADD THIS LINE OF CODE to the "define" section right under

define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');

ADD:```
define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');

Close that page.
NOW OPEN ADMIN/INVOICE.PHP

ADD the following line of code above the TABLE_HEADING_MODEL line at about line 148

ADD: ```
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>

NOW to make everything line up correctly delete the MODEL line of code, ie;

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>

NOW on about line 171 and 172 find:

echo '        </td>' . "\n" .
           '        <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";

AND CHANGE IT TO:

echo '        </td>' . "\n" .
           '        <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n";

THAT will insert the descriptions on invoices.
Now close the page. INVOICES are now set up.

NEXT OPEN ADMIN/ORDERS.PHP

FIND on line about 442:

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>

ADD above that line of code the following:

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>

THEN delete the MODEL line of code.

THEN FIND on about line 464:

echo '            </td>' . "\n" .
           '            <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .

AND CHANGE TO:

echo '            </td>' . "\n" .
           '            <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n" .

OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/ORDERS.PHP

on about line 40 FIND:```
define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');


ADD ABOVE IT this line of code:

define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');

Close both pages. The description has now been added to the orders section of the cart.

OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/PACKINGSLIP.PHP

On about line 24 FIND:```
define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');

ADD the following line of code above it:```
define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');


Close the page.

NOW OPEN ADMIN/PACKINGSLIP.PHP

FIND on about line 145:```
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>

ADD the following line of code above it:

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>

THEN delete the MODEL line of code.

NEXT FIND on about line 160:```
echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .

AND CHANGE TO:```
echo '        </td>' . "\n" .
           '        <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n" .

Close the page. Now all packing slips show the description.

END

Please be aware I am NOT guaranteeing this to work for everyone.
Hope it helps:clap:
JLowe

11 Jul 2007, 6:26 AM
#14
marknew avatar

marknew

Zen Follower

Join Date:
Oct 2005
Posts:
274
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

Hey, thanks for the quick reply. i can see the
products_description text NOT NULL;

is what i would be changing. Any idea what the images field would be called?
Thanks
M.

12 Jul 2007, 12:40 AM
#15
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

That would have to probably be answered by Dr. Byte. He helped me with this mod and probably has the answer. Believe you would probably need to change the products_description from text to another format which would add the text WITH the image. The fear is that if a customer orders a large number of items it can make the order confirmation email quite large. I am sure it is doable though. Good luck M! :smartalec:

12 Jul 2007, 1:12 AM
#16
marknew avatar

marknew

Zen Follower

Join Date:
Oct 2005
Posts:
274
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

Thanks golowenow, you've got got me close to working it out.
Dr. Byte are you there?
M

12 Jul 2007, 1:33 AM
#17
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

Mark,
I would post a new thread and reference this thread as this one is fairly old now and Dr. Byte may not see your posts here as many new issues are posted daily. Please allow him time to answer your question. He is a busy man...hehe.
Good luck!:smartalec:

17 Mar 2010, 3:30 PM
#18
qfreddie avatar

qfreddie

New Zenner

Join Date:
Jan 2009
Posts:
14
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

golowenow:

Hello Marknew,
I was going to post what I did to add descriptions to emails ect; Perhaps this will help you find what you need to make it work for you. I made this mod up on the fly and by following it it should work as of this zencart version 1.3.7.

Zencart answer to adding description field

How to add a description to email invoices, invoices and packing slips.

First look at:
includes/classes/order.php
line 715(line numbers may change in future versions) has:

$sql_data_array = array('orders_id' => $zf_insert_id,
'products_id' => zen_get_prid($this->products[$i]['id']),
'products_model' => $this->products[$i]['model'],
'products_name' => $this->products[$i]['name'],
'products_price' => $this->products[$i]['price'],
'final_price' => $this->products[$i]['final_price'],
'onetime_charges' => $this->products[$i]['onetime_charges'],
'products_tax' => $this->products[$i]['tax'],
'products_quantity' => $this->products[$i]['qty'],
'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
'product_is_free' => $this->products[$i]['product_is_free'],
'products_discount_type' => $this->products[$i]['products_discount_type'],
'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
'products_prid' => $this->products[$i]['id']);
zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

> 
> CHANGE THAT TO:
> ```
$sql_data_array = array('orders_id' => $zf_insert_id, 
                              'products_id' => zen_get_prid($this->products[$i]['id']), 
                              'products_model' => $this->products[$i]['model'], 
                              'products_name' => $this->products[$i]['name'], 
                              'products_description' => zen_get_products_description($this->products[$i]['id']), 
                              'products_price' => $this->products[$i]['price'], 
                              'final_price' => $this->products[$i]['final_price'], 
                              'onetime_charges' => $this->products[$i]['onetime_charges'], 
                              'products_tax' => $this->products[$i]['tax'], 
                              'products_quantity' => $this->products[$i]['qty'], 
                              'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'], 
                              'product_is_free' => $this->products[$i]['product_is_free'], 
                              'products_discount_type' => $this->products[$i]['products_discount_type'], 
                              'products_discount_type_from' => $this->products[$i]['products_discount_type_from'], 
                              'products_prid' => $this->products[$i]['id']); 
      zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);  

NOW GO TO THE MySQL database and add an additional field in your orders_products table:

alter table orders_products add column products_description text NOT NULL;

> Now you can use the contents of that field in your invoice/packing-slip in the Admin.
> 
> To include the info on your order-confirmation emails:
> includes/classes/order.php
> around line 740 (line number may change in future versions) you have:
> ```
$this->products_ordered_attributes = ''; 

CHANGE TO:

$this->products_ordered_attributes = "\n\t" . zen_get_products_description($this->products[$i]['id']);

> go to about line 842 (line numbers may change in future versions) and change the following:
> ```
($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' . 

CHANGE TO:

($this->products[$i]['description'] != '' ? ' (' . $this->products[$i]['description'] . ') ' : '') . ' = ' .

> GOTO line 849 and do the same change from "model" to "description". 
> 
> The above code changes are the basics for adding a description.
> 
> NOW the key to adding the description to invoices and packing slips ect; is:
> 
> OPEN:
> admin\includes\classes\order.php
> 
> On line 121 add "products_description," without the quotes to the line
> ```
$orders_products = $db->Execute("select orders_products_id, products_id, products_name, products_model,ect;ect;.

THEN on line 153 add under the line

'model' => $orders_products->fields['products_model'],

> ADD THIS LINE:
> ```
'description' => $orders_products->fields['products_description'],

This connects the description to all invoices, packing slips ect; REMEMBER ALL ARE CASE SENSITIVE.

Now to add the TITLE to the invoice page and position it correctly do the following:

OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/INVOICE.PHP

ADD THIS LINE OF CODE to the "define" section right under

define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');

> ADD:```
define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');

Close that page.
NOW OPEN ADMIN/INVOICE.PHP

ADD the following line of code above the TABLE_HEADING_MODEL line at about line 148

ADD: ```

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td> ``` > > NOW to make everything line up correctly delete the MODEL line of code, ie; > ``` <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> ``` > NOW on about line 171 and 172 find: > ``` echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n"; ``` > AND CHANGE IT TO: > ``` echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n"; ``` > THAT will insert the descriptions on invoices. > Now close the page. INVOICES are now set up.

This does not work. Description is not displayed unfortunatly. i checked twice.

Basicly i would need to allow more than 64chars to the product name. Anybody?

Thanks.

10 Jun 2010, 12:22 PM
#20
bhadz08 avatar

bhadz08

New Zenner

Join Date:
Jun 2009
Posts:
41
Plugin Contributions:
0

Re: Add Product Description to Invoice/orders/emails ect;

golowenow:

Hello Marknew,
I was going to post what I did to add descriptions to emails ect; Perhaps this will help you find what you need to make it work for you. I made this mod up on the fly and by following it it should work as of this zencart version 1.3.7.

Zencart answer to adding description field

How to add a description to email invoices, invoices and packing slips.

First look at:
includes/classes/order.php
line 715(line numbers may change in future versions) has:

$sql_data_array = array('orders_id' => $zf_insert_id,
'products_id' => zen_get_prid($this->products[$i]['id']),
'products_model' => $this->products[$i]['model'],
'products_name' => $this->products[$i]['name'],
'products_price' => $this->products[$i]['price'],
'final_price' => $this->products[$i]['final_price'],
'onetime_charges' => $this->products[$i]['onetime_charges'],
'products_tax' => $this->products[$i]['tax'],
'products_quantity' => $this->products[$i]['qty'],
'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
'product_is_free' => $this->products[$i]['product_is_free'],
'products_discount_type' => $this->products[$i]['products_discount_type'],
'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
'products_prid' => $this->products[$i]['id']);
zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

> 
> CHANGE THAT TO:
> ```
$sql_data_array = array('orders_id' => $zf_insert_id, 
                              'products_id' => zen_get_prid($this->products[$i]['id']), 
                              'products_model' => $this->products[$i]['model'], 
                              'products_name' => $this->products[$i]['name'], 
                              'products_description' => zen_get_products_description($this->products[$i]['id']), 
                              'products_price' => $this->products[$i]['price'], 
                              'final_price' => $this->products[$i]['final_price'], 
                              'onetime_charges' => $this->products[$i]['onetime_charges'], 
                              'products_tax' => $this->products[$i]['tax'], 
                              'products_quantity' => $this->products[$i]['qty'], 
                              'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'], 
                              'product_is_free' => $this->products[$i]['product_is_free'], 
                              'products_discount_type' => $this->products[$i]['products_discount_type'], 
                              'products_discount_type_from' => $this->products[$i]['products_discount_type_from'], 
                              'products_prid' => $this->products[$i]['id']); 
      zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);  

NOW GO TO THE MySQL database and add an additional field in your orders_products table:

alter table orders_products add column products_description text NOT NULL;

> Now you can use the contents of that field in your invoice/packing-slip in the Admin.
> 
> To include the info on your order-confirmation emails:
> includes/classes/order.php
> around line 740 (line number may change in future versions) you have:
> ```
$this->products_ordered_attributes = ''; 

CHANGE TO:

$this->products_ordered_attributes = "\n\t" . zen_get_products_description($this->products[$i]['id']);

> go to about line 842 (line numbers may change in future versions) and change the following:
> ```
($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' . 

CHANGE TO:

($this->products[$i]['description'] != '' ? ' (' . $this->products[$i]['description'] . ') ' : '') . ' = ' .

> GOTO line 849 and do the same change from "model" to "description". 
> 
> The above code changes are the basics for adding a description.
> 
> NOW the key to adding the description to invoices and packing slips ect; is:
> 
> OPEN:
> admin\includes\classes\order.php
> 
> On line 121 add "products_description," without the quotes to the line
> ```
$orders_products = $db->Execute("select orders_products_id, products_id, products_name, products_model,ect;ect;.

THEN on line 153 add under the line

'model' => $orders_products->fields['products_model'],

> ADD THIS LINE:
> ```
'description' => $orders_products->fields['products_description'],

This connects the description to all invoices, packing slips ect; REMEMBER ALL ARE CASE SENSITIVE.

Now to add the TITLE to the invoice page and position it correctly do the following:

OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/INVOICE.PHP

ADD THIS LINE OF CODE to the "define" section right under

define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');

> ADD:```
define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');

Close that page.
NOW OPEN ADMIN/INVOICE.PHP

ADD the following line of code above the TABLE_HEADING_MODEL line at about line 148

ADD: ```

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td> ``` > > NOW to make everything line up correctly delete the MODEL line of code, ie; > ``` <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> ``` > NOW on about line 171 and 172 find: > ``` echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n"; ``` > AND CHANGE IT TO: > ``` echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n"; ``` > THAT will insert the descriptions on invoices. > Now close the page. INVOICES are now set up. > > NEXT OPEN ADMIN/ORDERS.PHP > > FIND on line about 442: > ``` <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> ``` > ADD above that line of code the following: > ``` <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td> ``` > THEN delete the MODEL line of code. > > THEN FIND on about line 464: > ``` echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . ``` > AND CHANGE TO: > ``` echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n" . ``` > OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/ORDERS.PHP > > on about line 40 FIND:``` define('TABLE_HEADING_PRODUCTS_MODEL', 'Model'); ``` > > ADD ABOVE IT this line of code: > ``` define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description'); ``` > Close both pages. The description has now been added to the orders section of the cart. > > OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/PACKINGSLIP.PHP > > On about line 24 FIND:``` define('TABLE_HEADING_PRODUCTS_MODEL', 'Model'); ``` > ADD the following line of code above it:``` define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description'); ``` > > Close the page. > > NOW OPEN ADMIN/PACKINGSLIP.PHP > > FIND on about line 145:``` <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td> ``` > > ADD the following line of code above it: > ``` <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td> ``` > THEN delete the MODEL line of code. > > NEXT FIND on about line 160:``` echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" . ``` > AND CHANGE TO:``` echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n" . ``` > Close the page. Now all packing slips show the description. > > END > > Please be aware I am NOT guaranteeing this to work for everyone. > Hope it helps:clap: > JLowe

ok.. i figured out adding product description.. tnx.

but i need one detail, a products url. this is added in new products were we can add products url at the bottom thus, i want to add this URL like the description.. how to get the data from the products_description table in column products_url and pass this to table orders_products.

any help is much appreciated..

thnks..