Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Free Shipping + Real Time Shipping Solution Rate Topic   - - - - -

 

Posted 23 October 2007 - 04:08 AM #1

I can't take credit for this, as my brother Matt is the developer. But I've seen a lot of people request a solution to the free shipping issue so I wanted to make sure we shared. It may not be the solution you need, but hopefully it will help some.

This comes from the fact that the two options available from CS-Cart don't meet my needs.

1. Using the Discount option, a customer can choose any shipping method and it will not charge them for this. This makes it impossible for them to "upgrade" to a better shipping option and is confusing

2. Setting a manual method with a very high shipping price for the price range that I don't want free shipping and $0 for anything above my threshold. (We'll use $99.00 for these examples.)Again... confusing to the customer, since I want to call it "Free Economy Shipping" and if they order a $5.00 part, it's going to say "Free Economy Shipping" but it's not free.

All that being said, here is the solution we have in place:

1. We configured a manual shipping method and called it "Free Economy Shipping"
2. In my case, we only offer free shipping for orders in the continental US, so we configured a shipping destination which included all states except AK and HI.
3. Then for that destination ONLY, we set a "Cost Dependency". Ours is "More than $0" is $0 and "More than $99" is $0. I don't think the threshold matters much as long as it's set to $0 for shipping. At this point, the system almost works. People in the Continental US will see an option for "Free Economy Shipping" at $0. The problem is that anyone can choose it regardless of whether their order is over $99. So...
4. Matt edited the "/skins/basic/customer/cart_pages/shipping_estimation.tpl" file. Around line 24 there is a line that reads:

{foreach from=$s_rate.rates key=key_id item=r}{math equation="x + y" x=$rate y=$r assign="rate"}{/foreach}


Below this line he added:

{* EDIT *}
{if $shipping_id == 12 && $cart.subtotal < 99}
{else}
{* /EDIT *}


The catch is that the 12 needs to be the shipping ID for the shipping plan that you want to be free.

Then there is a section that is enclosed in <p> </p>... below that add:

{* EDIT *}
{/if}
{* /EDIT *}


Also edit the /skins/basic/customer/cart_pages/shipping_rates.tpl file.

Around line 34, replace this line:

<option value="{$shipping_id}" {if $cart.shipping.$shipping_id}selected="selected"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</option>


with this:


{if $shipping_id == 12 && $cart.subtotal < 99}
{else}
<option value="{$shipping_id}" {if $cart.shipping.$shipping_id}selected="selected"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</option>
{/if}



After these changes, the Free Shipping method will only show up if the order is over $99. (So change that to whatever you use as your threshold.)

Since I didn't make this change, I'll have to forward any questions to Matt to answer. This was done on version 1.3.5 using the Basic template... Hope it helps.

 

Posted 13 November 2007 - 05:53 PM #2

I searched and search and could not find "shipping_estimation.tpl". Could you provide a specific location? I'm using version 1.3.5 basic skin as well. Thanks for your help. This is the exact solution I was looking for.

Also, where do I indicated a shipping ID (i.e. 12 in your example) on the shipping method page?

Thanks!
High quality pet products. For less.
NiftyPetStuff.com

 
  • techman
  • Senior Member
  • Members
  • Join Date: 12-Sep 07
  • 115 posts

Posted 13 November 2007 - 06:05 PM #3

This will be very cool. Thanks for sharing. Did you use this in 1.3.4 or 1.3.5 because as mentioned above, I can not locate the file specified. Please help here.
TechMAN,
No one knows it all, help others to help yourself

Advertise your site in Style - Free web Link Exchange
Web Bid Directory - Get Listed Now

 

Posted 13 November 2007 - 06:31 PM #4

I finally found it. It's located here:

/skins/basic/customer/cart_pages/shipping_estimation.tpl

That's for version 1.3.5, Basic skin.

I put that code in there, now I just can't figure out where I'm supposed to put the "Shipping ID". I can't find a space for it. If anyone knows, please post. Thanks-a-million!
High quality pet products. For less.
NiftyPetStuff.com

 

Posted 13 November 2007 - 07:09 PM #5

In my example above, the shipping ID was 12. Basically you have to create the Free Shipping Method and then check the database to see what ID the database assigned that particular shipping method. It increments by one each time you add a new shipping method, so you could probably use trial and error also. The shipping ID is hard coded into the code that you add to the .tpl file.

