Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Shipping by weight, ZIP, and heavy products

Shipping by weight, ZIP, and heavy products 30 Jun 2017 11:43 #1

Hi, I'm stuck and I need to achieve the following:
- Shipping cost by ZIP (Ok)
- Shipping cost by weight (Ok)
- If the order amount is more than 150€ free shipping (Ok)
- If the order amount is more than 150€ and there are heavy products (from various categories) then the shipping cost is only for the weight of this heavy products. (Help needed)

I'm using Virtuemart and Advanced Shipping by rules v6.2.2
This is what I have so far:

For the first ZIP Zone:

Definition=ZONA1; Value=ZIP2 in list("04", "18", "23", "29", "14", "41", "11", "21")
Definition=PESO1; Value=0
Definition=PESO1; Weight<5; Value=4.9174
Definition=PESO1; 5<=Weight<10; Value=5.7438
Definition=PESO1; 10<=Weight<15; Value=6.157
Definition=PESO1; 15<=Weight<20; Value=6.9835
Definition=PESO1; 20<=Weight<30; Value=8.6364
Definition=PESO1; 30<=Weight<40; Value=10.2893
Definition=PESO1; 40<=Weight<50; Value=11.9421
Definition=PESO1; 50<=Weight<60; Value=14.4215
Definition=PESO1; 60<=Weight<70; Value=16.4876
Definition=PESO1; 70<=Weight<80; Value=18.9669
Definition=PESO1; 80<=Weight<90; Value=21.4463
Definition=PESO1; 90<=Weight<100; Value=23.9256
Definition=PESO1; 100<=Weight<110; Value=24.7521
Definition=PESO1; 110<=Weight<130; Value=28.4711
Definition=PESO1; 130<=Weight<150; Value=32.1901
Definition=PESO1; Weight=>150; Value=32.1901+0.242*(Weight-149)
Variable=ELECTRO; Value=evaluate_for_categories(Articles, 151)
*Variable=RESTO; Value=Articles-evaluate_for_categories(Articles, 151)
*Variable=ELECTROPESO; Value=evaluate_for_categories(Weight, 151)
*Variable=RESTOPESO; Value=Weight-evaluate_for_categories(Weight, 151)
Name={weight}Kg - GRATIS POR COMPRAS SUPERIORES A 150 €; Condition=ZONA1; Condition=not(ELECTRO); 150<=amountWithTax; Shipping=0
Name={weight}Kg - HAY ELECTRODOMÉSTICOS; Condition=ZONA1; 150<=amountWithTax; Shipping=PESO1

(*) Working on that

I have seen many examples in the forum and in the documentation but I am not able to apply it to my situation.
Please can you point me in the right direction?
The administrator has disabled public write access.

Shipping by weight, ZIP, and heavy products 02 Jul 2017 12:52 #2

Dear Sucolega,
If I understand you correctly, in the case with order amount >150€ you want to base your shipping cost not on the total weight, but just on the weight of all heavy products. In other words, depending on whether Amount>150 or Amount<=150, you want two different concepts of Weight. I would use a separate variable to store the weight to be used and then use that weight in all PESO1 rules:
Definition=ZONA1; Value=ZIP2 in list("04", "18", "23", "29", "14", "41", "11", "21")
Variable=myWeight; Value=Weight
Variable=myWeight; AmountWithTax>150; Value=evaluate_for_categories(Weight, 151)

Definition=PESO1; Value=0
Definition=PESO1; myWeight<5; Value=4.9174
Definition=PESO1; 5<=myWeight<10; Value=5.7438
Definition=PESO1; 10<=myWeight<15; Value=6.157
Definition=PESO1; 15<=myWeight<20; Value=6.9835
Definition=PESO1; 20<=myWeight<30; Value=8.6364
Definition=PESO1; 30<=myWeight<40; Value=10.2893
Definition=PESO1; 40<=myWeight<50; Value=11.9421
Definition=PESO1; 50<=myWeight<60; Value=14.4215
Definition=PESO1; 60<=myWeight<70; Value=16.4876
Definition=PESO1; 70<=myWeight<80; Value=18.9669
Definition=PESO1; 80<=myWeight<90; Value=21.4463
Definition=PESO1; 90<=myWeight<100; Value=23.9256
Definition=PESO1; 100<=myWeight<110; Value=24.7521
Definition=PESO1; 110<=myWeight<130; Value=28.4711
Definition=PESO1; 130<=myWeight<150; Value=32.1901
Definition=PESO1; myWeight=>150; Value=32.1901+0.242*(myWeight-149)

Name={weight}Kg - GRATIS POR COMPRAS SUPERIORES A 150 €; Condition=ZONA1; myWeight==0; 150<=amountWithTax; Shipping=0
Name={weight}Kg - Shipping rate above 150€ with heavy items; Condition=ZONA1; 150<=amountWithTax; Shipping=PESO1
Name={weight}Kg - Normal shipping rate below 150€ ; Condition=ZONA1; Shipping=PESO1

The third-to-last rule handles the case of >150€ with NO heavy items. We identify this case using the myWeight variable. if that is 0 wehn amountWithTax>=150, then no heavy items are in the cart.
The last two rules are identical and you need the second-to-last only if you want to print a different text for orders above 150€ that include heavy items. If you have multiple categories for your heavy products, simply include all of them in the evaluate_for_categories call, like evaluate_for_categories(Weight, 151, 152, 153, 154, 155)

Best regards,
The administrator has disabled public write access.

Shipping by weight, ZIP, and heavy products 03 Jul 2017 10:47 #3

Thanks Reinhold! Works great!
The administrator has disabled public write access.

[SOLVED] Shipping by weight, ZIP, and heavy products 04 Jul 2017 11:12 #4

Problem solved.
The administrator has disabled public write access.

VM - Shopping cart


Cart empty

Login Formular