add tab to product viw

how can i add a custom attribute to a text box on the product view page?

2 answers

Profile photo of thangnn1510 0.00 $tone June 17, 2011

To add custom attribute (I call it "custom") to product view page please do the following:

-- Open app\design\frontend\default\jm_mozanistemplate\ca talog\product\view.phtml
-- Find this code:

<?php if($review_form = $this->getChildHtml(‘review_form’)): ?>
<li><a href="#ja-tabitem-reviewform"><?php echo $this->__(‘Write Your Own Review’) ?></a></li>
<?php endif; ?>

Add this below above code:

$product = Mage::getModel("catalog/product")->load($_product->getId());
if($custom = $product->getCustom()): ?>
<li><a href="#ja-tabitem-custom"><?php echo $this->__(‘Custom’) ?></a></li>
<?php endif; ?>

Find this code:

<?php if($review_form): ?>
<div id="ja-tabitem-reviewform">
<?php echo $review_form; ?>
<?php endif;?>

Add this below the above code:

<?php if($custom): ?>
<div id="ja-tabitem-custom">
<?php echo $custom; ?>
<?php endif;?>

You should change custom to work with your attribute.

Profile photo of Sarper Gudek 0.00 $tone November 16, 2011


Got a related question.

Why does the "Product Reviews" and "Write Your Own Review" do not appear on the product page? (they do show up on the page that you get after clicked on "be the first to review…"

Also, how to make them appear on the PRODUCT page? I guess no need for custom tag, as they are already there, but not appearing.



This question is now closed

Written By