protected function _toHtml() { if (Mage::helper('fieldsmanager')->getStoredDatafor('enable') && !Mage::getStoreConfig('quickcheckout/general/active')) { $this->setTemplate("fieldsmanager/checkout/onepage/shipping_method/available.phtml"); } return parent::_toHtml(); }
/** * Overwrite parent method to adding properly carrier name * when it starts with assigned $carrierCode ("easyshippingrules") * * @param string $carrierCode * * @return string */ public function getCarrierName($carrierCode) { $carrierName = Mage::helper('easyshippingrules')->getCarrierName($carrierCode); if ($carrierName) { return $carrierName; } return parent::getCarrierName($carrierCode); }
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; }
protected function _toHtml() { $additional = ''; if ($this->getAddress()->getAddressNormalized()) { $notice = 'Your shipping address has been modified during our validation process. Please confirm the address to the right is accurate.'; if ($notice) { Mage::getSingleton('advanced/session')->addNotice($notice); $additional = $this->getMessagesBlock()->getGroupedHtml(); } } else { if ($this->getAddress()->getATNoMatches()) { $notice = 'We were not able to find a match while trying to validate your shipping address. Please double check your shipping address to the right.'; if ($notice) { Mage::getSingleton('advanced/session')->addNotice($notice); $additional = $this->getMessagesBlock()->getGroupedHtml(); } } } return $additional . parent::_toHtml(); }
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(); }
public function __construct() { parent::__construct(); //Rendu par défaut $this->addItemRender('default', 'tnt/onepage_shipping_method_available', 'tnt/onepage/shipping_method/available/default.phtml'); }
public function _construct() { parent::_construct(); }
public function getShippingRates() { $groups = parent::getShippingRates(); unset($groups['nypwidget']); return $groups; }
protected function _toHtml() { if (!Mage::helper('udsplit')->isActive()) { return parent::_toHtml(); } $block = $this->getLayout()->createBlock('udsplit/onepage_review')->setTemplate('checkout/onepage/review/info.phtml')->setShowDropdowns(true); Mage::helper('udropship')->applyItemRenderers('checkout_onepage_review', $block); $html = $block->toHtml(); if (!self::$_shippingOverridden) { self::$_shippingOverridden = true; $html = str_replace('id="checkout-review-submit"', 'id="udsplit-checkout-review-submit"', $html); $js = <<<EOT <script type="text/javascript"> if (typeof ShippingMethod != "undefined") { ShippingMethod.prototype.validate = function() { var methods = \$\$('.shipment-methods'); if (methods.length==0) { alert(Translator.translate('Your order can not be completed at this time as there is no shipping methods available for it. Please make neccessary changes in your shipping address.')); return false; } for (var i=0; i<methods.length; i++) { if (methods[i].options.length==0) { alert(Translator.translate('Your order can not be completed at this time as some of the shipping methods are not available. Please make neccessary changes in your shipping address.')); return false; } } return true; } } \$('udsplit-checkout-review-submit') && Element.remove('udsplit-checkout-review-submit') </script> EOT; $html = $js . $html; if (Mage::getStoreConfigFlag('carriers/udsplit/sm_hide_amounts')) { $qtyLbl = Mage::helper('checkout')->__('Qty'); $html .= <<<EOT <script type="text/javascript"> var uds_sm_hide_amounts_idx = 0 \$\$('#checkout-review-table thead tr th').each(function(el, idx){ if (el.innerHTML.strip() == '{$qtyLbl}') uds_sm_hide_amounts_qty_idx = idx if (idx>0 && el.innerHTML.strip() != '{$qtyLbl}') el.remove() }) \$\$('#checkout-review-table colgroup col').each(function(el, idx){ if (idx>0 && idx != uds_sm_hide_amounts_qty_idx) el.remove() }) \$\$('#checkout-review-table tbody tr').each(function(trEl, idx){ trEl.childElements().each(function(tdEl, idx){ if (idx>0 && idx != uds_sm_hide_amounts_qty_idx) { tdEl.remove() } else if (idx == uds_sm_hide_amounts_qty_idx) { tdEl.colspan=1 tdEl.addClassName('last') } var uvSub = tdEl.select('.udsplit-vendor-subtotal') if (uvSub && uvSub.length>0) { uvSub[0].remove() } }) }) </script> EOT; } } return $html; }