1052 column 'product_id' in where clause is ambiguous

  • Posts: 57
  • Thank you received: 0
6 years 10 months ago #286238

-- url of the page with the problem -- : panda-ua.com/мужчинам/мужские-кошельки-портмоне
-- HikaShop version -- : 3.2.2
-- Joomla version -- : 3.8.3
-- PHP version -- : 7.0
-- Browser(s) name and version -- : Google Chrome 63.0.3239.132
-- Error-message(debug-mod must be tuned on) -- : 1052 COLUMN 'PRODUCT_ID' IN WHERE CLAUSE IS AMBIGUOUS

After the component version update, error 1052 COLUMN 'PRODUCT_ID' IN WHERE CLAUSE IS AMBIGUOUS appeared.
How to fix it? The fix of the Joomla database did not help. Checking the Hikashop database also did not reveal anything ...

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
6 years 10 months ago #286240

Hello,

Please activate temporally the Joomla debug mode in order to have the call stack.
The full SQL query and the file where that query is generated will be required in order to understand the issue.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 57
  • Thank you received: 0
6 years 10 months ago #286265
Attachments:

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
6 years 10 months ago #286268

Hello,

Unfortunately, there is not the full SQL query which would allow us to understand where and what that query is.
Please try to use the default Joomla template and check again your settings for the Joomla debug mode.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 198
  • Thank you received: 7
6 years 9 months ago #287398

Same problem here. It has something to do with the HikaShop Content Module. When i disable this module the problem is gone.

This is since i updated from version 3.2.1 to version 3.2.2 any clue?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 9 months ago #287405

Hi,

In the file /libraries/joomla/database/exception/executing.php change the line:
parent::__construct($message, $code, $previous);
to:
parent::__construct($message.' '.$query, $code, $previous);
That should provide the full MySQL query which will help understand the problem.

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

  • Posts: 198
  • Thank you received: 7
6 years 9 months ago #287426

Hi Nicolas this is the Query

1052
FOUT: 1052
Column 'product_id' in where clause is ambiguous SELECT DISTINCT b.* FROM jos_hikashop_product_category AS a LEFT JOIN jos_hikashop_product AS b ON a.product_id=b.product_id WHERE (b.product_published = 1) AND (b.product_type = 'main') AND (a.category_id IN (2)) AND (product_id = 0) AND (b.product_quantity!=0) AND ((b.product_access = 'all' OR b.product_access LIKE '%,9,%')) ORDER BY a.ordering ASC LIMIT 0, 4

Kind regards René

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 9 months ago #287435

Hi,

Great. Edit the file components/com_hikashop/views/product/view.html.php and change the line:

$filters[] = 'product_id = 0';
to:
$filters[] = 'b.product_id = 0';
That should fix the problem.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 9 months ago #287437

Note that you probably want to turn off the "discount only" setting in your products listings menu item/module.
Because this means that you have a listing of products without any products that will display because there are no discounts for the products of the listing.

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

  • Posts: 198
  • Thank you received: 7
6 years 9 months ago #287440

Hi Nicolas,

I turned off "Discount Only" and that solved the problem.

Kind regards René

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

  • Posts: 57
  • Thank you received: 0
6 years 9 months ago #287701
Attachments:

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
6 years 9 months ago #287702

Hello,

You have three solutions.
1 - Update to HikaShop 3.3.0 which already contain a patch for that..

2 - Do than renem wrote

I turned off "Discount Only" and that solved the problem.


3 -edit the file "components/com_hikashop/view/product/view.html.php" and replace
if(!$matchingDiscount) {
	$filters[] = 'product_id = 0';
}
By
if(!$matchingDiscount) {
	$filters[] = 'b.product_id = 0';
}

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.104 seconds
Powered by Kunena Forum