1

I have created a custom product type extending simple product.I need to disable shipping information and shipping method for this product type on onepagecheckout just like it is disabled for virtual product. I cannot use virtual product and cannot extend from virtual product.

Please provide the any config or solution.

Thanks

0

I think you need to rewrite 2 magento classes:

Mage_Checkout_Block_Onepage_Shipping_Method and Mage_Sales_Model_Quote

In you module /etc/config.xml

<config>
.......
    <global>
        <blocks>
            <checkout>
                <rewrite>
                    <onepage_shipping_method>Namespace_Module_Block_Onepage_Shipping_Method</onepage_shipping_method>
                </rewrite>
            </checkout>
        </blocks>
        <models>
            <sales>
                <rewrite>
                    <quote>Namespace_Module_Model_Sales_Quote</quote>
                </rewrite>
            </sales>
        </models>
    </global>
........
</config>

Your Block/Onepage/Shipping/Method.php

<?php

class Namespace_Module_Block_Onepage_Shipping_Method extends Mage_Checkout_Block_Onepage_Shipping_Method 
{

    public function isShow()
    {
        return !$this->getQuote()->isVirtual() || !$this->getQuote()->isNonShippable();
    }

}

Your Model/Sales/Quote.php

class Namespace_Module_Model_Sales_Quote extends Mage_Sales_Model_Quote
{
    public function isNonShippable()
    {
        $isNonShippable = true;
        $countItems = 0;
        foreach ($this->getItemsCollection() as $_item) {
            /* @var $_item Mage_Sales_Model_Quote_Item */
            if ($_item->isDeleted() || $_item->getParentItemId()) {
                continue;
            }
            $countItems ++;
            if ($_item->getProduct()->getTypeId() != 'YOUR_PRODUCT_TYPE_ID') {
                $isNonShippable = false;
                break;
            }
        }
        return $countItems == 0 ? false : $isNonShippable;
    }
}

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.