2

I need to disable checkout (so neither billing nor shipping, ..) for certain product. Instead of the Add to cart button I need to have a textfield and a button that says Send me an email about this product How can I do this?

1

The way I would approach this would be to put all "special products" like this one into a new category called for example "special products" which is invisible in the frontend, or create a product attribute.

Then in your template phtml check if the current product is in the "special products" category, or check for the existence of the product attribute.

if($_product->getIsSpecialProduct()) {
   $_specialProduct=true;
}

Then add logic around the price and add html that shows the 'send me an email' information or button.

For example for the product page edit default/template/catalog/product/view.phtml in your theme. Create a variable to define the product as a "special product" i.e. a member of the Special Product category

<?php $_product = $this->getProduct();
$_categoryIds = $_product->getCategoryIds();
$_specialProductCategory=38;
$_specialProduct=false;

if (in_array($_specialProductCategory, $_categoryIds)) {
   $_specialProduct=true;
}
?>
  • here my special product category id is 38.

        <?php if (!$_specialProduct):?>
            <div class="add-to-cart-wrapper">
                <?php echo $this->getChildHtml('product_type_data') ?>
                <?php echo $this->getChildHtml('extrahint') ?>
    
                <?php if (!$this->hasOptions()):?>
                    <div class="add-to-box">
                        <?php if($_product->isSaleable()): ?>
                            <?php echo $this->getChildHtml('addtocart') ?>
                            <?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
                                <span class="or"><?php echo $this->__('OR') ?></span>
                            <?php endif; ?>
                        <?php endif; ?>
                        <?php echo $this->getChildHtml('addto') ?>
                        <?php echo $this->getChildHtml('sharing') ?>
                    </div>
                    <?php echo $this->getChildHtml('extra_buttons') ?>
                <?php elseif (!$_product->isSaleable()): ?>
                    <div class="add-to-box">
                        <?php echo $this->getChildHtml('addto') ?>
                        <?php echo $this->getChildHtml('sharing') ?>
                    </div>
                <?php endif; ?>
            </div>
        <?php else:?>
            <div class="specialproduct add-to-cart-wrapper">
                <p><a class="specialproduct btn" href="#">Send me an email about this</a></p>
            </div>
        <?php endif;?>
    

Add your product to the special product category, refresh your cache and you should see the modified product view page without the add to cart info (or price if you want). You can see an example of this here

You would also need to so something similar for the product list view.

To automatically send an email you would need to implement some more code to create an email via ajax.

Hope this helps.

  • Why not use an attribute instead of a category. – Yiorgos Moschovitis Jul 6 '15 at 14:10
  • Thanks for answer! I think should be better using attributes, like 'remove addtocart' – Mattia Merlini Jul 6 '15 at 17:08
1

This will only get you half way there, but it will remove the "Add to Cart"

On the product page, under "Design" add the below code to "Custom Layout Update"

<reference name="content">
  <remove name="product.info.addtocart"/>
</reference>

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.