Jump to content

Resolved - Default Shipping Method


Jackal1983

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

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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?

Link to comment
Share on other sites

  • 4 months later...

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. 

Link to comment
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.

Link to comment
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?

Link to comment
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.

Link to comment
Share on other sites

  • 6 months later...

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.

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...