Jump to content

Archived

This topic is now archived and is closed to further replies.

Jackal1983

Resolved - Default Shipping Method

Recommended Posts

Hello,

 

I have two postage options available to customers. Weight and Collection from store.

The problem i have is collection from store is default so when people fly through the order process they dont get charged for postage because it says collection from store even which then makes postage free.

 

How do i make it so 2nd class is default in the drop down box.

 

Kind Regards

 

Jack

Share this post


Link to post
Share on other sites

I believe in the shipping gateway control panel that you want as default, you set the box, "Make Default". I'll double-check on that.

Share this post


Link to post
Share on other sites

Yes i would of thought that as well but i cant see anything anywhere to make a default select in the drop down box!

Share this post


Link to post
Share on other sites

Double-checked.

 

No, there isn't a "Make default" setting for shipping modules as there is with payment gateway modules. The reason...

 

CubeCart (I believe) sorts the list of shipping modules according to the cost of the shipping -- with the least expensive listed first -- as any shipping option that shows up in the list is a legitimate shipping option according to any restrictions that may be in effect.

 

So, we can talk about how to sort the shipping options differently, or add a --Please Select-- option as the default option. Unfortunately, shipping module Allowed Zones settings are too broad in this case (whole countries), otherwise you could set a list of postal codes you would allow for the Pick-up option.

 

Now, I think this shipping module could be enhanced to do just that -- allow for a list of postal codes to be included as a legitimate shipping option.

 

On the other hand, CC520 promises a All-in-One Shipping module (which I haven't looked at yet) that may do this.

Share this post


Link to post
Share on other sites

Thankyou Bsmither.

 

At the moment i could do with just getting a "Please Select" as a default and if not selected a warning comes up at the top of the screen.

 

Would you be able to advise how i could do this?

 

Kind Regards

 

Jack

Share this post


Link to post
Share on other sites

In the file cubecart.class.php at around line 1394, find:

                // Lets try to choose cheapest shipping option
                // for them if they haven't chosen already
                if (!isset($this->_basket['shipping']) && !$digital_only) {
                    foreach ($shipping_values as $value) {
                        if (!isset($cheapest['value']) || $value['value'] < $cheapest['value']) {
                            $cheapest = $value;
                        }
                    }

Try this:

On the same line as where you see the foreach statement, at the end of that line, add break; and that will cause the loop to be abandoned. The variable $cheapest will be empty and the shipping choice will not be set. It will stay not set until the customer makes a choice.

 

The skin template for this part of the checkout process requires a response.

Share this post


Link to post
Share on other sites

Thankyou very much for your time and help!!

 

This little mod has words a treat!!!

 

Kind Regards

 

Jack

Share this post


Link to post
Share on other sites

i think this modification might be causing me some problems.

 

Im getting this error message

 

The following errors were detected:

  • Unfortunately there are no suitable shipping methods available for your order. This may be because the total weight of your order is too high or we cannot ship to your country. Please contact a member of our staff for any further inquiries.

when you click checkout a few times it goes through and all is fine...

 

Any Ideas?

Share this post


Link to post
Share on other sites

Yes the issue is the Break is making it turn that error.

 

Would it be possible to select a dearest shipping method first?

 

Jack

Share this post


Link to post
Share on other sites

Jack, did you ever get a successful resolution to this problem? I've got exactly the same issue on a site I am managing. Customers requiring delivery are going through the ordering process with with 'collect from store' selected and not getting charged for delivery. We've only got the two options - free collection or flat rate delivered, so the ideal thing would be to make the most expensive one the default not the cheapest one. Should be a fairly simple tweak in the scripts. 

Share this post


Link to post
Share on other sites

Would it be possible to change it from a drop down box to a list with check boxes, so customers would see all choices before making the selection? Of course that would only be practical in situations you have described with a very limited number of choices.

Share this post


Link to post
Share on other sites

To switch the shipping drop-down selector to a radio-button list (using the Kurouto skin as an example), in the file content.checkout.php, remove:

        <select name="shipping" class="update_form required">
          <option value="">{$LANG.form.please_select}</option>
          {foreach from=$SHIPPING key=group item=methods}
          {if $HIDE_OPTION_GROUPS ne '1'}<optgroup label="{$group}">{/if}
              {foreach from=$methods item=method}
            <option value="{$method.value}" {$method.selected}>{$CUSTOMER_LOCALE.mark} {$method.display}</option>
            {/foreach}
          {if $HIDE_OPTION_GROUPS ne '1'}</optgroup>{/if}
          {/foreach}
        </select>
And replace it with:
        <div class="update_form required price" style="display:inline-block;text-align:left;">
          <span style="font-weight:bold;">{$LANG.basket.shipping_select}</span>
          <ul style="list-style-type: none;">
          {foreach from=$SHIPPING key=group item=methods}
          {foreach from=$methods item=method}
          <li style="padding-left:14px;"><input name="shipping" type="radio" value="{$method.value}" {$method.selected|replace:'selected':'checked'} />{$CUSTOMER_LOCALE.mark} {$method.display}</li>
          {/foreach}
          {/foreach}
          </ul>
        </div>

In the file /js/common.js, near line 106, find:

$('select.update_form').change(function(){

Remove the word select.

Share this post


Link to post
Share on other sites

Thanks. That tweak seems to have successfully switched to making the shipping options fully visible as a set of radio buttons. Really, even with better visibility of the choices now in place, it would still be good to tweak the scripts so that the most expensive option is the default choice, not the free option. That's obviously a deeper mod - is it something I should be posting on the third party developers forum rather than here on this forum?

Share this post


Link to post
Share on other sites

In Post #6, where this comparison is made:

if (!isset($cheapest['value']) || $value['value'] < $cheapest['value']) {

 

Switch the less-than sign to a greater-than sign.

 

Just leave the name of the variable alone. Don't try changing it from $cheapest to $most_expensive, or anything.

 

Sure, we can get slightly more involved by adding an admin setting to:

sort the shipping by cost ascending, descending, or as however else the gateways get processed.

pre-select the shipping cost by the cheapest, most expensive, or no selection.

Share this post


Link to post
Share on other sites

Thanks. Have just implemented and tested it. That is exactly what was needed and will fix the problem very well I think. Thanks for the support.

Share this post


Link to post
Share on other sites

I have run the radio button mod to show my two shipping choices, 1st class or 2nd class postage. i have used your mod in #15 to get the default to 1st Class.

what I would like to have now is to swap the options around so that it looks like this

1st Class postage

2nd Class postage

Currently 2nd class is listed above 1st class.

Share this post


Link to post
Share on other sites

In the file cubecart.class.php, near line 935, find:

uasort($packages, 'price_sort');

Place // in front of that line.

 

This (hopefully) will remove any sorting by price with respect for each shipping module. That is, if a module returns several options, those options will remain in the order they were calculated.

 

Getting a more comprehensive sort by whatever will take some more time to figure out.

Share this post


Link to post
Share on other sites

I don't know what's wrong with my mind lately!

 

It's cart.class.php, and for CC528, it's line 930.

Share this post


Link to post
Share on other sites

Many thanks, that has given me exactly what I was after. You have come up with the goods again , as usual, many thanks.

Share this post


Link to post
Share on other sites

×