VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: antonstewart on November 13, 2019, 18:11:22 PM

Title: [Solved] Shipment Methods don't appear when Categories are applied
Post by: antonstewart on November 13, 2019, 18:11:22 PM
Bug observed following update to VirtueMart 3.6.8 (10197) - Plugin: VM Shipment - By weight, ZIP and countries

When a shipment method is restricted to specified product categories, it is not available as an option on the checkout page even though the product is in the matching category. Removing the category restriction and making it available for all categories causes the option to reappear.

I'd appreciate a quick fix or temporary work-around for this issue as it has broken two previously functioning shipment methods essential to my store.

Thanks - Anton

System details:
VirtueMart 3.6.8 10197
Plugin vmshipment weight_countries (updated through Virtuemart AIO)
Joomla 3.9.13
PHP 7.2.14
Mysql 5.7.25
Title: Re: Shipment Methods don't appear when Categories are applied
Post by: StefanSTS on November 13, 2019, 22:06:10 PM
I can confirm this, looks like the VM team is on it.

Title: Re: Shipment Methods don't appear when Categories are applied
Post by: AH on November 14, 2019, 09:36:09 AM
yes there was a change in the code that prevented category restrictions for functioning

This is now fixed

administrator\components\com_virtuemart\plugins\vmpsplugin.php

line 985 should be:

if(!empty($method->blocking_categories) AND array_intersect($product->categories,$method->blocking_categories)){
Title: Re: Shipment Methods don't appear when Categories are applied
Post by: antonstewart on November 16, 2019, 16:59:47 PM
Quote from: AH on November 14, 2019, 09:36:09 AM
yes there was a change in the code that prevented category restrictions for functioning

This is now fixed

administrator\components\com_virtuemart\plugins\vmpsplugin.php

line 985 should be:

if(!empty($method->blocking_categories) AND array_intersect($product->categories,$method->blocking_categories)){

Thank you so much, I can confirm that the patch worked.

Much obliged - Anton
Title: Re: [Solved] Shipment Methods don't appear when Categories are applied
Post by: AH on November 18, 2019, 09:41:06 AM
You are welcome

Thanks for the update.  :)