1

for some products we want to replace the add to cart button with a "Email to Order" button.

I will use an alternative theme for this.

I know how to disable the "Add to cart button".

But now i would like to have a button "Mail to order"

And when the customers clicks on this button, a small form shows up with the ability to fill in their name and e-mailadress.

And we get an email with their contactdata and the product they want to order (automatically) with the selected configurable option.

Is that possible, and how do i do that?

I use magento 1.8.1 CE

0

You will need to do some customization for your requirements.

This will give give you some hint.

Copy

app/design/frontend/base/default/template/catalog/product/view/addtocart.phtml

to your theme

app/design/frontend/your_package/your_theme/template/catalog/product/view/addtocart.phtml

in this file you can add some condition for your requirement

For example,

<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php $mailToOrder = $this->__('Mail to order'); ?>
<?php if($_product->isSaleable()): ?>
    <div class="add-to-cart">
        <?php if(!$_product->isGrouped()): ?>
        <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" />
        <?php endif; ?>

        <?php if(/*put your condotion*/); ?>

            <button type="button" title="<?php echo $mailToOrder ?>" class="button btn-cart" onclick="showCustomForm();"><span><span><?php echo $mailToOrder ?></span></span></button>

        <?php else: ?>

            <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>

        <?php endif; ?>

        <?php echo $this->getChildHtml('', true, true) ?>

    </div>
<?php endif; ?>


<script>

    function showCustomForm()
    {
        // you can open popup or display form as per your requirement.
    }

</script>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.