[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:

[MOD] Stop Free Shipping dropping other options

Post by Martin » Wed May 18, 2011 11:50 pm

Had a request for this and have 10 minutes spare so I've been looking at ways to stop ISC from only providing "free shipping" as the only shipping option.

This is untested and possible wrong but it looks a lot like this one change is all that's required to enable other shipping methods as well as "free".

Open: includes/classes/class.quote.address.shipping.php

Find:

Code: Select all

		// Free shipping method
		if ($this->allowsFreeShipping()) {
			$shippingQuotes[] = array(
				'description'	=> getLang('FreeShipping'),
				'price'			=> 0,
				'methodId'		=> -1,
				'module'		=> '',
				'handling'		=> $zoneHandlingFee,
			);

			if (empty($shippingQuoteItems)) {
				return $shippingQuotes;
			}
		}
??? Replace with:

Code: Select all

		// Free shipping method
		if ($this->allowsFreeShipping()) {
			$shippingQuotes[] = array(
				'description'	=> getLang('FreeShipping'),
				'price'			=> 0,
				'methodId'		=> -1,
				'module'		=> '',
				'handling'		=> $zoneHandlingFee,
			);
//MOD Allow other shipping method options
/*
			if (empty($shippingQuoteItems)) {
				return $shippingQuotes;
			}
*/
//MOD END
		}

pitorian
Posts: 31
Joined: Mon Aug 17, 2009 9:55 am

Re: [MOD] Stop Free Shipping dropping other options

Post by pitorian » Thu May 19, 2011 9:18 am

Works like a charm,

Just need to restrict the countries that the free shipping shows for,

This happens if they select a product that has free shipping assigned, but the free shipping might only be for customers in the United Kingdom, I want to tick the box in the product set-up page to offer free shipping for that item or items only, but restrict it to the UK mainland only.

Any ideas?

Thanks

Chris

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 » Thu May 19, 2011 12:14 pm

pitorian wrote:Works like a charm,
You see... that's where you're supposed to stop, or continue with plattitudes relating to my greatness, "Ninja" coding skills :ugeek:

...but no... You had to ruin it didn't you :evil: ... ;) :lol:
Just need to restrict the countries that the free shipping shows for,

This happens if they select a product that has free shipping assigned, but the free shipping might only be for customers in the United Kingdom
It's probably going to be "reasonably" easy to add in a routine that checks whether the item has free shipping but there's something worth remembering here.

1. The cart won't know if the person is actually valid for free shipping until they input the shipping address
2. The cart won't know that unless the person has actually logged in with a registered account
3. Even then the customer may intend to ship the order to Alaska.


... So, taking this into account you start to realise why Interspire coders took the easy road (well, I'm sure that lot was some of it).

What the routine would need to do is provide a different label for free shipping that said "Free shipping for customers in the UK"... No idea how feasible that is, but you wouldn't want folks going "Ooh free shipping" then plugging Alaska into the shipping data and wondering where it went. Common sense need not apply when it comes to customer expectations.

I want to tick the box in the product set-up page to offer free shipping for that item or items only, but restrict it to the UK mainland only.
This would be a LOT harder purely and simply because every new field going into the product admin system ends up requiring the editing of numerous different files, including the jquery/javascript checking stuff which is more Tony Barnes thing than mine.

If Interspire had provided information on how to use their API we'd be laughing. Why they abandoned it like a hot potato is beyond me because it would have made the cart really kick ass (well once the bugs were resolved)... but hey ho, we don't even get documentation on add-ons or how to create custom modules... Such is life...

Basically, part 2 of that request...
*sound of feet running away with a trailing AAAAaaaaggghhhh*

Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: [MOD] Stop Free Shipping dropping other options

Post by Tony Barnes » Fri May 20, 2011 4:40 pm

You could script it to geocode for the free shipping, but would be a headache for reasons outlined - ordering for another country. Simply stating "UK ONLY" should be sufficient, we do it on ours, seems to work ok.

Hmmm, though I guess if you were to have a product with free shipping in the cart, it wouldn't be too hard to hook on to the country information (if 1 page checkout) and simply hide the free shipping option. JUST TRIED THIS - pain in the ass... lots of javscripts firing all over the shop, not as easy as I thought... but certainly must be doable

Something like:

Code: Select all

$(function() {
	if ($('select.FormField_23 option:selected').val() !== 'United Kingdom') {
		$("span:contains('Free')")parent().parent().hide();
	};
});
firing at the right time should do it for my current config


If using the multipage, then I guess you'd have to pull info from the post.

pitorian
Posts: 31
Joined: Mon Aug 17, 2009 9:55 am

Re: [MOD] Stop Free Shipping dropping other options

Post by pitorian » Sat May 21, 2011 12:37 pm

Thank you for the valuable feedback, how do I amend the Free Shipping to say "Free Shipping - UK Mainland Only" in the class file? or is there another file I should edit that tag?

One last question, I want to include a shipping information panel, to the left of the options to display the terms and delivery times, I did come across a post regarding this, and have lost it, typical.

Thanks

Chris

Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: [MOD] Stop Free Shipping dropping other options

Post by Tony Barnes » Tue May 24, 2011 4:33 pm

I can't remember for love nor money I'm afraid - I changed it in about 7 places before it actually took hold, that's all I remember !!! Sorry

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 » Wed May 25, 2011 11:26 am

Tony Barnes wrote:I can't remember for love nor money I'm afraid - I changed it in about 7 places before it actually took hold, that's all I remember !!! Sorry
Just had a look... It seems that there's a LOT of language instances for Free Shipping to occur.

The files to edit are:
/language/en/common.ini (1 change)
/language/en/front_language.ini (10 changes)

Note: Do NOT change the line (in front_language.ini):

Code: Select all

SearchLangFreeShipping = "freeshipping"
... as that would break the search functionality

You can locate all the bits to change by searching for "FreeShipping" and then adjusting the text in quotes to suit.

Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: [MOD] Stop Free Shipping dropping other options

Post by Tony Barnes » Thu May 26, 2011 11:02 am

Yeah, that's what I found - kept changing one, checking, screaming WTF, and searching again...!

pitorian
Posts: 31
Joined: Mon Aug 17, 2009 9:55 am

Re: [MOD] Stop Free Shipping dropping other options

Post by pitorian » Thu May 26, 2011 12:48 pm

Excellent that worked, I didn't find any in the common file, but changed the others, and works like a charm now.

Thanks Chris

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

Re: [MOD] Stop Free Shipping dropping other options

Post by chamster » Tue Jul 16, 2013 6:11 pm

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.

Any help would be greatly appreciated.

Post Reply