How to modify magento product template? - magento

I would like to change the product page template in our magento store. Can you please advice how to insert this tag "/PACK" beside the product price?
See image links: http://www.thebodyshop.ie/price-pack/?___store=default
The second one, at the bottom would be the goal.
Thank you in advance!!!

Copy the price.phtml file from app/design/frontend/base/default/template/catalog/productAnd paste it into your theme_package_folder/template/catalog/product.Approx 201 and 203 lines you can find code to display price and final price in frontend.
<?php echo $_coreHelper->currency($_price, true, true) ?>
<?php echo $_coreHelper->currency($_finalPrice, true, true) ?>
replace it with
<?php echo $_coreHelper->currency($_price, true, true).'/PACK' ?>
<?php echo $_coreHelper->currency($_finalPrice, true, true).'/PACK' ?>
If you want you can even give span to '/pack' and give your css.

Related

phtml code for magento product page

I want to insert some text directly below the tier price html if there is tier price info for item. So I am looking for code for a if then. This is what I have so far but it is not working. I am getting TEST for every product and not just for the tier price products.
<?php if ($this->getTierPriceHtml()):?>
<h2><?php echo $this->__('TEST') ?></h2>
<?php endif; ?>
If you inspect the value returned by
$this->getTierPriceHtml()
when it is empty you will see that it is returning blank html with lots of spaces.Thats why when you cneck for
if ($this->getTierPriceHtml()):
always return true because there is blank spaces.
So first check like below
$tier = $this->getTierPriceHtml();
$string = preg_replace('/\s+/', '', $tier);//This will remove all spaces
if($string!=""){
echo $this->__('TEST');
}
Hope this will help.

how to show all custom options in right side in product view page with magento?

I added color,size and warranty in admin in custom options.I want to show these custom options in right column of product view page but it is not showing in right side.
can you please tell me how to show custom options in right side.
If anyone knows this,please help me out.
Thanks!
try below code:
<?php if ($_product->isSaleable() && $_product->hasOptions()):?>
<?php echo $this->getBlockHtml('container1', '', true, true) ?>
<?php endif;?>
<?php if ($_product->isSaleable() && $_product->hasOptions()):?>
<?php echo $this->getBlockHtml('container2', '', true, true) ?>
<?php endif;?>
Amit's code should work. However, can you make sure that the attributes have Visible on Product View Page on Front-end set to yes.

Magento: How show on frontend the Keyword attribute of product

Not finding anything on google that solves this problem.
I'm trying to add keywords attribute after the description of the product.
Tried:
<?php echo $_product->getMetaKeyword() ?>
<?php echo $_helper->productAttribute($_product, $_product->getMetaKeyword(), 'meta_keyword') ?>
< ?php echo $_product->getAttributeText('meta_keyword') ?>
I'm want add this on list.phtml
\app\design\frontend\default\mt_Bonasa\template\catalog\product\list.phtml
Go to the attribute managment and configure the
meta_keyword
attribute to be "used in product listing". Then it will be joined to the collection and you can simply fetch it via:
$_product->getMetaKeyword()
Here a screenshot how its set out of the box - switch to "yes"

Magento Page Title - include SKU as well as product name

How do I include the SKU as well as the product name in the page title (when looking at the product details page)?
Cheers!
In app/design/frontend/default/{your theme Folder}/template/page/html/head.phtml you could try
<?php if ($_product = Mage::registry('current_product')) { ?>
<title><?php echo $_product->getName() . ' ' . $_product->getSku(); ?></title>
<?php }else{ ?>
<title><?php echo $this->getTitle() ?></title>
<?php } ?>
You could also do this using an observer for catalog_controller_product_view see Magento Change Product Page Titles to Include Attributes
If you have a collection already loaded (ie. on product view page)
$_product->getSku();
If for some reason you need to call this from a different template higher up in the chain that isn't already loading the product/collection, you can drop this one:
$_product = Mage::registry('current_product');
$_product->getSku();
look at your design template in catalog/product/view.phtml file you should be able to simply do $_product->getData('sku');

What function and where is $this->getPriceHtml() located?

On the default product view page for magento where is "getPriceHtml" function located or what is being called here:
<?php echo $this->getPriceHtml($_product) ?>
Several words are being displayed by this code such as "Price From:" with the price included afterwards. This is for a configurable product.
Mage_Catalog_Block_Product::getPriceHtml()
This method renders via app/design/frontend/base/default/template/catalog/product/price.phtml
a.k.a The Worst Template In Magento®
benmark's answer comes down to this:
<?php echo Mage_Catalog_Block_Product::getPriceHtml($_product, true) ?>
Where $_product relates to the product object.
$productBlock = new Mage_Catalog_Block_Product();
$priceBlock = $productBlock->getPriceHtml($_product, true);
echo $priceBlock;

Resources