Post by jcgadgets » Fri Feb 11, 2011 8:35 am

Hi,

I'd like to add some additional text on each product page, but do it just above the tabs and need it to be different for every product.

The way I thought may be best would be to use an unused field such as misc location ormeta tag keywords in my product.tpl file, which would pull the text from these fields.

My only problem is that I'm not sure how to do this :S I tried adding:

Code: Select all

<?php echo $carrier; ?>
just before:

Code: Select all

<div class="tabs">
in my product.tpl file, but nothing showed up.

Either I just got the field name wrong, or there is some attribute or something that I need to edit in the database for it to display?

I'm not sure, but would really appreciate it if someone wouldn't mind helping! I think I'd prefer to use the meta tag keywords field if I had the choice.

I'm on OC v 1.4.9.3


Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by amdev » Fri Feb 11, 2011 11:59 am

Hi,
You should be to create some variable for place your data like this:

Code: Select all

catalog/controller/product/product.php


Code: Select all

	$this->data['your_variable] = $product_info['product_field'];
ex: you need to get location of product, code sholde be

Code: Select all

$this->data['location'] = $product_info['location'];
put above code near:

Code: Select all

			$this->data['model'] = $product_info['model'];
then goto product.tpl and show it:

Code: Select all

<?php echo $location; ?> 
or like your code.

if u need more field in ur product: Look this code

Code: Select all

$product_info = $this->model_catalog_product->getProduct($product_id);
it call model/catalog/product.php and use getProduct() function

edit or add your SQL command for fetch ur product field.

Sorry for my bad english... :crazy: :crazy: :crazy:

ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand

Post by jcgadgets » Sat Feb 12, 2011 4:11 am

Hi,

Thank you so much! This is working perfectly for what I asked!

However, I would like to ask one more thing...is it possible to format this text at all? For example, I have put

- product feature
- product feature
- product feature

into the meta tag keywords field (this is the field I decided to use) and would like it to appear this way on the page. However, unfortunately, since the field is by default plain text, it appears on the page like so:

- product feature - product feature - product feature

Any ideas? I'd preferably like to even make them bold, but that is not required.


Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by zerosaptedoi » Thu Mar 17, 2011 9:52 pm

you can style yout text by adding [ style="font-weight: bold" ] in your desired tag from product.tpl
ex: <p style="font-weight: bold"> Carrier: <?php echo $carrier; ?> </p>

Newbie

Posts

Joined
Thu Mar 17, 2011 9:43 pm
Who is online

Users browsing this forum: No registered users and 23 guests