Zen Cart How to Add Product Descriptions to the Invoice, Orders, and Emails

If you have very short zen cart product descriptions you might want to add them to your invoices, admin orders screen and emails to give more information about the products that were ordered. This Zen Cart Easy Help Tutorial will show you how to add custom php code to your files to add product descriptions to invoices, orders, and emails.

In your favorite plain text editor open the includes/classes/order.php file. This is a zen cart core file so be sure to back it up before you make any changes and make a note that this file has been changed so that your changes will not be lost in a future upgrade.

Find this 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 it to this:


     $sql_data_array = array('orders_id' => $zf_insert_id, 
                              'products_id' => zen_get_prid($this->products[$i]['id']), >> Thank you
>> Victoria
>
>
> Links:
> ------
> [1] tel:2014-09-2200
                              '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, run this in your Admin – Tools – Install SQL Patches to add the additional field to 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 invoices and packing-slips.

To include the product description on your order-confirmation emails, open the includes/classes/order.php file.

Find this code:


  $this->products_ordered_attributes = '';  

Change it to:


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

If you need help with your zen cart web siteplease contact us for a quote.

Picaflor Azul specializes in responsive zen cart design. Contact us to convert your current zen cart to a responsive design, or to have a fantastic new custom design made just for your business.

zen cart plus picaflor azul equals success

Leave a Reply