cancel
Showing results for 
Search instead for 
Did you mean: 

How to display the custom options on product page

How to display the custom options on product page

Hi,

 

I am trying to add the custom options on product page using extension.

 

I have the following code:

 

app\code\local\Namespace\Giftwrapping\Block\Product.php

 

<?php

class Namespace_Giftwrapping_Block_Product extends Mage_Core_Block_Template
{
	//some codes here
}

 

 

app\design\frontend\mytheme\default\template\giftwrapping\product.phtml

 

<script type="text/javascript">
	$j(document).ready(function() {
		//$j('.fancybox').hide();
		$j(".fancybox").fancybox({
			helpers : {
                title : {
                  type : 'inside'
                }
              }
		});
	});
</script>

<div id="gift-wrapper" style="display:none;">
<?php

$productSku = "Gift";
$product = Mage::getModel('catalog/product');
$productId = $product->getIdBySku( $productSku );
$product->load($productId);

if($product->getData('has_options')) {
?>
<?php if ($container1_html = $this->getChildChildHtml('container1', '', true, true)): ?>
					<div class="container1-wrapper"><?php echo $container1_html; ?></div>
				<?php endif; ?>
<?php
}

?>
</div>	

I tried this code outside the extension, like view.phtml on the theme folder, and its working fine, however I need it to put this inside the extension for following the rules in editing magento. I think I have missing something, or I need to extend some class. Any thoughts regarding this?

 

P.S I am just started learning to create a module in Magento. This is very much appreciated for your help.