Once again thanks for viewing this post i would like to mention that i need a requirement of map price in magento what actually i need . I am having some product which have MAP price and also price , so on listing of product if map price is available then system will show map price because vender cant sell below the map price,
Example: MAP: $3 Price : $2 Then System Will Show MAP Price Of Product in this case.
Do i need to override core functionality for catalog price product rule or is there anyway to show that map price on .phtml file. If i do condition on price in phtml file will it get affected on all like in cart and detail pages. or do i need to make changes on everywhere. If i want to override the rule then in which file i need to change
And do MAP Configuration but it show price on everywhere on cart to am i doing wrong with MAP configuration.
Please help me Thanks in advance!
Adding a condition inside your template (phtml) file would cause issues for you. This price would be shown to the visitor, but the actual price field would be used in calculations / cart etc so there could be a mismatch.
The simplest way to do what you want would probably be to override the Product model and/or Product Price Model.
Mage_Catalog_Model_Product
Mage_Catalog_Model_Product_Type_Price
there's a load of guides on how to override models:
http://magento4u.wordpress.com/tag/override-catalog-product-model/
For simplicity you could just copy the class into the local namespace which would override the class without having to create a module/xml etc.
class Mage_Catalog_Model_Product_Type_Price
{
/**
* Default action to get price of product
*
* @return decimal
*/
public function getPrice($product)
{
if($product->getMsrp() > $product->getData('price')) {
return $product->getMsrp();
}
return $product->getData('price');
}
}
Something like that might do the trick, although it;s not tested in anyway shape or form but it might help get you started..
or override the getPrice method inside the product class
Mage_Catalog_Model_Product
/**
* Get product price throught type instance
*
* @return unknown
*/
public function getPrice()
{
if ($this->_calculatePrice || !$this->getData('price')) {
$price = $this->getPriceModel()->getPrice($this);
} else {
$price = $this->getData('price');
}
if($this->getMsrp() > $price) {
return $this->getMsrp();
}
return $price;
}
You can see sometimes it may not be using the price model, so it may be better to override the getPrice method in the product class.. try it out.