Post by titusel » Thu Aug 19, 2010 2:44 am

Hi! ;)

What is the "secret code" of showing some data from the database in the product page?

i know i have to edit this files:
catalog/view/theme/default/template/product/product.tpl
catalog/controller/product/product.php

i have a new tabel in the opencart database called product_music, and this table contains this rows:

product_music_id
product_id
priority
artist
name
filename

what i want to do is to get the data from priority, artist, name and filename rows and post them in the product page (product.tpl)

thanks!

User avatar
Active Member

Posts

Joined
Sat May 15, 2010 7:29 pm
Location - Bucharest, Romania

Post by Xsecrets » Thu Aug 19, 2010 3:28 am

then you'll have to modify the model file too as that's where the information is retrieved from the database.

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 titusel » Thu Aug 19, 2010 3:41 am

you are right :)

ok, so now i have to edit 3 files

catalog/view/theme/default/template/product/product.tpl
catalog/controller/product/product.php
catalog/model/catalog/product.php

but i need some help with the script :(

User avatar
Active Member

Posts

Joined
Sat May 15, 2010 7:29 pm
Location - Bucharest, Romania

Post by Qphoria » Thu Aug 19, 2010 4:01 am

You can echo any data on the product.tpl using:

Code: Select all

<?php echo $product_info['db_field_name_here']; ?>

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xsecrets » Thu Aug 19, 2010 5:50 am

Qphoria wrote:You can echo any data on the product.tpl using:

Code: Select all

<?php echo $product_info['db_field_name_here']; ?>
yeah, but he mentioned that he created a new table in the db, so he won't be able to do that without first modifying his getproduct function.

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 titusel » Thu Aug 19, 2010 5:05 pm

thanks for the replys guys :D I appreciate it.

i've resolved it.

User avatar
Active Member

Posts

Joined
Sat May 15, 2010 7:29 pm
Location - Bucharest, Romania

Post by Qphoria » Thu Aug 19, 2010 10:36 pm

Xsecrets wrote:
Qphoria wrote:You can echo any data on the product.tpl using:

Code: Select all

<?php echo $product_info['db_field_name_here']; ?>
yeah, but he mentioned that he created a new table in the db, so he won't be able to do that without first modifying his getproduct function.
I can't be "reading" everything! ;D

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by tunnu » Thu Sep 01, 2011 4:22 pm

in what ever table i can add a custom field and echo it with

Code: Select all

<?php echo $product_info['db_field_name_here']; ?>
just the field name is enough or i need to edit product_info with the table name?

New member

Posts

Joined
Sun Jun 05, 2011 11:38 pm

Post by naveen2030 » Mon Aug 31, 2015 3:29 pm

Hi,

what are the change need to do in getproduct function to access the data from the table in opencart ?

Thanks

Newbie

Posts

Joined
Thu Aug 20, 2015 1:26 pm

Post by wahab.apex » Fri Nov 02, 2018 11:27 am

titusel wrote:
Thu Aug 19, 2010 5:05 pm
thanks for the replys guys :D I appreciate it.

i've resolved it.
plz let me know how u solve this can u plz guide me with source code?? thankx

Newbie

Posts

Joined
Tue Apr 10, 2018 2:00 pm
Who is online

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