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:
Printable View
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:
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
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:
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_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:$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 you can use the contents of that field in your invoice/packing-slip in the Admin.Code:alter table orders_products add column products_description text NOT NULL;
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:
CHANGE TO:Code:$this->products_ordered_attributes = '';
go to about line 842 (line numbers may change in future versions) and change the following:Code:$this->products_ordered_attributes = "\n\t" . zen_get_products_description($this->products[$i]['id']);
CHANGE TO:Code:($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
GOTO line 849 and do the same change from "model" to "description".Code:($this->products[$i]['description'] != '' ? ' (' . $this->products[$i]['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
THEN on line 153 add under the lineCode:$orders_products = $db->Execute("select orders_products_id, products_id, products_name, products_model,ect;ect;.
ADD THIS LINE:Code:'model' => $orders_products->fields['products_model'],
This connects the description to all invoices, packing slips ect; REMEMBER ALL ARE CASE SENSITIVE.Code:'description' => $orders_products->fields['products_description'],
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
ADD:Code:define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');
Close that page.Code:define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');
NOW OPEN ADMIN/INVOICE.PHP
ADD the following line of code above the TABLE_HEADING_MODEL line at about line 148
ADD:NOW to make everything line up correctly delete the MODEL line of code, ie;Code:<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>
NOW on about line 171 and 172 find:Code:<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
AND CHANGE IT TO:Code:echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
THAT will insert the descriptions on invoices.Code:echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n";
Now close the page. INVOICES are now set up.
NEXT OPEN ADMIN/ORDERS.PHP
FIND on line about 442:
ADD above that line of code the following:Code:<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
THEN delete the MODEL line of code.Code:<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>
THEN FIND on about line 464:
AND CHANGE TO:Code:echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/ORDERS.PHPCode:echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n" .
on about line 40 FIND:ADD ABOVE IT this line of code:Code:define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');
Close both pages. The description has now been added to the orders section of the cart.Code:define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');
OPEN ADMIN/INCLUDES/LANGUAGES/ENGLISH/PACKINGSLIP.PHP
On about line 24 FIND:ADD the following line of code above it:Code:define('TABLE_HEADING_PRODUCTS_MODEL', 'Model');
Close the page.Code:define('TABLE_HEADING_PRODUCTS_DESCRIPTION', 'Description');
NOW OPEN ADMIN/PACKINGSLIP.PHP
FIND on about line 145:ADD the following line of code above it:Code:<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
THEN delete the MODEL line of code.Code:<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_DESCRIPTION; ?></td>
NEXT FIND on about line 160:AND CHANGE TO:Code:echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
Close the page. Now all packing slips show the description.Code:echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['description'] . '</td>' . "\n" .
END
Please be aware I am NOT guaranteeing this to work for everyone.
Hope it helps:clap:
JLowe
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.
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:
Thanks golowenow, you've got got me close to working it out.
Dr. Byte are you there?
M
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:
qfreddie
this link my be helpfull to you.
http://www.zen-cart.com/forum/showth...042#post859042
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..