My store has the options for user to Add To Cart, Call To Order, Visit Our Store.
I've modified the category page (list.phtml) to show "View Product" instead of Add to Cart.
On the product page, now, I need the options that my store will offer users, as stated in the first sentence. I've created attributes for these products with yes/no options when they make products. Attrib names are 'call_to_order' and 'visit_our_store' . What I'd like to do is on the addtocart.phtml add code to look if this product has one of those attribs as yes and then show the appropriate button, replacing the normal 'Add To Cart' with the appropriate text , and preferably no action to be taken when they click the button. I'd still like it to have the same styling as the 'Add to Cart' button.
I assume this can be done using get attrib and else php, my php is very rusty and I'm not sure where to put it/how to write it.
Current addtocart.phtml:
Code:
<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if($_product->isSaleable()): ?>
<div class="add-to-cart">
<?php if(!$_product->isGrouped()): ?>
<div class="qty-block">
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
</div>
<?php endif; ?>
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
<?php echo $this->getChildHtml('', true, true) ?>
</div>
<?php endif; ?>
If there are other changes that would need to be made, please advise. I haven't found a solution to this on the web. Even some of the extensions that I think might work would involve custom coding as well imho. This seems like a pretty straight forward solution to my problem.
Thank you!
View more threads in the same category:
Bookmarks