0

I am new to magento. I have module which is to Modify Shipping/handling charges during checkout.

Ex: If Customer select any UPS/FedEx/USPS services it will be populate/add from Cart/Checkout summery but no need to add/apply charges (no need to apply Shipping Charges).

Any Idea,Suggestions.

Thanks.

  • in which you want to modify the shipping charge, please elaborate your question so that i will help you – Ami Kamboj Jun 6 '14 at 6:34
  • @AmitKamboj, I want to select Shipping Service but do not want to add shipping charge to order total from checkout page. – Magento Nav Jun 6 '14 at 7:12
  • You can make a shipping method any name by a custom module and set the price of it as you want to add, and from available.phtml file in checkout/onpages/shippingmethod get that shipping method and checked it by default. Hope this will help you. if you need any custom shipping mehtod i will going to post a ans from which you get a shipping method. – Ami Kamboj Jun 6 '14 at 7:19
2

Go to this you find a correct way:

https://stackoverflow.com/questions/22881621/how-to-get-all-available-shipping-methods-programmatically-in-magento

0

First declare an observer for the sales_quote_collect_totals_before event.

<config>
    <global>
        <events>
            <sales_quote_collect_totals_before>
                <observers>
                    <your_module>
                        <type>singleton</type>
                        <class>your_module/observer</class>
                        <method>salesQuoteCollectTotalsBefore</method>
                    </your_module>
                </observers>
            </sales_quote_collect_totals_before>
        </events>
    </global>
</config>

Then, in the observer, adjust the handling type and fee configuration for each carrier in the corresponding store model.

public function salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer)
{
    /** @var Mage_Sales_Model_Quote $quote */
    $quote = $observer->getQuote();

    // Check your customer attribute of choice here instead of the customer id
    if ($quote->getCustomer()->getId()) {

        $store = Mage::app()->getStore($quote->getStoreId());
        $carriers = Mage::getStoreConfig('carriers', $store);
        foreach ($carriers as $carrierCode => $carrierConfig) {

            // F for fixed, P for percentage
            $store->setConfig("carriers/{$carrierCode}/handling_type", 'F');

            // 0 for no fee, otherwise fixed of percentage value
            $store->setConfig("carriers/{$carrierCode}/handling_fee", '1');
        }
    }
}

Note that the configuration changes are not saved, they are only valid during the request

  • I think this is for Fixed right, I tried this yester day i'm not getting. Ex: If i select UPS Ground Shipping services it should be add checkout page but do not want to add shipping charge to order total. how Can I do? Any Idea? – Magento Nav Jun 6 '14 at 9:57
  • So ultimately you want free shipping for ground UPS? – TBI Infotech Jun 6 '14 at 10:22
  • Yah! But Order must have existing the selected Shipping method (no need to add/include charges). – Magento Nav Jun 6 '14 at 10:33
  • This may be what you need >magentocommerce.com/knowledge-base/entry/… – TBI Infotech Jun 6 '14 at 10:35
  • Actually I saw this earlier. Actually in my module have 2 shipping methods is there 1) Normal Shipping 2) Third party. When select 2 All shipping services will showing except charges. if I add No need to apply charges. If Select 1 normal procedure as megento have this. – Magento Nav Jun 6 '14 at 10:42

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.