Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Shipping by Rules for VirtueMart

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

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!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Summing matching rules - Adapting the code 16 Aug 2014 19:32 #1

  • ckrzysieck
  • ckrzysieck's Avatar Topic Author
Hi,

I use the plug: Advanced Shipping by Rules.

EXAMPLE:
Category ID 1: $5
Category ID 2: $10
Then on the checkout processing:
+ If users purchase two products which are belong to one product in Category ID 1 and one product in Category ID 2: Shipping Cost = $5 + $10 = $15
I know the first matching rule is used to calculate the shipping costs.

RULES:
1 in Categories;Shipping=5*Articles
2 in Categories;Shipping=10*Articles

Please give me a hint to customize the plugin to summing matching rules.
I understand the need to modify / add code in the file: rules_shipping_base.php
Where to find a function that makes it is taken into account only the first matching rule shipping cost, and not all.


Best regards,
Jurkiewicz

Summing matching rules - Adapting the code 18 Aug 2014 14:56 #2

Actually, thanks to the new variable definitions in the Plugin version 4.x, you don't even need to modify the plugin code. However, you have to write the rules a bit different: Instead of writing rules, you are writing variable definitions (with conditions), that modify the same variable over and over. And at the end you have one final rule that gives that variable as the shipping cost.
Definition=myship; Value=0
Definition=myship; 1 in Categories; Value=myship+4
Definition=myship; 2 in Categories; Value=myship+12345
Name="Shipping costs summed up"; Shipping=myship
This will add 4€ to the shipping costs if any article from category 1 is in the order and 12345€ if any article from category 2 is in the order.

HOWEVER, it appears that you want 5€ shipping for each article in category 1. Unfortunately, it is currently NOT possible to find out how many articles from a given category are in the order! I'm working on this, but adding a function "value_for_category(Articles, 1)" requires a complete change of how the plugin evaluates the expressions... I cannot give any predictions when I will have a proper solution, so please don't count on the plugin getting that functionality in the near future.

Best regards,
Reinhold

Summing matching rules - Adapting the code 23 Aug 2014 18:52 #3

  • ckrzysieck
  • ckrzysieck's Avatar Topic Author
Thank you for your response.

Unfortunately I need the functionality of how many articles from a given category are in the order.
So, I must waited for the introduction That functionality in the near future.

Best regards,
Jurkiewicz

Summing matching rules - Adapting the code 23 Aug 2014 20:14 #4

Dear Jurkiewicz,
Sorry about that. As I said, I cannot guarantee that I will really implement this in the near future...

Sorry,
Reinhold

Summing matching rules - Adapting the code 23 Aug 2014 20:42 #5

  • ckrzysieck
  • ckrzysieck's Avatar Topic Author
I understand, this is difficult to to and may take some time.

I'll keep fingers crossed to make it work, Your Addition has huge potential when it comes to setting the shipment in VM.

Best regards,
Jurkiewicz

Summing matching rules - Adapting the code 04 Nov 2014 10:07 #6

  • ckrzysieck
  • ckrzysieck's Avatar Topic Author
Hi,

Is the version 4.3 [2014-10-23] have add switch to offer only the first matching rule or all matching rules?

Best regards,
Jurkiewicz

Summing matching rules - Adapting the code 04 Nov 2014 12:37 #7

Unfortunately, VM's general shipping methods system is built on the premise that one method offers exactly one possible shipping. So, having one shipping method offer multiple different shipping choices would require quite a few hacks and would probably not feel native.

So, sorry, version 4.3 of the plugin still offers only the first matching rule.

Best regards,
Reinhold

Summing matching rules - Adapting the code 04 Nov 2014 12:42 #8

  • ckrzysieck
  • ckrzysieck's Avatar Topic Author
I understand that you will need to edit the file in virtuemart responsible for shipping.
I will be waited for the introduction hacku to virtuemart that could be introduced this feature.

Summing matching rules - Adapting the code 24 Mar 2015 21:12 #9

  • ckrzysieck
  • ckrzysieck's Avatar Topic Author
Hi,

Is the version 5.2 [2015-03-11] have add switch to offer only the first matching rule or all matching rules?
Alternatively or are you planning in the near future to add this functionality?

Best regards,
Jurkiewicz

Summing matching rules - Adapting the code 25 Mar 2015 00:12 #10

Hello,
Since VM is so much based on the assumption that one shipping method offers only one rate, I really have no plans anywhere in the near future to implement this. I would not even know, how I could properly implement it without changing the VM core.

Best regards,
Reinhold
  • Page:
  • 1