Jump to content

Resolved - Shipping method by weight: very odd


salvador21

Recommended Posts

I have set my Zone 1 (UK) prices for weight:

0.01:0,0.1:2.90,0.25:1.5,0.5:2,0.75:3,1.00:5,1.25:6,1.5:7,1.75:8,2:9,4:10,7:25

I must have made some stupid mistake, but I cannot fathom it out as it seems to skip the price for <1.25

e.g adding products to the basket

.96 kg is £5.00 (as it should be be)

BUT

1.080kg is£7 (it should be £6)

can anyone see what I've done wrong please?

Link to comment
Share on other sites

This is a "maybe" bug.

Here is your array before natsort():

0.01 : 0,

0.1 : 2.90,

0.25 : 1.5,

0.5 : 2,

0.75 : 3,

1.00 : 5,

1.25 : 6,

1.5 : 7,

1.75 : 8,

2 : 9,

4 : 10,

7 : 25

Here is the array after natsort():

"0.01:0"

"0.1:2.90"

"0.5:2"

"0.25:1.5"

"0.75:3"

"1.00:5"

"1.5:7"

"1.25:6"

"1.75:8"

"2:9"

"4:10"

"7:25"

natsort() is not perfect, and is really unreliable when the array it is sorting has wildly variable string lengths.

So there are two approaches you can take: Make the band:cost strings identical, or do not use natsort().

Try this as your band:cost string:

0.01:00.00,0.10:02.90,0.25:01.50,0.50:02.00,0.75:03.00,1.00:05.00,1.25:06.00,1.50:07.00,1.75:08.00,2.00:09.00,4.00:10.00,7.00:25.00

You will notice that the bands are all #.## and the costs are all ##.##.

OR

In the By_Weight folder, open the file shipping.class.php for editing with a programmer's text editor.

Near line 25, find:


natsort($bands);





Place two hashes in front, making it a comment.



## natsort($bands);

Thank you for including sample data for an input and a description of your observations on Cubecart's behavior. It helped pin-point where to look in the code.

Link to comment
Share on other sites

Thanks. I didn't understand much of what you said (ie I don't know what natsort is, but I understand that if I use a consistent number format

xx.xx:xx.xx then all will be well. And so it is now I have this:

00.01:00.00,00.10:02.90,00.25:01.50,00.50:02.00,00.75:03.00,01.00:05.00,01.25:06.00,01.50:07.00,01.75:08.00,02.00:09.00,04.00:10.00,07.00:25.00

(again, I am unable to "Like This" to your helpful post, forum says I have used my quota of votes, even though i haven't voted)

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