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.