Post by dim565 » Wed Apr 20, 2011 10:59 am

Hello. I need to add a letter sent to the client about ordering a description of the goods.

I think you need to add <br/><? php echo $ product ['description'];?> after

Code: Select all

<?php echo $product['name']; ?>
in order_confirm.tpl

earlier in the other controllers I added it

Code: Select all

'description'     => $result['description'],
here

Code: Select all

$this->data['products'][] = array(
'name'     => $result['name'],
'description'     => $result['description'],
'model'    => $result['model'],.....
but in order.php no strings with $result

Help Please - how to add a description of the goods in the letter?

New member

Posts

Joined
Fri Feb 18, 2011 12:48 pm

Post by dim565 » Wed Apr 20, 2011 6:39 pm

Does anyone answer?

New member

Posts

Joined
Fri Feb 18, 2011 12:48 pm

Post by fido-x » Wed Apr 20, 2011 7:12 pm

Sounds like you've already got the code in the order_confirm.tpl file. You also need to edit "catalog/model/checkout/order.php". The query that gets the product information looks to the "order_product" table for it's information. This table does not include the product description, only the name. You will need to "join" the product description table in the query.

Find the "order_product_query" (at line 125):

Code: Select all

$order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'"); 
and replace with:

Code: Select all

$order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product op LEFT JOIN " . DB_PREFIX . "product_description pd ON (op.product_id = pd.product_id) WHERE op.order_id = '" . (int)$order_id . "' AND pd.language_id = '" . (int)$order_query->row['language_id'] . "'"); 
Then, further down in the same file (at around line 280), you'll find the products array. In this array, after:

Code: Select all

'name'     => $product['name'], 
insert:

Code: Select all

'description' => html_entity_decode($product['description']), 

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by dim565 » Wed Apr 20, 2011 7:40 pm

fido-x, You are the best! Thank you for helping again! Everything works! :)

New member

Posts

Joined
Fri Feb 18, 2011 12:48 pm

Post by fido-x » Wed Apr 20, 2011 7:53 pm

No worries.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by dim565 » Thu Apr 21, 2011 12:05 am

Please forgive me for troubling you again, but I can not add a description of the goods in the "Orders" instead of "Model"
1.png

1.png (19.92 KiB) Viewed 2236 times

I added a admin/view/template/fat/order_form.tpl this

Code: Select all

<td class="right"><?php echo $product['description']; ?></td>
instead of

Code: Select all

<td class="right"><?php echo $product['model']; ?></td>
in /admin/controller/sale/order.php I added this:

Code: Select all

'description' => html_entity_decode($product['description']), 
here:

Code: Select all

$this->data['products'][] = array(
					'order_product_id'  => $product['order_product_id'],
					'product_id'     	=> $product['product_id'],
					'name'    	 		=> $product['name'],
					'model'    			=> $product['model'],
I have long sought to enter a new sql query
Tried to add

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product op LEFT JOIN " . DB_PREFIX . "product_description pd ON (op.product_id = pd.product_id) WHERE op.order_id = '" . (int)$order_id . "' AND pd.language_id = '" . (int)$order_query->row['language_id'] . "'");  
instead of

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
in /admin/model/sale/order.php (public function getOrderProducts($order_id) {)
but now
Notice: Undefined variable: order_query in .../admin/model/sale/order.php on line 297Notice: Trying to get property of non-object in .../admin/model/sale/order.php on line 297
What am I doing wrong?

New member

Posts

Joined
Fri Feb 18, 2011 12:48 pm

Post by fido-x » Thu Apr 21, 2011 10:26 am

OK, first up I'll cover what you've missed (or haven't mentioned).

Insert the following into the language file (admin/language/english/sale/order.php):

Code: Select all

$_['column_description']    = 'Description'; 
Then, insert the following into "admin/controller/sale/order.php", at around line 370:

Code: Select all

$this->data['column_description'] = $this->language->get('column_description'); 
That will give you a column heading of "Description".

Now, on to the database query. Change the "getOrderProducts($order_id)" query (at line 347) to:

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product op LEFT JOIN " . DB_PREFIX . "product_description pd ON (op.product_id = pd.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND op.order_id = '" . (int)$order_id . "'"); 

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by dim565 » Thu Apr 21, 2011 10:59 am

Thank you very much!

New member

Posts

Joined
Fri Feb 18, 2011 12:48 pm

Post by dim565 » Sat Apr 23, 2011 11:22 pm

Not convenient to ask again, but please if you have, Fido-x will be time, help write SQL = request to render a description of the goods for a report on the purchased goods (report/purchased)

My problem is that in /admin/model/report/purchased.php SQL-query is:

Code: Select all

$query = $this->db->query("SELECT op.name, op.model, SUM(op.quantity) AS quantity, SUM(op.total + op.total * op.tax / 100) AS total FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_product op ON (op.order_id = o.order_id) WHERE o.order_status_id > '0' GROUP BY op.name, op.model ORDER BY total DESC LIMIT " . (int)$start . "," . (int)$limit);
ie, already connected by 2 tables turn left. But how to add table product_description and connect the correct with other tables?

Attachments

Безымянный.png

Безымянный.png (16.47 KiB) Viewed 2219 times


New member

Posts

Joined
Fri Feb 18, 2011 12:48 pm

Post by dim565 » Sun Apr 24, 2011 12:19 pm

I found the correct code. Like I learned to write the required SQL-query:)

Code: Select all

$query = $this->db->query("SELECT op.name, pd.description, SUM(op.quantity) AS quantity, SUM(op.total + op.total * op.tax / 100) AS total FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_product op ON (op.order_id = o.order_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (op.product_id = pd.product_id) WHERE o.order_status_id > '0' GROUP BY op.name ORDER BY total DESC LIMIT " . (int)$start . "," . (int)$limit);

New member

Posts

Joined
Fri Feb 18, 2011 12:48 pm

Post by febelam » Mon Apr 30, 2012 3:18 pm

i am using opencart 1.5.2.1, how can i add product description under the product name in the order confirmation email?
What code i have to add? What file i need to edit?
please help~~~

Newbie

Posts

Joined
Thu Apr 26, 2012 6:42 pm

Post by Digitalmind » Wed Jun 06, 2018 10:36 pm

Hi Guys

When receiving quotes via the website, the following links appears in the “item return notice” Undefined offset: 1 in /home/*****/public_html/catalog/view/theme/default/template/mail/order.tpl on line 125
Not too sure why this happens but I just wanted to find out if we are missing instrustions given by the customers or if they’re seleting an item which is not recognised on the system.

and the line code is

Code: Select all

        <p><b>Items return: </b><?php echo $test_custom_field_value[1]; ?></p>

Newbie

Posts

Joined
Mon Jun 26, 2017 7:14 pm

Who is online

Users browsing this forum: No registered users and 206 guests