Post by MikoElSuperbeasto » Fri May 08, 2009 9:58 pm

Hi,

New to Opencart, after trying many shopping cart, my choice is now done. For now, i want to display the manufacturers list (name, img and url) in the home.tpl.

I removed the right and left column when your on the homepage of my OpenCart commerce.. to only show the home.tpl content, but i need to display the manufacturers list (When your on other page, right and left column are on).

1- Is there a way to simply get or include the $manufacturers array in the home.tpl like layout.tpl ? This way, i will be able to extract what i need (name, url, img). This seems to me the best solution and easier... but i don't know how to ???

2- Others solution :-\ ?

Thanks for helping me :D
Miko El Superbeasto


Posts

Joined
Fri May 08, 2009 9:42 pm

Post by MikoElSuperbeasto » Fri May 08, 2009 11:36 pm

Finally, i found the solution and all work great..so easy :

I wrote down this code in the controller/common/home.php :

Code: Select all

$this->load->language('module/manufacturer');	
		$this->load->model('catalog/manufacturer');
		 
		$this->data['manufacturers'] = array();
			$results = $this->model_catalog_manufacturer->getManufacturers();
		
		foreach ($results as $result) {
			$this->data['manufacturers'][] = array(
				'manufacturer_id' => $result['manufacturer_id'],
				'name'            => $result['name'],
				'href'            => $this->url->http('product/manufacturer&manufacturer_id=' . $result['manufacturer_id'])
			);
		}
And i can now list all my manufacturers in home.tpl, may be it can help someone else.


Posts

Joined
Fri May 08, 2009 9:42 pm

Post by fleachy » Sun Nov 22, 2009 3:35 pm

Just a quick add and a question:

1) shouldn't be a ';' after the last '}' tag? :D

Question:

2) Shouldn't you change catalog/view/theme/default/template/common/home.tpl as well? :-\

Can you please explain all the changes you've made in order to accomplish manufacturers array listing in home page? O0

Kind regards!

Newbie

Posts

Joined
Thu Oct 22, 2009 11:36 pm

Post by Xsecrets » Mon Nov 23, 2009 1:48 am

I am not the original poster, but I can answer that no you do not need a ; after the last } you don't do that in php.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by fleachy » Tue Dec 01, 2009 6:33 am

Hi Xsecrets, you are right! my mistake, I usually panic after a line without ';' at the end!

Anyway do you know how can I add a link to the head bar to list all the manufacturers or brands?
Trying to find a KISS solution, but I have to admit I'm still new to OC.

Kind regards!

Newbie

Posts

Joined
Thu Oct 22, 2009 11:36 pm
Who is online

Users browsing this forum: No registered users and 4 guests