Post by yourevil17 » Wed Aug 17, 2011 8:35 pm

Does anyone know how to display the manufacturer name of the product in the cart, checkout and order emails? I've added 'manufacturer' => $product_query->row['manufacturer_id'] to system/library/cart.php however only the manufacturer ID number is showing up when I call it in the cart.tpl file. I'm guessing that I need to query the database in the $product_query function of the cart.php file but I'm not sure how to go about it.

Any help would be very much appreciated!

Cheers :)

Newbie

Posts

Joined
Sun Sep 19, 2010 10:42 pm

Post by gtphotography » Fri Oct 09, 2020 9:30 pm

I need the same thing for manufacturer name and stock status on order mail

User avatar
Newbie

Posts

Joined
Fri Oct 09, 2020 7:11 pm


Post by straightlight » Mon Oct 12, 2020 9:41 am

This could be accomplished as an OCMod. However, since you're using an older version of OC, you'd need to edit your catalog/controller/checkout/cart.php file.

Find:

Code: Select all

$this->data['products'] = array();
add above:

Code: Select all

$this->data['text_manufacturer'] = $this->language->get('text_manufacturer');

$this->load->model('catalog/manufacturer');
$this->load->model('catalog/product');
Then, find:

Code: Select all

$this->data['products'][] = array(
add above:

Code: Select all

$product_info = $this->model_catalog_product->getProduct($product['product_id']);
				
$manufacturer_info = array();
				
if ($product_info) {
	$manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($product_info['manufacturer_id']);
}
Then, find:

Code: Select all

'model'     => $product['model'],
Add below:

Code: Select all

'manufacturer' => ($manufacturer_info ? html_entity_decode($manufacturer_info['name'], ENT_QUOTES, 'UTF-8') : ''),
Then, in your catalog/language/<your_language>/checkout/cart.php file,

add at the bottom of the file (above ?>):

Code: Select all

$_['text_manufacturer'] = 'Manufacturer:';
Then, in your catalog/view/theme/<your_theme>/template/checkout/cart.tpl file, you could use in the $product foreach loop these two variables where you want to display:

Code: Select all

<?php echo $text_manufacturer; ?> <?php echo $product['manufacturer']; ?>
This should resolved the issue.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 309 guests