Try the Demo

Magento Forum

   
Pre-Order button if Condition Met for Magento 1.7+
 
edimensions
Jr. Member
 
Total Posts:  1
Joined:  2011-10-27
 

Hello, I am new here and after searching for a while could not figure out how to do the following.  It seems simple enough I just need the “Add to cart” button to change and say “Pre-Order” when an attribute condition is met.  I have setup the attribute “preorder” and set it to yes or no now I just have to write an if statement and the way I was trying was in the ‘addtocart.phtml’

The code is: 

<?php $buttonTitle $this->__('Add to Cart'); ?>

Now as far as I could tell I just have to add something like:

<?php if($_product->getAttribute('preorder') == 'yes'): ?>
<?php $buttonTitle 
$this->__('Pre-Order'); ?>
<?php 
endif; ?>

//this should end the if if preorder is set to no than the button titled Pre-Order should be skipped and continue with the following.

?php $buttonTitle $this->__('Add to Cart'); ?>

I’ve tried many variations and it just seemed to get rid of the add to cart button completely.  If I just change the text in the ‘Add to Cart’ to ‘Pre-Order’ it would change it globally but I just need it to change if preorder is found to be true.  Any help would be appreciated.  Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Customy
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2011-05-11
Czech Republic
 

Please review our solution for Pre-Order button display where products are out of stock and backorders are enabled.

 Signature 

http://www.customy.com

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top