Post by cumquat » Wed Apr 28, 2010 7:54 pm

Hi ya,

Ok I have searched the forum and thought I had come close a few times but to no avail. I need to retrieve data from a table and use it on the product display page. Namely I want to query Q's shipping group module table and if shipping_group_id = 3 then don't display the add to cart button.

My question is how and where do I put this query to be able to use that data on the product page.
Does this make sense, hope someone can help it's probably quite simple I'm just not that great at php yet.

Regards

Mick

Newbie

Posts

Joined
Mon Dec 21, 2009 7:17 pm
Location - London, UK

Post by SteveSherry » Thu Apr 29, 2010 6:07 am

Without having the modules myself I couldn't give you the exact code you need, but you need to edit this file: catalog\view\theme\default\template\product\product.tpl (around line 95)

I also recommend reading this to give you a base for building the code that you'll need.
http://forum.opencart.com/viewtopic.php ... 55&start=0

My Website ¦ Summer Madness Special Offer ¦


Active Member

Posts

Joined
Thu Apr 08, 2010 7:47 am
Location - Wirral, UK

Post by johnnyart » Thu Apr 29, 2010 4:06 pm

I don't have that module installed but to query another table in the database you can use

Code: Select all

$this->db->query("QUERY HERE");
That way you will be able to place any data of the result on to the product page or wherever you want.

Remember that to access a variable like $var on the template files it has to be declared as $this->data['var'] on the controller!!

User avatar
Newbie

Posts

Joined
Tue Mar 02, 2010 5:13 pm

Post by cumquat » Thu Apr 29, 2010 5:13 pm

Thanks for your help guys, I know have it sorted thanks to you.

regards

Mick

Newbie

Posts

Joined
Mon Dec 21, 2009 7:17 pm
Location - London, UK

Post by johnnyart » Thu Apr 29, 2010 5:22 pm

Congratulations :)

User avatar
Newbie

Posts

Joined
Tue Mar 02, 2010 5:13 pm
Who is online

Users browsing this forum: Bing [Bot] and 12 guests