The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

General shipping confusion

lithiumdavelithiumdave Member
in Help edited June 2009
Wonder if anyone can help a confused newbie...

I need to basically provide 2 options for shipping - a basic flat rate for each product, and a higher-priced 'next day delivery' option for each product. The 2 options will be the same for all products in the store.

I'm based in the UK so none of the pre-set shipping companies (UPS, etc) apply to me. We'll probably be using the Royal Mail here in the UK.

Can anyone help me figure out what I need to do - I have to admit I'm completely confused!

Thanks for any help in advance.
«1
Comments
  • Though just thinking ahead, it is also possible we'll be needing to add other rates for overseas orders too in future... in case that affects the advice given :)
  • And also - we do have UPS and DHL here in the UK so if it'll be best to use one of those, will setting them up via Foxycart here still be valid for UK shipping?

    That's it for questions, sorry.
  • Trying to help myself I've got so far... in 'Shipping' settings I've set 'custom' for domestic shipping and checked 'free ground shipping' (that doesn't seem right, but I can't save the form without choosing one of the options?). Then in the default category (I haven't set up any other categories) I've set 'Shipped using a flat rate fee', set a flat rate amount and set it to be per product.

    However, shipping isn't being applied when I add any item to the shopping cart, it's just zero. What am I doing wrong?

    I feel so stupid :(
  • OK, been having another re-think. What we need to do is basically have the ability to have 2 shipping options for the entire order (regardless of number of items) - 1 price for 3-5 days, and 1 price for next day delivery.

    So the questions I guess I'm asking are (you can ignore my previous posts in this thread):

    1. How do I create an option for someone to choose from '3-5 days' or 'next day' for the total shipping price?

    2. How do I get even my single shipping option for the default category to appear on the live site? No matter what I do shipping is still zero at checkout.

    Sorry for the many posts, just desperately trying to get sorted out for an urgent launch. Any help really really appreciated.
  • For #1, I've tried inserting rwbaker's code from the bottom of this forum post into my checkout template (and re-cached and re-saved) but the shipping options don't appear anywhere in the checkout either.

    Still keeping on trying...
  • For #2, I've also noticed that my tax/VAT is showing as 0, even though I've set it at 15% in 'Taxes' in the admin panel. Maybe that's a clue as to why my shipping is showing as 0 too?
  • brettbrett FoxyCart Team
    Hi Dave.
    This stream of consciousness approach to forum posting is a lot of fun ;)

    So what I'd recommend would just be to use FedEx or UPS and set up both Ground and Next Day as your options. Also make sure you choose some international options (perhaps a few), and keep in mind that not all methods are available to all locations, so it's generally better to err on the side of more shipping options than less, otherwise nothing will show and your customers won't be able to check out.

    As far as things showing or not showing: where are you looking? The taxes and shipping are entirely dependent on the customer's location, which isn't known until they enter it on checkout, so those pieces aren't shown until checkout.

    Does all that make sense?
  • Hi Brett - sorry about the stream of consciousness! Yeah, I just was desperately trying to figure out a solution.

    OK - they actually definitely don't want to use UPS or FedEx (on my checking the various options out with them), they just to have 2 flat options as I described.

    As for my point #2, Shipping and tax aren't showing at all, even when filling out all the details in checkout.

    Can I whisper the URL to you to have a look? I'm desperate to get this site live!

    Thanks again for your help so far.
  • Hi Brett - I've got my #2 issue sorted (showing tax and flat-rate shipping cost)...

    In my FoxyCart admin panel, under 'Categories', the 'select a category' dropdown menu has 2 'Default for all products' options. Why, I've no idea, I didn't realise there were 2 till I just checked. I chose the 2nd one, then added tax and shipping to that, then saved and everything's now ok - tax and shipping showing up at checkout.

    Phew!

    Just #1 to go now... desperately trying to sort out giving the customer 2 flat-rate shipping options at the checkout stage, without using UPS or FedEx live rates. I'll keep at it in the meantime.

    The code in the forum post I pointed to should work, it seems, but nothing shows up in my checkout page (despite caching and saving). I guess it should be putting a couple of radio options before the delivery and sub-total box?
    <script type="text/javascript">
    $j(document).ready(function(){
    $j("ol#fc_shipping_list").before('<div id="fc_shipping_methods_container" class="fc_row fc_shipping_methods_container">
    <label for="fc_shipping_methods" class="fc_label_left fc_shipping_methods">
    Shipping Methods
    </label>
    <div id="fc_shipping_methods" class="fc_radio_group_container fc_row fc_shipping_methods">
    <input name="shipping_service_id" id="shipping_service_id" value="0" type="hidden"><input name="shipping_service_description" id="shipping_service_description" value="" type="hidden">
    <div id="fc_shipping_methods_inner">
    <label class="fc_label_radio" for="shipping_service_1">
    <input name="shipping_service" checked="checked" id="shipping_service_1" value="1|3.95" class="fc_radio fc_required" onclick="FC.checkout.updatePrice(-1)" type="radio"><span class="fc_shipping_carrier"></span>
    <span class="fc_shipping_service"> Standard Shipping</span>
    <span class="fc_shipping_cost"><span class="fc_currency_symbol">$</span>3.95</span>
    </label>
    <label class="fc_label_radio" for="shipping_service_2">
    <input name="shipping_service" id="shipping_service_2" value="2|13.90" class="fc_radio fc_required" onclick="FC.checkout.updatePrice(-1)" type="radio"><span class="fc_shipping_carrier"> Warm Weather Shipping</span>
    <span class="fc_shipping_service"></span>
    <span class="fc_shipping_cost"><span class="fc_currency_symbol">$</span>13.90</span>
    </label>
    </div>
    <label for="fc_shipping_methods" class="fc_error" style="display: none;">
    Please select a shipping method.
    </label>
    </div>
    </div>');
    });
    </script>
    

    Any help appreciated - thanks.
  • Just also found out from the client that actually they want other options too:

    Europe -
    USA/Canada
    Rest of the World

    each with a fixed price... sigh...

    If I can get the above code working and showing, surely I can add the Europe, etc. options to it? I don't fancy the javascript conditional to loop through the country options....
  • brettbrett FoxyCart Team
    Hi Dave.
    Out of curiosity, why won't UPS or FedEx work? Different countries are going to be _radically_ different rates, particularly in that vague "rest of world" section. Using live rates will ensure that the customer never overpays and that the merchant is never left holding the bill. Or at least it will minimize the risk.

    As far as that code you posted, you're using v051, which uses jQuery without the no-conflict mode, so change the $j to $, but you'll have to make other changes as well. Because that code is advanced (and because we've got so much to do to make FoxyCart better) we can't offer much support on it. But that's the first thing you'll need to do.

    It sounds like with your two "default" categories that one is perhaps a duplicate of the default. Can you delete one of them to avoid confusion down the road?
  • AndrewAndrew Member
    edited June 2009
    Hi dave, Not sure if this'll help much, but what I did was use this:

    http://wiki.foxycart.com/docs:checkout:javascript

    To replace their shipping function with my own, and then create a custom field select box with all the options in it. So I basically set shipping to "flat rate: 0.00" and made the whole thing a custom field, as I'm also based in the UK and need the same shipping options(well, almost. Uk first class, Uk second class, EU, Rest Of World, and they change price depending on quantity as well).

    Hope that helps. Can post (messy)code if you want.

    Andrew

    EDIT: Just remembered, I replaced their updatePrice function with my own as well...
  • Cheers Brett - thanks for the pointers, I know it's not under the remit of general support. Appreciate your help.

    Andrew - thanks also for your help, that's definitely the way I needed to go. I eventually hired in a friend to help, he wrote the following which for my situation works a treat. I'll post here in case anyone else needs it.

    --
    <script type="text/javascript">
    	function SetShippingPrice(shippingPrice)
    	{
    		$("#shipping_cost").val(shippingPrice);
    
    		var total = Number(shippingPrice) + Number($("#subtotal").val());
    		$("#order_total").val(FC.formatter.currency(total));
    
    		OverridePriceDisplay();
    	}
    
    	function CreateUKPriceOptions()
    	{
    		$("#shipping_cost").after('<div id="ukpriceoptions"><ul><li><label for="ukoption1">&pound;3.95</label><input type="radio" id="ukoption1" name="ukprices" value="3.95" checked="checked" /></li><li><label for="ukoption2">&pound;5.95</label><input type="radio" id="ukoption2" name="ukprices" value="5.95" /></li></ul></div>');
    
    		SetShippingPrice($("#ukpriceoptions input:checked").val());
    
    		$("#ukpriceoptions input").change(function() { SetShippingPrice($("#ukpriceoptions input:checked").val()); } );
    
    	}
    
    	function RemoveUKPriceOptions()
    	{
    		$("#ukpriceoptions").remove();
    	}
    
    	function OverridePriceDisplay()
    	{
    		var subtotal=FC.formatter.parseCurrency(jQuery("#subtotal").val());
    		var tax=0;
    		var shipping=parseFloat($("#shipping_cost").val());
    		var total;jQuery(".fc_taxes").each(function(){tax+=FC.formatter.parseCurrency(this.value);});
    		jQuery(".fc_shipping").each(function(){shipping+=FC.formatter.parseCurrency(this.value);});
    		total=parseFloat(subtotal)+parseFloat(tax)+parseFloat(shipping)-parseFloat(0);
    
    		jQuery("#shipping_cost").val(FC.formatter.currency(shipping));
    		jQuery("#tax").val(FC.formatter.currency(tax));
    		jQuery("#order_total").val(FC.formatter.currency(total));
    		jQuery("#fc_cart_foot_shipping td.fc_col2").html(FC.formatter.currency(shipping,true));
    		jQuery("#fc_cart_foot_total td.fc_col2").html(FC.formatter.currency(total,true));
    
    		//updateTaxDisplay();
    	}
    
    	function SetDeliveryPrice()
    	{
    		var europeanCountries = new Array("italy", "spain", "france")
    		var location;
    
    		if ($("#use_different_addresses:checked").val() == undefined)
    			location = $("#customer_country_name").val();
    		else
    		 	location = $("#shipping_country_name").val();
    
    		RemoveUKPriceOptions();
    		if (location.toLowerCase() == "united kingdom")
    		{
    			CreateUKPriceOptions();
    		}
    		else if (location.toLowerCase() == "united States" || location.toLowerCase() == "canada")
    		{
    			SetShippingPrice("22.00");
    		}
    		else if (($.inArray(location.toLowerCase(), europeanCountries) > -1))
    		{
    			SetShippingPrice("12.50");
    		}
    		else
    		{
    			SetShippingPrice("29.00");
    		}
    	}
    
    	$(document).ready(function()
    	{
    		SetDeliveryPrice();
    	});
    
    	FC.checkout.override("updateShipping", "SetDeliveryPrice");
    	FC.checkout.override("updatePriceDisplay", "OverridePriceDisplay");
    </script>
    
  • lukeluke FoxyCart Team
    Wow. you guys are my heros.

    When we first wrote the override and overload methods, we didn't publicize them because, honestly, our checkout javascript needs a lot of work. I think it started as a proof of concept a couple years ago and we just kept adding stuff to it. :) We're hoping to organize this a lot better in the future so you will only have to override very specific pieces. Right now things are too tightly coupled and overriding one method might cause something else not to function correctly. Please keep that in mind as you play with override and overload since it may make upgrading in the future a little difficult as we change things.

    Really happy to hear it's worked out for you guys though. Very cool stuff.
  • Excellent! Makes all my earlier stream of consciousness posts worthwhile :)
  • Hi Luke - sorry to drag up this thread again but I've only just discovered that it's actually not working, and would REALLY appreciate some help in getting it sorted :)

    It's all working ok on the front-end: visitor can change their postage costs and the choice updates the displayed shipping cost and the total cost. However, it's not being passed through to the payment, still the postage is just being passed as £3.95 (which is our default shipping cost in the admin CP that we're kind of overriding with the js here).

    Can you tell me what I need to change in my js in this thread a couple of messages ago in this thread? The friend who helped me is on holiday this week - aaarrggh!

    Thanks so much for your help in advance.

    Dave
  • To clarify, apparently it's just the 2nd of the 2 UK options (£5.95) that isn't being passed to the cart, the other country options are being passed through fine (I think... I could be wrong...)
  • lukeluke FoxyCart Team
    When you say your default shipping cost, what do you mean? Do you have a flat rate configured? If so, things could get strange. Unfortunately, all of this is unsupported stuff, so it's hard for us to say either way what should be done.

    I tired to pull up your site and it's just hanging on me... sorry I can't do more.
  • lukeluke FoxyCart Team
    Ok, got the site to pull up after a while. You're getting a 404 on your print.css which you'll definitely want to fix because it's being referenced via HTTP which is also throwing browser security warnings. You probably should remove that until you get it fixed. As for the shipping rates, I'm not seeing any rates come through at all off the bat which means you probably configured flat rate shipping on your category which will cause you some problems, I think.
  • Hi Luke - thanks so much for the reply. Ref to print.css removed for now, thanks for picking that up.

    You're right, I do have a flat rate configured for the category (just default for all products). I'm trying to use javascript to allow the visitor to set their own shipping rate (we need to provide UK visitors with 2 flat-rate options - next day delivery or standard delivery). What happens is that, with the code I have, no matter which radio button option they choose in the Checkout page, the resulting checkout is still just the flat rate configured for the category.

    I've now gone in and removed that for the category (i.e. No Shipping) but it doesn't seem to have made any difference at all. Just put through a test transaction and the chosen radio button delivery is still not being passed through.

    Do I need to re-cache my checkout template?

    Thanks for your continued help.
  • lukeluke FoxyCart Team
    Since you are doing shipping, you probably need to set your flat rate to $0. With any delivery type other than "shipped" you won't have shipping fees. So set your flat rate to $0 and use your custom stuff and you should be good to go as long as you have code in there that ensures your custom stuff has been called. You'll probably need to override the submit action for that form and call your own custom validation instead (to ensure they picked a shipping option, if one is displayed) and only after it passes that validation would you want them to submit it. Hope that makes sense.
  • Hi Luke - I've gone in and set shipping to a flat rate of zero (rather than no shipping at all) and carried out another test transaction. Still the same issue - even if I choose the higher rate I have set (via the radio button on the checkout page), the lower rate is still being passed as payment.

    I have no idea what the javascript my friend wrote is doing so I guess I'll have to wait for him to return from holiday :(

    Thanks for your help and advice.
  • lukeluke FoxyCart Team
    Which lower rate are you referring to? If the shipping cost input field is updated when you click the radio button, that's what it should be sending... but yea, your best bet is probably to wait for your developer or create your own test store and start going to town learning JavaScript. :)
  • David_AusDavid_Aus Member
    edited July 2009
    Luke,

    Been working with lithiumdave's posted script (thanks for posting it) to achieve a similar solution here is Aust.

    Current state of my script posted below. A couple of issues outstanding that I am trying to work through:
    1. Radio Buttons not being produced as I expect they should (not a big issue for me and will likely remove this function).
    2. I can get one or the other (Tax or Shipping) to function properly but not both together. I suspect the OverridePriceDisplay is also overriding the tax calculation. I don’t believe this should be happening and ideally would like to have the OverridePriceDisplay not impact the Tax reckoning (as it functions properly in absence of the OverridePriceDisplay) but can’t see how to exclude it. Trying to avoid having to override TaxDisplay etc as well. Tax reckoning requirements are a bit different from the UK position. Foxycart setup delivers correct determination if I delete the Override functioning so really just want to allow it do its thing but have the OverridePriceDisplay deliver the modified shipping calculations.

    Any assistance or pointers greatly appreciated.

    Cheers,
    David

    <script type="text/javascript">
    function SetShippingPrice(shippingPrice)
    {
    $("#shipping_cost").val(shippingPrice);

    var total = Number(shippingPrice) + Number($("#subtotal").val());
    $("#order_total").val(FC.formatter.currency(total));

    OverridePriceDisplay();
    }

    function CreateAUSTPriceOptions()
    {
    $("#shipping_cost").after('<div id="austpriceoptions"><ul><li><label for="austoption1">$15.00</label><input type="radio" id="austoption1" name="austprices" value="15.00" checked="checked" /></li><li><label for="austoption2">$25.00</label><input type="radio" id="austoption2" name="austprices" value="25.00" /></li></ul></div>');

    SetShippingPrice($("#austpriceoptions input:checked").val());

    $("#austpriceoptions input").change(function() {SetShippingPrice($("#austpriceoptions input:checked").val()); } );

    }

    function RemoveAUSTPriceOptions()
    {
    $("#austpriceoptions").remove();
    }

    var OverridePriceDisplay=function()
    {
    var subtotal=FC.formatter.parseCurrency(jQuery("#subtotal").val());
    var tax=FC.formatter.parseCurrency(jQuery("#tax").val());
    var shipping=parseFloat($("#shipping_cost").val());
    var total;jQuery(".fc_taxes").each(function(){tax+=FC.formatter.parseCurrency(this.value);});
    jQuery(".fc_shipping").each(function(){shipping+=FC.formatter.parseCurrency(this.value);});
    total=parseFloat(subtotal)+parseFloat(tax)+parseFloat(shipping)-parseFloat(0);

    jQuery("#shipping_cost").val(FC.formatter.currency(shipping));
    jQuery("#tax").val(FC.formatter.currency(tax));
    jQuery("#order_total").val(FC.formatter.currency(total));
    jQuery("#fc_cart_foot_shipping td.fc_col2").html(FC.formatter.currency(shipping,true));
    jQuery("#fc_cart_foot_total td.fc_col2").html(FC.formatter.currency(total,true));

    updateTaxes();
    updateTaxDisplay();
    }

    var SetDeliveryPrice=function()
    {
    var europeanCountries = new Array("united kingdom", "ireland", "germany", "italy", "spain", "france")
    var location;

    if ($("#use_different_addresses:checked").val() == undefined)
    location = $("#customer_country_name").val();
    else
    location = $("#shipping_country_name").val();

    //RemoveAUSTPriceOptions();
    if (location.toLowerCase() == "australia")
    {
    SetShippingPrice("15.00");
    }
    else if (location.toLowerCase() == "new zealand")
    {
    SetShippingPrice("30.00");
    }
    else if (location.toLowerCase() == "united states" || location.toLowerCase() == "canada")
    {
    SetShippingPrice("40.00");
    }
    else if (($.inArray(location.toLowerCase(), europeanCountries) > -1))
    {
    SetShippingPrice("50.00");
    }
    else
    {
    SetShippingPrice("50.00");
    }
    }

    $(document).ready(function()
    {
    SetDeliveryPrice();
    });

    FC.checkout.override("updateShipping", "SetDeliveryPrice");
    FC.checkout.override("updatePriceDisplay", "OverridePriceDisplay");
    </script>
  • Lithiumdave,
    Are you sure the OverridePriceDisplay component is functioning properly? I've been trying to get a variation (less freight options, more tax issues) functioning. SetDeliveryPrice and SetShippingPrice components seem okay but suspect the OverridePriceDisplay is not. If so this may explain why some of your amounts are not being passed through correctly. Note that what appears in Checkout fields may not always be what is passed through. I can't see why its not functioning but you can easily test by putting in some fixed figures and seeing if they flow through. I need to get taxes (GST on sub-total and shipping) recalculating properly but at this stage I don't think any of the OverridePriceDisplay is functioning.

    Luke, any known issues about running two overrides together? Just fishing as code would otherwise appear okay to my novice eye.

    Cheers,
    David
  • lukeluke FoxyCart Team
    Hey all. We've tried to use the words "hack" and "unsupported" whenever referencing the override and overload functions. The current state of the checkout javascript is not loosely coupled so it runs into issues if you override methods that actually do more "under the hood" than the method name may imply. At this point, we can't really support a lot of custom overrides because the underlying structure of the JavaScript will be changing from version to version (which might have an adverse affect on your customization).

    Your best bet is to vote for what you need here so we can make it a standard part of FoxyCart if there is enough need for it: http://requests.foxycart.com
  • Luke, I well understand the implications of attempting the Override option and not attempting it lightly but currently there don't seem to be any other options. Are there?

    I have voted (Supership - top ranked and planned status for >6 months) but absent a timeframe for availability have no option but to continue to pursue the Override option as Foxycart implementation is not practical for us without a multi flat rate shipping option. Understand you can't support detailed functionality questions but general guidance would be appreciated lest we invest time and money on misguided endeavours, or to have such efforts superceded by implementation of the planned Supership functionality. Please, some general guidance so we can work out how best to proceed with what is otherwise a fantastic product and solution.

    Best regards,
    David
  • Luke,
    I'm sure you guys have thought of this and guaranteed it's not as simple as it might first seem but occurred to me that flat rate shipping options functionality that leveraged off the same global/country/region/local framework as the Tax setup would provide great flexibility for all those not able to use the existing referenced rate functionality. Instead of setting a %age rate for tax would set a dollar rate (or better still a handling fee type setup) based on shipping country (as the Tax determination does). Would probably still need to sit within Categories to cater for different product types/sizes.

    Cheers,
    David
  • lukeluke FoxyCart Team
    Hey David. Brett and I have some whispers going on behind the scenes about this one. What you're describing is basically what we want to do with SuperShip. As it stands right now, we have to focus on our current commitments first which are coming out in the next version (Paypal Express, UK debit cards, true guest checkout, etc).

    That being said, see if this will work for you:

    function updateMyShippingCost() {
    var europeanCountries = new Array("GB", "IE", "DE", "IT", "ES", "FR");
    // set your default here:
    var shippingCost = 50;
    var country_code = (jQuery("#use_different_addresses").is(":checked") ? $("#shipping_country").val() : $("#customer_country").val());
    switch(country_code) {
    case "AU":
    shippingCost = 15;
    break;
    case "NZ":
    shippingCost = 30;
    break;
    case "US":
    case "CA":
    shippingCost = 40;
    break;
    default:
    if (jQuery.inArray(country_code,europeanCountries) > -1) {
    shippingCost = 50;
    }
    }
    FC.checkout.config.orderFlatRateShipping = shippingCost;
    }
    jQuery("document").ready(function(){
    FC.checkout.overload("updatePriceDisplay", "updateMyShippingCost", null);
    });

    We probably need to spend more time improving FoxyCart and less time doing JavaScript hack solutions in our forum... but we understand how hard it can be when you need to move a project forward but you don't have the tools you need to make it happen. Hopefully this will serve you and others until we can get a true built in solution with SuperShip.

    Be sure to tell your friends FoxyCart cares about you. :)
  • Luke,
    Sensational, thank you, way more than I expected. Solution works fine. Should now be able to go live in the next few days with a nice SSP/Foxycart integration.

    Thanks a million guys.
    Cheers,
    David
Sign In or Register to comment.