The only catch I have found so far is that if someone doesn't enter the state or the zip code, then it still displays the free shipping method without the other options. This is technically fine, but I would prefer to give my customers an option to pay for expedited shipping. Matt has that on his list to work on, and I'll post an updated once he addresses that. Let me know if you run into any other questions/issues.
1.3.5 about to make the switch...
Free Shipping + Real Time Shipping Mod

 
  • bholland
  • Senior Member
  • Members
  • Join Date: 16-May 06
  • 129 posts

Posted 13 November 2007 - 10:08 PM #6

Thanks for posting this code! Just read the post and I want to do something similar...I'll be stealing it in a few weeks for sure! :)
CS Cart 1.3.5 SP1

 

Posted 14 November 2007 - 04:35 AM #7

Thanks for the heads-up on how to find the shipping ID. For those who are wondering the same thing:

After I had created the free shipping method, I clicked on the "Shipping Methods" page and viewed the source (just like you view the source for any web site.

I looked through, and located where the code for the free shipping method was and it looked like this:

<tr class="manage-row">
<td width="1%">
<input type="checkbox" name="delete_shippings[15]" id="delete_checkbox" value="Y" /></td>
<td valign="top" align="center">
<input type="text" name="shipping_data[15][position]" size="3" value="0" class="input-position" /></td>
<td>

<input type="text" name="shipping_descriptions[15][shipping]" size="50" value="Free Economy Shipping" class="input-text" /></td>
<td>
<input type="text" name="shipping_descriptions[15][delivery_time]" size="30" value="7-10 days" class="input-text" /></td>
<td valign="top" align="center">
<input type="text" name="shipping_data[15][min_weight]" size="4" value="0.00" class="input-text" /> - <input type="text" name="shipping_data[15][max_weight]" size="4" value="" class="input-text" /></td>
<td align="center">
<select name="shipping_data[15][membership_id]">
<option value="">- All -</option>

</select>
</td>
<td align="center">
<input type="hidden" name="shipping_data[15][avail]" value="N" />
<input type="checkbox" name="shipping_data[15][avail]" value="Y" checked="checked" /></td>
<td class="side-padding" align="right">


<span class="nowrap"><a href="javascript: fn_redirect('admin.php%3Ftarget%3Dshippings%26mode%3Dupdate%26shipping_id%3D15')" class="text-button-link" onMouseOver="window.status='HREF=admin.php?target=shippings&mode=update&shipping_id=15 '; return true;" onMouseOut="window.status=''">Edit <img src="/skins/basic/admin/images/text_but_arrow.gif" style="width: 16px; height: 14px; border: 0px;" alt="" align="top"></a></span>

</td>
</tr>


If you'll notice, "shipping_id=15" along with all the other "shipping_data[15]". 15 is the key number for me. I plugged 15 as the shipping ID in the shipping_estimation.tpl file as intructed above and tested it out. Works like a charm! Thanks again for sharing the code, JerrysPaintball!
High quality pet products. For less.
NiftyPetStuff.com

 

Posted 14 November 2007 - 05:35 AM #8

I just ran into a problem...

The above method works when I click 'View cart' and then "estimate shipping". If it's under $75, the free shipping don't show up, if its over, it does.

However, when I go to the actual "Checkout" page, the free shipping shows up whether or not the subtotal is $75, which is my threshold.

Any Idea waht it might be? Thanks for your help!
High quality pet products. For less.
NiftyPetStuff.com

 

Posted 14 November 2007 - 06:03 AM #9

Indeed... it looks like he had to edit another template as well... the shipping_rates.tpl file.

Around line 34, replace this line:

<option value="{$shipping_id}" {if $cart.shipping.$shipping_id}selected="selected"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</option>


with this:


{if $shipping_id == 12 && $cart.subtotal < 99}
{else}
<option value="{$shipping_id}" {if $cart.shipping.$shipping_id}selected="selected"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</option>
{/if}


Let me know if that takes care of it for you and if so, I will update the main post above.

Thanks,
Johnathan
1.3.5 about to make the switch...
Free Shipping + Real Time Shipping Mod

 

Posted 14 November 2007 - 06:44 AM #10

That works like a charm - just perfect! Thanks!
High quality pet products. For less.
NiftyPetStuff.com

 

Posted 14 November 2007 - 12:27 PM #11

Great. I have updated he main thread above... glad it helped.
1.3.5 about to make the switch...
Free Shipping + Real Time Shipping Mod

 
  • coder
  • Senior Member
  • Members
  • Join Date: 19-Jun 07
  • 411 posts

Posted 14 November 2007 - 04:29 PM #12

Jesse,

This is an excellent solution.... pin it for others as ref.

CS-CART: version 4.9.1


 
  • davido
  • Junior Member
  • Banned
  • Join Date: 12-Oct 07
  • 6 posts

Posted 15 November 2007 - 01:33 PM #13

Hi Guys,

I am not a programmer, but edited all the lines of code and it seems to work great. The one isssue was i was noticing 0.00 shipping even though that option doesn's show in either the cart or the checkout. So I played around simulating orders and noticed that the user has to actually drop down the shipping choice and select an option for it to work. If they don't touch that area, even though it will show a rate, I will use the free shipping in the order.

I have changed both of the templates as described above. My freight option ID is "10" and my threshold is anything less than $50.

Glenn

www.914ink.com

 
  • architeach
  • Junior Member
  • Members
  • Join Date: 24-Mar 07
  • 29 posts

Posted 15 November 2007 - 02:38 PM #14

I have set up my site to offer free shipping for all orders of $50 or more. Maybe I am doing this wrong? After making the changes everythings works as it should except for the when I add my tax state to the shipping option as a destination. I have one destination setup for all of the USA minus AK, HI, and my tax state GA. I also have another destination set for just my state (GA) so the taxes will work correctly in CS-Cart. I am assuming this is still the way to setup taxes version 1.3.5 SP1 as it seems to be working correctly. The shipping option problem occurs when I add the Cost Dependences to the GA destination in addtion to the USA destionation. The shipping option in the cart and checkout begins to show $0.00 for orders UNDER $50 again. I rechecked and have redone the code in the files multiple times and still no luck. If I leave out the Cost Dependences for the GA destination everything works fine except my GA customers can't get the free shipping. Has anyone else had this problem or am I doing something wrong either with the destinations or the taxes? Any help would be greatly appreaciated.:confused:

 

Posted 15 November 2007 - 02:45 PM #15

davido,

Indeed, it looks like if you don't select a shipping method, then it defaults to the free one even though it's not displayed. I'll get Matt to take a look.

That's why a community is much better at reviewing and improving these sorts of things. Thanks for the catch.
1.3.5 about to make the switch...
Free Shipping + Real Time Shipping Mod

 
  • architeach
  • Junior Member
  • Members
  • Join Date: 24-Mar 07
  • 29 posts

Posted 15 November 2007 - 02:49 PM #16

davido,

Indeed, it looks like if you don't select a shipping method, then it defaults to the free one even though it's not displayed. I'll get Matt to take a look.

That's why a community is much better at reviewing and improving these sorts of things. Thanks for the catch.

Thanks a ton. It took me forever to figure out what was happening. I appreciate your help and the quick response.

 

Posted 15 November 2007 - 03:17 PM #17

The shipping issue is a little different. One suggestion I would make is to not include GA in two different shipping destinations. I have a destination for Alaska/Hawaii, one for TN, and one for Continental US which does not include Alaska, Hawaii or Tennessee. I seem to remember somewhere that including the same state in two different destinations can cause a conflict.

In testing your issue, I found two errors in my own configuration:

1. If you do not select a shipping method, it will not apply tax and default to the free shipping method (even though free shipping has a tax assigned to it). However, if I select a different shipping method, then it does apply tax to a TN order. Haven't tested a non-TN order yet. This issue may get fixed naturally when Matt looks for a way to keep it from defaulting to free shipping even if it's not selected. One quick fix could probably be to move the free shipping out of the #1 spot, if it's just defaulting to whatever is in the #1 spot. I'm just thinking out loud as I haven't tested this.

2. It seems to lump the tax amount into the shipping charge. Even though it totals correctly at the bottom, it will create confusion because the shipping cost on the invoice does not match the amount on the drop down. This may have to go to CS-Cart for a fix or there may already be a bug report for it. I don't currently have support paid up, so I may have to do that to get them to look at it.

If I'm not understanding your issue very well, please clarify if you can. I have a feeling you are seeing something a little different then what I am seeing.
1.3.5 about to make the switch...
Free Shipping + Real Time Shipping Mod

 
  • architeach
  • Junior Member
  • Members
  • Join Date: 24-Mar 07
  • 29 posts

Posted 15 November 2007 - 05:01 PM #18

I do not have GA in two different shipping destinations. I have one for the Continental US which does not include Alaska, Hawaii or Georgia. (Sorry I forgot the add Georgia to my previous post.) And then I have Georgia as its own destination. The Georgia destination is the only one associated with the tax. That seems to be working fine.

I have noticed that while in the cart page, when you change the State location to Georgia and click estimate it will update the shipping charges, taxes, and cart total as it should but not the Cart Contents view. The trick is that you have to then go back and click the update button on the Cart Contents section for the tax to be applied to the cart content view. So I don't think it is really a bug, you just need to update the Cart Content to apply the tax and show the little (Price, Quanity, Tax) box.

Moving the shipping option out of the #1 position didn't seem to change anything.

So, like you said, if Matt can get it to stop showing the "More than 0.00" for "0.00" option when you have more than one Cost Dependences set in the shipping, everything would be perfect! WOW does that run on sentence make any sense?

 

Posted 16 November 2007 - 03:03 AM #19

Hey Guys,

This is Matt here. I took a look at my brother's code again and found a solution to the problem that you all found. The first step is to make your free shipping option something other than the first option in the list. You can do that by going into your shipping methods and just changing the POS number to something higher. We decided to make it the last item on the list.

The next step is to change a little code in the shipping_rates.tpl. Around line 33, you will see the following code:

<option value="{$shipping_id}" {if $cart.shipping.$shipping_id}selected="selected"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</option>


You will need to modify this code to look like the following:

<option value="{$shipping_id}" {if !$cart.shipping && ($smarty.foreach.fee.first) || $cart.shipping.$shipping_id}selected="selected"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</option>


Basically what the above changes will do is make your free shipping show up later in the list AND automatically default to the first one on the list if you haven't selected anything.

So you might be thinking that you don't like this option because your free shipping option is last on the list and doesn't stand out in any way. We can change that too. :D

To change the color/style in the dropdown list, we can change that same code near line 33 of shipping_rates.tpl like the following:

<option value="{$shipping_id}" {if !$cart.shipping && ($smarty.foreach.fee.first) || $cart.shipping.$shipping_id}selected="selected"{/if} {if $shipping_id == 12}style="color:#369408;"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</option>


Notice the if statement that adds the style="color:#369408;". You can use any CSS in this style.

if you want to change the style of the free shipping option in the Estimate Shipping area (where the radio buttons are), then you can change the code near line 28 of shipping_estimation.tpl from this:

<input id="est_{$shipping_id}" type="radio" class="valign radio" name="shipping_id" value="{$shipping_id}" {if (!$cart.shipping && ($smarty.foreach.fee.first)) || $cart.shipping.$shipping_id}checked="checked"{/if} /> <label for="est_{$shipping_id}" class="valign">{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</label>


to something like this:

<input id="est_{$shipping_id}" type="radio" class="valign radio" name="shipping_id" value="{$shipping_id}" {if (!$cart.shipping && ($smarty.foreach.fee.first)) || $cart.shipping.$shipping_id}checked="checked"{/if} /> <label {if $shipping_id == 12}style=" font-weight:bold; color:#369408;"{/if} for="est_{$shipping_id}" class="valign">{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$rate}</label>


Again, notice the style that we added in. Remember to change out the shipping id if you are going to use this code, otherwise this may or may not work for you.

I hope this was clear and helps everyone out with the problem that was found. If you find any other bugs, just let us know and we will see about finding a solution!

Thanks
Matt
1.3.5 about to make the switch...
Free Shipping + Real Time Shipping Mod

 
  • knoxbury
  • Senior Member
  • Members
  • Join Date: 14-Jan 08
  • 483 posts

Posted 13 February 2008 - 08:36 PM #20

I followed the steps in this post exactly and ended up with zeros for all shipping options on the checkout page and no free shipping option on the shipping estimate page. Any idea where I might have gone wrong?