Welcome,
Guest
|
TOPIC:
Сategories, minimum order, shipping, several, area 14 Apr 2016 18:30 #1
|
With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.
It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!
Welcome,
Guest
|
|
Good day! I hope for your help a lot! I'm developing an online store food-delivery in VirtueMart 3 with "Advanced shipping by Rules for VirtueMart".
Shipping rules VirtueMart for my delivery food services (each category belongs to a certain kind of food): 1. shipping from the first restoraunt: categories: 172, 166, 158, 168, 173, 169, 159, 171, 167, 170, 160; minimum order: 9,06$; shipping: 4,52$; shipping free: none. 2. shipping from the second restaurant: categories: 174; minimum order: 6,05$; shipping: 2,27$; shipping free: over 16,63$. 3. shipping from the third restaurant: categories: 175, 176; minimum order: 2,27$; shipping: 3,78$; shipping free: over 16,63$. 4. shipping from the fourth restaurant: categories: 186, 181, 185, 179, 184, 183, 180, 187, 189, 178; minimum order: 3,02$; shipping: 2,27$; shipping free: over 9,07$. 5. shipping from the fifth restaurant: categories: 191; minimum order: 2,57$ shipping: 3,78$ shipping free: none. 6. shipping from the sixth restaurant: categories: 192; minimum order: 1,51$; shipping: 3,02$; shipping free: over 15,12$. 7. In the selection of several restaurants: the total cost is summed up. 8. in case of order from distant areas: +3$ to the total cost. Thanks in advance! |
|
Dear Voyager,
I would implement these shipping costs with rules like: Variable=AmountShop1; Value=evaluate_for_categories(Amount, 172, 166, 168, 173, 169, 171, 167, 170, 160)
Variable=AmountShop2; Value=evaluate_for_categories(Amount, 174)
Variable=AmountShop3; Value=evaluate_for_categories(Amount, 175, 176)
Variable=AmountShop4; Value=evaluate_for_categories(Amount, 186, 181, 185, 179, 184, 183, 180, 187, 189, 178)
Variable=AmountShop5; Value=evaluate_for_categories(Amount, 191)
Variable=AmountShop6; Value=evaluate_for_categories(Amount, 192)
Variable=myShipping; Value=0
Name="Restaurant 1 has a minimum amount of 9.06"; 0<AmountShop1<9.06; NoShipping
Variable=myShipping; 9.06<=AmountShop1; Value=myShipping+4.52
Name="Restaurant 2 has a minimum amount of 6.05"; 0<AmountShop2<6.05; NoShipping
Variable=myShipping; 6.05<=AmountShop2<16.63; Value=myShipping+2.27
Name="Restaurant 3 has a minimum amount of 2.27"; 0<AmountShop3<2.27; NoShipping
Variable=myShipping; 2.27<=AmountShop3<9.07; Value=myShipping+3.78
Name="Restaurant 4 has a minimum amount of 3.02"; 0<AmountShop4<3.02; NoShipping
Variable=myShipping; 3.02<=AmountShop4<9.07; Value=myShipping+2.27
Name="Restaurant 5 has a minimum amount of 2.57"; 0<AmountShop5<2.57; NoShipping
Variable=myShipping; 2.57<=AmountShop5; Value=myShipping+3.78
Name="Restaurant 6 has a minimum amount of 1.51"; 0<AmountShop6<1.51; NoShipping
Variable=myShipping; 1.51<=AmountShop6<15.12; Value=myShipping+3.02
Name="Extra charge for distant areas"; ZIP>1234; ExtraShippingCharge=3
Shipping=myShipping Some explanation about the logic: First, I define six variables holding the amounts ordered from each of the restaurants (most will be zero). This is just to avoid having to duplicate all evaluate_for_categories in all rules for the corresponding restaurant. It also means that it is easier to adjust the categories for each restaurant later on. Then I define a variable myShipping, which holds the intermediate results for the shipping costs. First it is set to zero, then for each shop that has some products ordered, we simply add the corresponding shipping costs to that variable. So, at the end the shipping cost is stored in the myShipping variable (last line). To enforce the minimum order for each of the restaurants, I'm using rules with NoShipping and the corresponding checks on the AmountShop1 variable. The 0<AmountShop1 is relevant, because it checks whether any product from shop1 is ordered at all. You might notice that I didn't add any rule for the free shipping cases. The reason is that in this case, we don't need to add any shipping costs for this shop, so we don't need to change the myShipping variable. The case where the free shipping threshold is not reached is the relevant case, and that one is properly handled. The extra charge for distant areas is done via the ExtraShippingCharge feature (which simply adds the amount to whatever shipping costs the other rules give). Instead of using the myShipping variable, one could avoid a custom variable and simply add the shipping costs for each shop via ExtraShippingCharge rules: Variable=AmountShop1; Value=evaluate_for_categories(Amount, 172, 166, 168, 173, 169, 171, 167, 170, 160)
Variable=AmountShop2; Value=evaluate_for_categories(Amount, 174)
Variable=AmountShop3; Value=evaluate_for_categories(Amount, 175, 176)
Variable=AmountShop4; Value=evaluate_for_categories(Amount, 186, 181, 185, 179, 184, 183, 180, 187, 189, 178)
Variable=AmountShop5; Value=evaluate_for_categories(Amount, 191)
Variable=AmountShop6; Value=evaluate_for_categories(Amount, 192)
Name="Restaurant 1 has a minimum amount of 9.06"; 0<AmountShop1<9.06; NoShipping
Name="Restaurant 1"; 9.06<=AmountShop1; ExtraShippingCharge=4.52
Name="Restaurant 2 has a minimum amount of 6.05"; 0<AmountShop2<6.05; NoShipping
Name="Restaurant 2"; 6.05<=AmountShop2<16.63; ExtraShippingCharge=2.27
Name="Restaurant 3 has a minimum amount of 2.27"; 0<AmountShop3<2.27; NoShipping
Name="Restaurant 3"; 2.27<=AmountShop3<9.07; ExtraShippingCharge=3.78
Name="Restaurant 4 has a minimum amount of 3.02"; 0<AmountShop4<3.02; NoShipping
Name="Restaurant 4"; 3.02<=AmountShop4<9.07; ExtraShippingCharge=2.27
Name="Restaurant 5 has a minimum amount of 2.57"; 0<AmountShop5<2.57; NoShipping
Name="Restaurant 5"; 2.57<=AmountShop5; ExtraShippingCharge=3.78
Name="Restaurant 6 has a minimum amount of 1.51"; 0<AmountShop6<1.51; NoShipping
Name="Restaurant 6"; 1.51<=AmountShop6<15.12; ExtraShippingCharge=3.02
Name="Extra charge for distant areas"; ZIP>1234; ExtraShippingCharge=3
Shipping=0 Both rule sets should give the same shipping cost... You might need to adjust the rules to your needs, but these examples should give you a pretty good picture how this shipping cost structure could be implemented... Best regards, Reinhold PS: I have to admit, I have not actually tested the rules, just written them here in the forum post. So, please excuse me if I made some small typo. You'll have to check the results yourself. |