Page 1 of 1

[SOLVED]:how to add a link in an individual product page

Posted: Sun Mar 27, 2011 8:05 am
by naser
Hi, am new to opencart can please tell me how to add a link in column_left or right that only will show in an individual product page? so that link or picture only shows in the page I want.
i used
<?php if ( ($Path = '35') ) { echo 'SOMETHING'; } ?>
but not working

Re: how to add a link in an individual product page

Posted: Sun Mar 27, 2011 2:33 pm
by qahar
does you define $this->data[path] on controller/common/column_left.php

Re: how to add a link in an individual product page

Posted: Sun Mar 27, 2011 10:55 pm
by naser
ty qahar can i know how to make it show only in one product page i did this in column_left

<?php if($this->request->get['route'] == 'product/product' ){ ?>
<td <img alt="" src="catalog/view/theme/default/image/check.gif" /></td>
<?php } ?>
but this code will show it in all product pages i want it only in page product_id=49

Re: how to add a link in an individual product page

Posted: Mon Mar 28, 2011 12:26 am
by openmycart.com
doesn't as follow solved it?

Code: Select all

<?php if (($this->request->get['route'] == 'product/product' ) && ($product_id ==48)){ ?>
<td> <img alt="" src="catalog/view/theme/default/image/check.gif" /></td>
<?php } ?>

Re: how to add a link in an individual product page

Posted: Mon Mar 28, 2011 1:15 am
by naser
ty openmycart.com
in catalog/view/theme/default/template/common/column_left

Code: Select all

<?php if (($this->request->get['route'] == 'product/product' ) && ('$product_id ==49')){ ?>
<td> <img alt="" src="catalog/view/theme/default/image/check.gif" /></td>
<?php } ?> 
sry not solved same thing it will show in all product pages i want it only in page product_id=49

Re: how to add a link in an individual product page

Posted: Mon Mar 28, 2011 5:47 pm
by openmycart.com
OK, if I am not miss understood You are looking as follow:

Code: Select all

<?php if ($this->request->get['route'] == 'product/product&'.$product_id.'=48' /* Your product id */){  ?>
<td> <img alt="" src="catalog/view/theme/default/image/check.gif" /></td>
<?php } ?>
am I still fail to catch it?

Re: how to add a link in an individual product page

Posted: Tue Mar 29, 2011 3:59 am
by naser
big thx to Khalid H.S he solved it and now it's working great,
thank you openmycart and qahar for ur help. and please if u can check the code will be nice
here how

in catalog\view\theme\default\template\common\column_left.tpl
add this code

Code: Select all

<?php if ($product_id ==49) { ?>
<td><img alt="" src="catalog/view/theme/default/image/check.gif" /></td>
<?php } ?>
in catalog\controller\common\column_left.php
look for

Code: Select all

$this->data['modules'] = $module_data;
under it put this code

Code: Select all

if (isset($this->request->get['product_id'])) {
$this->data['product_id'] = $this->request->get['product_id'];
} else {
$this->data['product_id'] = 0;
}
product_id ==49 you can change it to any page u want.

Re: [SOLVED]:how to add a link in an individual product page

Posted: Mon Mar 18, 2013 12:03 pm
by rwalker
If you wanted this for multiple product pages can you just seperate the IDs with commas? Ie 49,50,51


Thank you