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:

Notice: Trying to get property of non-object in... 25 Jul 2014 20:49 #1

  • tennessee
  • tennessee's Avatar Topic Author
I am running the latest version of the plugin, and am recently having an issue. On the checkout page, I am getting this set of error messages. It appears to be 3 separate errors, each repeated once.

This problem has not always been present and nothing should have changed on my end. Can you advise the steps I need to take to correct this? This appears to have something to do with "Country" and/or "Country Code"



Notice: Trying to get property of non-object in /home/xxxxx/public_html/plugins/vmshipment/rules_shipping/rules_shipping_base.php on line 564

Notice: Trying to get property of non-object in /home/xxxxx/public_html/plugins/vmshipment/rules_shipping/rules_shipping_base.php on line 565

Notice: Trying to get property of non-object in /home/xxxxx/public_html/plugins/vmshipment/rules_shipping/rules_shipping_base.php on line 566

Notice: Trying to get property of non-object in /home/xxxxx/public_html/plugins/vmshipment/rules_shipping/rules_shipping_base.php on line 564

Notice: Trying to get property of non-object in /home/xxxxx/public_html/plugins/vmshipment/rules_shipping/rules_shipping_base.php on line 565

Notice: Trying to get property of non-object in /home/xxxxx/public_html/plugins/vmshipment/rules_shipping/rules_shipping_base.php on line 566


Here is the relevant chunk of code from the file mentioned in the errors:
$countriesModel = VmModel::getModel('country');
		if (isset($address['virtuemart_country_id'])) {
			$data['countryid'] = $address['virtuemart_country_id'];
			$countriesModel->setId($address['virtuemart_country_id']);
			$country = $countriesModel->getData();
			if (!empty($country)) {
				$data['country'] = $country->country_name;
				$data['country2'] = $country->country_2_code;
				$data['country3'] = $country->country_3_code;
			}
		}

Notice: Trying to get property of non-object in... 27 Jul 2014 18:39 #2

Dear tennessee,
Thank you for the issue report. Are you able to reproduce the problem or does it happen only sporadically?

Unfortunately, I have never been able to reproduce the issue, so I'm not sure of the exact cause of the problems. I had reports of a similar issue a long while ago and then changed the "if" check to use empty instead of isset. Since then I didn't get any issue reports until a week ago, when another user reported this very issue, too:
open-tools.net/forum/shipping-by-rules-p.../4298-php-error.html

Does the error on your site happen for every customer? Or just for customers from a particular country? As I said above, I have never been able to reproduce the problem on any of my test systems and from looking at the VirtueMart code, getData should always either return a proper object or null, which would be weeded out by the empty check.

So if you can either reproduce the problem yourself (or even better on a test system), or if you noticed some similarities between the cases when the PHP warning happens, that would be a tremendous help for tracking down the issue.

Best regards,
Reinhold

Notice: Trying to get property of non-object in... 11 Sep 2014 02:06 #3

Dear tennessee,
I was finally able to track down the cause of the problem: It was a nastly little bug in the VirtueMart code, where the internal cache to optimize database access was not properly handled.

I submitted the proper fix to the VirtueMart core developers for future VM releases, and also released a new version 4.2 of my shipping plugins that contain a workaround for existing VM versions.

So, please upgrade your plugin to version 4.2 and things should work.

Best regards,
Reinhold
  • Page:
  • 1