Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Retrieve all grouped shipping rates
- *
- * @return array
- */
- public function getGroupedAllShippingRates()
- {
- $rates = array();
- /* added code */
- $found = false;
- $collection = $this->getShippingRatesCollection();
- foreach ($collection as $rate) {
- if (!$rate->isDeleted() && $rate->getCarrierInstance()) {
- if ($rate->getCarrier() == "freeshipping" /*&& $rate->getMethod() == "freeshipping"*/) {
- $found = true;
- }
- }
- }
- foreach ($collection as $rate) {
- if (!$rate->isDeleted() && $rate->getCarrierInstance()) {
- if (!isset($rates[$rate->getCarrier()])) {
- $rates[$rate->getCarrier()] = array();
- }
- /* added code */
- $storeId = $this->getQuote()->getStoreId();
- switch ($storeId) {
- case 1: // my store -> default store
- // any order that is not free shipping -> ignore
- if ($found && !($rate->getCarrier() == "freeshipping" /*&& $rate->getMethod() == "freeshipping"*/)) {
- continue 2;
- }
- break;
- }
- $rates[$rate->getCarrier()][] = $rate;
- $rates[$rate->getCarrier()][0]->carrier_sort_order = $rate->getCarrierInstance()->getSortOrder();
- }
- }
- uasort($rates, array($this, '_sortRates'));
- return $rates;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement