magento shippping set

piaoling  2011-07-07 13:34:09

 require_once 'Mage/Checkout/controllers/CartController.php';
class Bysoft_Homepage_Checkout_CartController extends Mage_Checkout_CartController
{
    public function indexAction()
    {
        if (Mage::app()->getStore()->getCode()=='jf_lazartigue_fr_fr'){
            $this->_getQuote()->getShippingAddress()
                ->setCountryId('FR')
                ->setCity('222')
                ->setPostcode('SOME')
                ->setRegionId('222')
                ->setRegion('222')
                ->setCollectShippingRates(true);
            $this->_getQuote()->getShippingAddress()->setShippingMethod("owebiashipping1_code_auto001")->save();
            Mage::getSingleton('checkout/session')->resetCheckout();
            $this->_getQuote()->save();
        }
        
        $cart = $this->_getCart();
        if ($cart->getQuote()->getItemsCount()) {
            $cart->init();
            $cart->save();

            if (!$this->_getQuote()->validateMinimumAmount()) {
                $warning = Mage::getStoreConfig('sales/minimum_order/description');
                $cart->getCheckoutSession()->addNotice($warning);
            }
        }

        foreach ($cart->getQuote()->getMessages() as $message) {
            if ($message) {
                $cart->getCheckoutSession()->addMessage($message);
            }
        }

        /**
         * if customer enteres shopping cart we should mark quote
         * as modified bc he can has checkout page in another window.
         */
        $this->_getSession()->setCartWasUpdated(true);

        Varien_Profiler::start(__METHOD__ . 'cart_display');
        $this
            ->loadLayout()
            ->_initLayoutMessages('checkout/session')
            ->_initLayoutMessages('catalog/session')
            ->getLayout()->getBlock('head')->setTitle($this->__('Shopping Cart'));
        $this->renderLayout();
        Varien_Profiler::stop(__METHOD__ . 'cart_display');
    }
}

类别 :  magento(258)  |  浏览(3737)  |  评论(0)
发表评论(评论将通过邮件发给作者):

Email: