Error after editing report

  • Posts: 72
  • Thank you received: 2
9 years 5 months ago #203797

-- url of the page with the problem -- : www.ijsbaanleuven.be
-- HikaShop version -- : 2.4.1
-- Joomla version -- : 3.4.1
-- Error-message(debug-mod must be tuned on) -- : 1066 Not unique table/alias: 'p' SQL=SELECT *, p.product_hit as Total, COUNT(a.order_id) AS quantity FROM so2_hikashop_order_product AS prod LEFT JOIN so2_hikashop_order AS a on a.order_id=prod.order_id LEFT JOIN so2_hikashop_product AS p ON prod.product_id = p.product_id LEFT JOIN so2_hikashop_product_category AS cat ON cat.product_id = p.product_id OR cat.product_id=p.product_parent_id LEFT JOIN so2_hikashop_category AS categ ON cat.category_id = categ.category_id LEFT JOIN so2_hikashop_product AS p ON p.product_id=prod.product_id WHERE a.order_type='sale' AND cat.category_id IN ('43','46','45','44') AND a.order_created > 1430832408 AND a.order_created

Gentlmen,


I was editing a report, and when I hit save, I got this error.


All help would be gratefully accepted !!


BR,

Joris

Attachments:
Last edit: 9 years 5 months ago by ijsbaanleuven. Reason: not urgent anymore :-)

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

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #203807

Hi,

In the file "administrator/components/com_hikashop/classes/widget.php", function "data()" please replace the code:

				$leftjoin['product'] = ' LEFT JOIN '.hikashop_table('product').' AS p ON prod.product_id = p.product_id ';
				$leftjoin['product_category'] = ' LEFT JOIN '.hikashop_table('product_category').' AS cat ON cat.product_id = p.product_id OR cat.product_id=p.product_parent_id';
				if($widget->widget_params->category_childs){
By:
				if(!isset($leftjoin['product']))
					$leftjoin['product'] = ' LEFT JOIN '.hikashop_table('product').' AS p ON prod.product_id = p.product_id ';
				$leftjoin['product_category'] = ' LEFT JOIN '.hikashop_table('product_category').' AS cat ON cat.product_id = p.product_id OR cat.product_id=p.product_parent_id';
				if($widget->widget_params->category_childs){

If that don't solve the issue, please give us a screenshot of you report settings in order to reproduce the issue on our end.

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

  • Posts: 72
  • Thank you received: 2
9 years 5 months ago #203869

Hi !

Replaced the code, but no change.
Like I said before, I cannot reproduce the settings, as I cannot enter the report.

If I am correct, the following settings in the report should give me the number of sales per product in orders that are confirmed, in the category patches, in the period between may 1st up to today ?

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 5 months ago #203873

Hi,

Instead of the code change given by Xavier, add the line:
if(strpos($leftjoin,'hikashop_product AS p ON ')===false)
just before the line:
$leftjoin.=' LEFT JOIN '.hikashop_table('product').' AS p ON p.product_id=prod.product_id ';
in that same file. That should fix the problem.

The following user(s) said Thank You: ijsbaanleuven

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

Time to create page: 0.075 seconds
Powered by Kunena Forum