Thursday, November 7, 2013

Now that you've created that handy dandy panel, and have taken care of the most common problem that those of you who want to have a Wholesale and Retail group we can tackle shipping methods. If you created a panel for your Javascript this will be much easier that trying to find the script and entering it in.

**This is for a single Shipping Zone with multiple shipping methods**  Each method in the HTML ends with an underscore and a number like this: _0 or _1 to figure out what these are you can use your browsers developer console. So, in the example script below I have four shipping options beginning with 0 and going to 3. For wholesale groups I want to hide 0-2, but for retail groups I want to hide. I've also added it to the pre-existing script in the panel so that the complete script now looks like this:

<script type="text/javascript">
$(document).ready(function()
{
// Begin WholeSale Group COD payment Method display
if($('a[href$="/wholesaler-information/"]').length > 0) {
$("#checkout_provider_checkout_cod.PAYMENT_PROVIDER_OFFLINE,input.PAYMENT_PROVIDER_OFFLINE").show();
$(".ProviderNamecheckout_cod").show();
//Shipping Method Display
hideForZone(0);
hideForZone(1);
hideForZone(2);
}
else {
hideForZone(3);
}
});
function hideForZone(digit) {
$('.ShippingProviderList input[id$="' + digit + '"]').hide();
$('.ShippingProviderList label[for$="_' + digit + '"]').hide();
}
 </script>

1 comments:

Dan Wich said...

This should also be useful for membership based shipping options.