Mass action gives an error on processing

  • Posts: 224
  • Thank you received: 8
4 years 7 months ago #310246

-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.11
-- PHP version -- : 7.2.21
-- Browser(s) name and version -- : Firefox 68.0.2
-- Error-message(debug-mod must be tuned on) -- : 1052 Column 'product_id' in where clause is ambiguous

Hello,
I created this mass action
Mass action settings nimb.ws/WKDFvx

but I receive this error upon processing it

An error has occurred: 1052 Column 'product_id' in where clause is ambiguous

As far as I see the categories IDs I used for filtering are corrected
categories IDs nimb.ws/qpGQgs

But I am not sure what the error means exactly, I checked the product IDs too in the database but they seem all right

Maybe I am missing something in the mass action settings?

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
4 years 7 months ago #310248

Hi,

You need to change the code:

				if(count($ids))
					$query->where = array('product_id IN ('.implode(',',$ids).') OR product_parent_id IN ('.implode(',',$ids).')');
				else
					$query->where = array('product_id=0');
to:
				if(count($ids))
					$query->where = array('hk_product.product_id IN ('.implode(',',$ids).') OR hk_product.product_parent_id IN ('.implode(',',$ids).')');
				else
					$query->where = array('hk_product.product_id=0');
in the file plugins/hikashop/massaction_product/massaction_product.php and that should fix the problem.
Note that the filters are associated together with the AND logic.
So in your mass action, you're trying to filter the products to only do the actions on the products in the category 23 and in the category 22 at the same time. If you want to do an OR, then you should actually have a filter >=22 and a second one <=23 and it will match the products if they are in at least one of the two categories.

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum