0

I want to remove the update button process from shipping & estimate in the shopping cart.

We have set up to select shipping by country only removing state and postcode requirements. We only have one shipping service (standard shipping) but we use table rates to control different country prices and zero tax for export.

I notice that once the update total radio button is checked and the button pressed, if you then change country and use the get quote button this then automatically sends correct postage and tax to the shopping cart total.

I want to update and send values to cart from the get quote button and remove the update stage, is this possible?

I am looking at the shipping.phtml and see that the Get Quote calls for the shipping form: __('Get a Quote') ?>" onclick="coShippingMethodForm.submit

It seems once this form is loaded once it will then update when country changed, how can I get the form to load and update from the one button Get Quote process?

1 Answer 1

1

Go take a look at the CartController, this will give you what you need.

These are the 2 actions used for the cart estimation and updating the totals. You would just need to call the update directly after getting the quote. You could do this in the phtml or in the controller, either works.

  /**
     * Initialize shipping information
     */
    public function estimatePostAction()
    {
        $country    = (string) $this->getRequest()->getParam('country_id');
        $postcode   = (string) $this->getRequest()->getParam('estimate_postcode');
        $city       = (string) $this->getRequest()->getParam('estimate_city');
        $regionId   = (string) $this->getRequest()->getParam('region_id');
        $region     = (string) $this->getRequest()->getParam('region');

        $this->_getQuote()->getShippingAddress()
            ->setCountryId($country)
            ->setCity($city)
            ->setPostcode($postcode)
            ->setRegionId($regionId)
            ->setRegion($region)
            ->setCollectShippingRates(true);
        $this->_getQuote()->save();
        $this->_goBack();
    }

    /**
     * Estimate update action
     *
     * @return null
     */
    public function estimateUpdatePostAction()
    {
        $code = (string) $this->getRequest()->getParam('estimate_method');
        if (!empty($code)) {
            $this->_getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save();
        }
        $this->_goBack();
    }
2
  • Hi Karen, Thanks for this input! I am completely not good with with code. Please could you be a bit more specific. I tried to put the call in the controller but keep getting errors. Or would it be the shipping phtml with this call action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>"> and where to insert?
    – Dan
    Nov 25, 2014 at 14:55
  • @KarenBaker, why collectTotals() is commented. What does it do ? Mar 3, 2016 at 7:40

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.