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!



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


Customize the shipment name 27 Jan 2016 21:39 #1

  • ex3mist
  • ex3mist's Avatar Topic Author
I'm using your Advanced Shipping by Rules extension and it works great. I just want to customize how it is displayed in the order mail. In the mail it is shown like this:

Versand (Standartversand)

By looking at the mail template file, it is displayed by this:
<?php echo $this->orderDetails['shipmentName'];?>
"Standartversand" comes from the name of the rule I've given:
Name=Standartversand; Shipping=5
My question is which file I have to edit to make it looks like this:

Versand: Standartversand

I want to remove the brackets, put a colon after "Versand", put heading tags around it... Some small changes. I just can't find where this code
<?php echo $this->orderDetails['shipmentName'];?>
is taking the information from.

Can you help, please?

Customize the shipment name 29 Jan 2016 11:34 #2

Dear ex3mist,
Currently, the shipment name is hardcoded in the plugin to have the form "Methodname (Rulename)" if a rule name is present in the rule. If you want to change this, the only way is to modify the plugin itself, in particular the renderPluginname ($plugin) function in the file rules_shipping_base.php, somewhere around line 229. In particular, you need to change the current code
		if (!empty($plugin->rule_name)) {
			$rulename=" (".htmlspecialchars($plugin->rule_name).")";
		if (!empty($plugin->rule_name)) {
			$rulename=": ".htmlspecialchars($plugin->rule_name);
Unfortunately, this change will be lost whenever the plugin is upgrade to a new version. You'll then have to make this change again manually.

Best regards,

PS: To answer your particular question: the orderDetails is set to the value generated by renderPluginName in line 131 of rules_shipping_base.php.

Customize the shipment name 29 Jan 2016 11:46 #3

  • ex3mist
  • ex3mist's Avatar Topic Author
That's exactly what I was looking for. Thank you very much for the detailed explanation!

But I'd like to ask another thing - if I want to insert only the Rulename in the order mail, can I do it by adding this code in the HTML:
<?php echo $plugin->rule_name;?>

Customize the shipment name 29 Jan 2016 14:38 #4

Unfortunately, this is not possible. the $plugin object is only available inside the plugin code, but that will only be run when the order is submitted, not when the invoice is created. VirtueMart stores all details of an order in the $this->orderDetails array available in the templates. Unfortunately, the orderDetails contain only the shipmentName, but no other information about the shipping, in particular not the rule name.

Basically, all you can do is modify the name that the plugin returns in renderPluginName.


Customize the shipment name 29 Jan 2016 14:51 #5

  • ex3mist
  • ex3mist's Avatar Topic Author
Thanks once again for the detailed information!

[SOLVED] Customize the shipment name 29 Jan 2016 14:51 #6

  • ex3mist
  • ex3mist's Avatar Topic Author
Problem solved.
  • Page:
  • 1