Jump to content

Postage Options sort order?


vidmarc

Recommended Posts

Is there any way of changing the order in which the postage prices are displayed for customers?

 

Although 1st Class is the first option in admin, 2nd Class is above 1st Class in the drop down menu.

 

Can we make 1st class the default option rather than 2nd?

Link to comment
Share on other sites

In the file /classes/cart.class.php, near line 923 (this is CC521, line 929 for CC522), find:

uasort($packages,'price_sort');

 

Add two slashes in front to make that a comment:

 // uasort($packages,'price_sort');

 

This will keep each individual shipping gateway's multiple results from sorting by price.

 

The next task is to not have CubeCart automatically pre-select the cheapest price (regardless where it may be in the list). In the file /classes/cubecart.class.php, near line 1445 (for CC521, line 1418 for CC522), find:

foreach ($shipping_values as $value) {

 

Make the line look like this:

foreach ($shipping_values as $value) { break;

Link to comment
Share on other sites

Thanks for this - it now lists "Please Select" rather than defaulting to 2nd Class, but the user now gets this 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.

 

 

Is there a way to default it to First Class?

Link to comment
Share on other sites

  • 3 weeks later...

Can anybody please help with this? Sorting shipping by the cheapest first is causing problems as customers are automatically using the cheapest which is surface mail with takes a month or longer to arrive.

I did what was suggested above but it didn't sort First Class/Airmail as the main shipping option, which is what we need by default.

Link to comment
Share on other sites

Unlike Payment modules, Shipping modules do not have a "Default" control panel setting.

 

Because every admin will enable and configure the shipping modules in a different order, an approach to sort by order they appear in the modules database table won't work either.

 

Then, within each shipping module, there can be any number of "Service"-based rates: Priority, First Class, Parcel, etc. Being able to pre-select a shipping module would solve nothing with respect to select a service as a default within the module. But actually, that is probably easier to code for a solution.

 

Which specific shipping module are you using that has this "First Class/Airmail" service?

Link to comment
Share on other sites

We are using the "By Weight" option. This means all items sent 1st Class are sent via Royal Mail 1st Class (UK) or Airmail( outside UK) and 2nd Class is 2nd Class UK and Surface Mail (outside the UK).<br /><br />However, we also use iPostParcels for larger shipments and we can find no way on including this as an option.<br /><br />Can this be combined with the "All In One Shipping" option? Would that help?

Link to comment
Share on other sites

I think we discussed iPostParcels not having a means for an external program (such as CubeCart) to make automated queries. (On their web site, they say, "At ipostparcels, our express delivery prices are calculated in real time by The UK Mail Group's superb delivery zone system which considers the weight, size and additional services of your order." UK Mail Group appears to be the parent organization. But I find no information, other than a brief mention of an API for iConsign, of the possibility of creating a Cubecart module for iPostParcels. They say, "Please contact your account manager to arrange access to the comprehensive documentation and implementation support services we can provide."

 

 

I would think that, if you have a rate chart, you could recreate that chart in All-in-One.

Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...

In the file /classes/cart.class.php, near line 923 (this is CC521, line 929 for CC522), find:

uasort($packages,'price_sort');

 

Add two slashes in front to make that a comment:

 // uasort($packages,'price_sort');

 

This will keep each individual shipping gateway's multiple results from sorting by price.

 

The next task is to not have CubeCart automatically pre-select the cheapest price (regardless where it may be in the list). In the file /classes/cubecart.class.php, near line 1445 (for CC521, line 1418 for CC522), find:

foreach ($shipping_values as $value) {

 

Make the line look like this:

foreach ($shipping_values as $value) { break;

 

This hack no longer works in version 6.0.1 and the script is completely different now. Is there a hook we can use to make this work?

If not, would you have a suggestion for a new hack?

 

TIA

Link to comment
Share on other sites

This line:

uasort($packages, 'price_sort');

for CC602 is line 946.

 

This line:

foreach ($shipping_values as $value) {

for CC602 is 1533, but that edit will no longer be used. Instead, where the $cheapest shipping rate would be saved in the basket, a logical false value will be used. Try, on line 1540:

Was:
if (!empty($cheapest)) {
 
Now:
if (!empty($cheapest)) { $cheapest = false;

I need to run a tracer on this to make sure I am right.

Link to comment
Share on other sites

Previously I had it so that none of the shipping methods were selected, so the customer had to actively select the shipping method rather than the cheapest be selected by default.

 

CC 6.0.1

 

 

Is the script we are working with still classes/cart.class.php ?

 

I ask because I am unable to find: if (!empty($cheapest)) {

Link to comment
Share on other sites

The code between CC5216 (near 1468) and CC602 (near 1540) is the same. So if your results are satisfactory in CC5216, then try the same edit in CC602.

 

I was concerned about the following test on $cheapest, because if that's empty(), the next test is to check the store setting of "allowing no shipping". If no shipping is not allowed, CubeCart displays a warning.

Link to comment
Share on other sites

It is on line 1466 of classes/cubecart.class in CC6.0.1

 

was:

foreach ($shipping_values as $value) { 

 

now:

foreach ($shipping_values as $value) { break;

 

Edited the warning to be more of a notice and that works well.

"Please note the following:

  • No Delivery Zone is currently selected. Please select the delivery option below. Be sure to check which delivery zone you fall into and select the appropriate option to be able to continue to the Checkout"

 

Will update to 6.0.2 most likely tonight as the site is live: www.topsoil4u.co.uk

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...