[MOD] Stop Free Shipping dropping other options

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [MOD] Stop Free Shipping dropping other options

Post by Martin »

chamster wrote:Not quite the same issue I'm having but the closest discussion I could find. My issue has to do with fixed shipping costs. Our shop gives free shipping on orders over $75. But some of our products are oversized and have a fixed shipping cost, which we want to charge even if the order is over $75. The problem is that if an item with a fixed shipping cost is over $75, then the free shipping automatically kicks in and overrides the fixed shipping cost, and the only shipping option for the customer at checkout is free shipping.

We need it to be the other way around, i.e. for oversized items we want the fixed shipping cost to override the (free shipping over $75) default.
Am I right in thinking that the free shipping is coming from the discount rules or are you using a shipping module (Eg: Ship by Order Total) that handles things?

Either way should be resolvable one way or another.
chamster
Posts: 11
Joined: Wed May 30, 2012 6:06 am

Re: [MOD] Stop Free Shipping dropping other options

Post by chamster »

Am I right in thinking that the free shipping is coming from the discount rules or are you using a shipping module (Eg: Ship by Order Total) that handles things?
The free shipping is set up as a shipping zone. You can see a screenshot of that zone's settings here:

Image
chamster
Posts: 11
Joined: Wed May 30, 2012 6:06 am

Re: [MOD] Stop Free Shipping dropping other options

Post by chamster »

Hi Martin,
So shouldn't we be able to achieve what we want (fixed shipping override free shipping) when using the free shipping over $75 as a shipping zone? Or are we better off taking a different approach to doing the free shipping? Thanks!
Bob
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [MOD] Stop Free Shipping dropping other options

Post by Martin »

Minor mod to add to this one.
  1. Screen for any services that do not contain [T], [S] or [TS] in service description
  2. Discount by 1.50 (of default currency) any remaining T/S/TS services
Open: class.quote.address.shipping.php

Find:

Code: Select all

		while ($method = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$quotes = $this->getShippingMethodQuotes($method, $enableRealTime);

			if ($quotes) {
				$shippingQuotes = array_merge($shippingQuotes, $quotes);
			}
		}
Replace with:

Code: Select all

		while ($method = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			$quotes = $this->getShippingMethodQuotes($method, $enableRealTime);

			if ($quotes) {

//MOD Remove all except tracked/signed options if free shipping enabled
                if(is_array($freeShippingQuotes)) {
                    $new_quotes = array();
                    foreach($quotes as $tq) {
                        if(preg_match("/\[[TS]+\]/",$tq['description'],$tqm)) {
                            $tq['price'] -= 1.5;    // Discount by £1.50
                            $new_quotes[] = $tq;
                        }
                    }
                    $quotes = $new_quotes;
                }
//MOD END
				$shippingQuotes = array_merge($shippingQuotes, $quotes);
			}
		}
Post Reply