public function getShippingRates()
 {
     $groups = parent::getShippingRates();
     $freeGroups = array();
     foreach ($groups as $index => $rates) {
         foreach ($rates as $rate) {
             if (!$rate->getPrice() > 0) {
                 $freeGroups[$index][] = $rate;
             }
         }
     }
     if (!empty($freeGroups)) {
         $this->_rates = $freeGroups;
         return $this->_rates;
     }
     return $groups;
 }
Exemplo n.º 2
0
 public function loadreviewAction()
 {
     if ($this->_expireAjax()) {
         return;
     }
     $Paymentdata = $this->getRequest()->getPost('payment');
     $Paymentresult = $this->getOnepage()->savePayment($Paymentdata);
     $available = new Mage_Checkout_Block_Onepage_Shipping_Method_Available();
     $_shippingRateGroups = $available->getShippingRates();
     foreach ($_shippingRateGroups as $code => $_rates) {
         if (count($_rates) == 1) {
             foreach ($_rates as $_rate) {
                 $shipping_method = $_rate->getCode();
                 $save_shippingmethod = $this->getOnepage()->saveShippingMethod($shipping_method);
                 $this->getOnepage()->getQuote()->collectTotals()->save();
                 $this->getOnepage()->getQuote()->getShippingAddress()->setShippingMethod($shipping_method);
             }
         }
     }
     $this->getOnepage()->getQuote()->collectTotals()->save();
     $this->loadLayout();
     $this->renderLayout();
 }
Exemplo n.º 3
0
 public function getShippingRates()
 {
     $groups = parent::getShippingRates();
     unset($groups['nypwidget']);
     return $groups;
 }