Post by devincox » Mon Jan 24, 2011 11:44 pm

OC 1.4.8
http://dev.christianworldinc.com/store

I am working on a retail site for digital downloads, I added a new tab to the product page for the lyrics to the songs (site sells background tracks/karaoke). I have added a table that contains the lyrics and want to post the lyrics to this new tab. It never returns any lyrics even if I hard code in the product_id.



code added to:
================================================================================================
catalog/model/product/product.php:

public function getProductLyrics($product_id){
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_lyric WHERE product_id = '" . (int)$product_id . "'");
return $query->rows;
}

catalog/language/english/product.php:
$_['tab_lyrics'] = 'Lyrics';

template/product/product.tpl:
<div id="tab_lyrics" class="tab_page">

<?php foreach ($lyrics as $lyric) { ?>
1 lyric
<?php } ?>


</div>

catalog/controller/product/product.php:
$results = $this->model_catalog_product->getProductLyrics($this->request->get['product_id']);

foreach($results as $result){
if ($result['lyric']) {
$lyrics = $result['lyric'];
} else {
$lyrics = 'no lyrics';
}
}



===================================================================================


Any help is greatly appreciated.

Thank you,
Devin

Newbie

Posts

Joined
Wed Jun 16, 2010 5:32 am

Post by Xsecrets » Tue Jan 25, 2011 2:06 am

well looks like you forgot to add the actual tab header. there is a section in the tpl which is basically a list of links for the tab headers.

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 devincox » Wed Jan 26, 2011 1:07 am

The tab shows up, it's just never populated, even if I hard code the product_id in the query (to guarentee the query gets a result)

I forgot to include the following in my first post. Is this what your referring to Xsecrets?
======================================================================================
template/product/product.tpl:

<div class="tabs">
<a tab="#tab_description"><?php echo $tab_description; ?></a>
<!-- <a tab="#tab_image"><?php echo $tab_image; ?> (<?php echo count($images); ?>)</a>-->
<?php if ($review_status) { ?><a tab="#tab_review"><?php echo $tab_review; ?></a><?php } ?>
<a tab="#tab_related"><?php echo $tab_related; ?> (<?php echo count($products); ?>)</a>
<a tab="#tab_lyrics"><?php echo $tab_lyrics ?></a>
</div>
======================================================================================

Thank you,
Devin

Newbie

Posts

Joined
Wed Jun 16, 2010 5:32 am

Post by devincox » Fri Jan 28, 2011 7:12 am

bump

Newbie

Posts

Joined
Wed Jun 16, 2010 5:32 am
Who is online

Users browsing this forum: Amazon [Bot] and 10 guests