cancel
Showing results for 
Search instead for 
Did you mean: 

Show a custom message if the total price for a product goes over a certain value

SOLVED

Show a custom message if the total price for a product goes over a certain value

I am new to Magento and now trying to find a way to show a message on a product page (preferably instead of the "Add to Cart" button), if the total price (based on several custom options) for a product goes over a certain limit, but I can't figure out a way to do so. I have tried searching for the variable responsible for the total price, to create a php "if" expression, but so far I have no luck. Is there a way to make this message appear? Or maybe someone could give me a hint where to look for the total price variable?

 

Magento 1.9.2.4

 

Best regards

3 REPLIES

Re: Show a custom message if the total price for a product goes over a certain value

Hi,

 

If you want to put condition on product detail page then go to below location:

 

\app\design\frontend\base\default\template\catalog\product\view.php

 

open view.php file and go to line number 66 or search "echo $this->getChildHtml('addtocart')"  text. In that place you can put your condition.

 

If you want to put condition on product list page then go to below location:

 

\app\design\frontend\base\default\template\catalog\product\list.php

 

Open list.php file and go to line number 61 or search "Add to Cart" text and put condition accordingly.

 

If this post is fulfill your condition then please mark as accept.

 

Thanks,

Dibyajyoti

Re: Show a custom message if the total price for a product goes over a certain value

Thank you for your reply and information given. Maybe you could also give me an advice on how can I address a variable which holds the total price so I could use it in the "if" condition?

 

Best regards

Re: Show a custom message if the total price for a product goes over a certain value

Hi,

 

If you want to get price on view.php file through variable find below code:

 

$_product = $this->getProduct();

$price = $_product->getFinalPrice(); 

 

If this post fulfill your solution then mark as accept.

 

thanks,

Dibyajyoti