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:
Code:
$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:
Code:
$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:
Code:
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:
Code:
$this->products_ordered_attributes = '';
CHANGE TO:
Code:
$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:
Code:
($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
CHANGE TO:
Code:
($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
Code:
$orders_products = $db->Execute("select orders_products_id, products_id, products_name, products_model,ect;ect;.
THEN on line 153 add under the line
Code:
'model' => $orders_products->fields['products_model'],
ADD THIS LINE:
Code:
'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
Code:
define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');
ADD:
Code:
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:
Code:
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>
NOW to make everything line up correctly delete the MODEL line of code, ie;
Code:
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
NOW on about line 171 and 172 find:
Code:
echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
AND CHANGE IT TO:
Code:
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:
Code:
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
ADD above that line of code the following:
Code:
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>
THEN delete the MODEL line of code.
THEN FIND on about line 464:
Code:
echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
AND CHANGE TO:
Code:
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:
Code:
define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');
ADD ABOVE IT this line of code:
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:
Code:
define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');
ADD the following line of code above it:
Code:
define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');
Close the page.
NOW OPEN ADMIN/PACKINGSLIP.PHP
FIND on about line 145:
Code:
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
ADD the following line of code above it:
Code:
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>
THEN delete the MODEL line of code.
NEXT FIND on about line 160:
Code:
echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
AND CHANGE TO:
Code:
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

JLowe
Bookmarks