Category Archives: Magento

magento change form validation messages

1) Add a new class “over_all_fit_required_entry”
<input type=”hidden” name=”over_all_fit_selected” id=”over_all_fit_selected” class=”over_all_fit_required_entry”>

2) Add the below given code
<script type=’text/javascript’>
//< ![CDATA[
Validation.add(‘over_all_fit_required_entry’, ‘ Please select option’, function(v) {
return !Validation.get(‘IsEmpty’).test(v);
});
//]]>
</script>

Modify Page Title CMS Page Magento

Go to Admin > CMS > Pages > Design > Layout Update XML and paste the below given code

<reference name=”head”>
<action method=”setForcedTitle” translate=”title”>
<title>Account Settings</title>
</action>
</reference>
and modify the head.phtml

<title><?php echo ($this->getForcedTitle()) ? $this->getForcedTitle() : $this->getTitle() ?></title>

Modify Page Title Magento

Include the below given code in xml file

<reference name=”head”>
<action method=”setForcedTitle” translate=”title”>
<title>Account Settings</title>
</action>
</reference>
and modify the head.phtml

<title><?php echo ($this->getForcedTitle()) ? $this->getForcedTitle() : $this->getTitle() ?></title>

Get configurable products attributes Magento

<?php
$obj = Mage::getModel(‘catalog/product’);
$_product = $obj->load(19);
$configurableAttributeCollection=$_product->getTypeInstance()->getConfigurableAttributes();
foreach($configurableAttributeCollection as $attribute){
echo “Attr-Code:”.$attribute->getProductAttribute()->getAttributeCode() .” – “;
echo “Attr-Label:”.$attribute->getProductAttribute()->getFrontend()->getLabel().” – “;
echo “Attr-Id:”.$attribute->getProductAttribute()->getId().” <br /> “;
}
?>