[Skip to main content](#vessel-content)

#   Error after editing report

##

- **[ijsbaanleuven](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile")**
- [![ijsbaanleuven's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar34667.png)](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile") Topic Author
- [ Offline](/forum/user/34667-ijsbaanleuven)

Less More

- Posts: 72
- Thank you received: 2
-
-
- [](http://www.ijsbaanleuven.be)
-

11 years 5 months ago -  11 years 5 months ago [\#203797](#203797) by [ijsbaanleuven](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile")  *[Error after editing report](/forum/3-bug-report/877342-error-after-editing-report#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 &#42;, p.product&#95;hit as Total, COUNT(a.order&#95;id) AS quantity FROM so2&#95;hikashop&#95;order&#95;product AS prod LEFT JOIN so2&#95;hikashop&#95;order AS a on a.order&#95;id=prod.order&#95;id LEFT JOIN so2&#95;hikashop&#95;product AS p ON prod.product&#95;id = p.product&#95;id LEFT JOIN so2&#95;hikashop&#95;product&#95;category AS cat ON cat.product&#95;id = p.product&#95;id OR cat.product&#95;id=p.product&#95;parent&#95;id LEFT JOIN so2&#95;hikashop&#95;category AS categ ON cat.category&#95;id = categ.category&#95;id LEFT JOIN so2&#95;hikashop&#95;product AS p ON p.product&#95;id=prod.product&#95;id WHERE a.order&#95;type='sale' AND cat.category&#95;id IN ('43','46','45','44') AND a.order&#95;created &gt; 1430832408 AND a.order&#95;created  Gentlmen,  I was editing a report, and when I hit save, I got this error.  All help would be gratefully accepted !!  BR,  Joris")* was created by *[ijsbaanleuven](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile")*

-- url of the page with the problem -- : [ www.ijsbaanleuven.be](http://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 &gt; 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

- [ ![hikaerror.png](/forum/attachment/24766) ](/forum/attachment/24766 "hikaerror.png") [ ](/forum/attachment/24766?download=1 "hikaerror.png")

Last edit: 11 years 5 months ago by [ijsbaanleuven](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile"). Reason: not urgent anymore :-)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84NzczNDItZXJyb3ItYWZ0ZXItZWRpdGluZy1yZXBvcnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

11 years 5 months ago [\#203807](#203807) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Error after editing report](/forum/3-bug-report/877342-error-after-editing-report#203807 "-- 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 &#42;, p.product&#95;hit as Total, COUNT(a.order&#95;id) AS quantity FROM so2&#95;hikashop&#95;order&#95;product AS prod LEFT JOIN so2&#95;hikashop&#95;order AS a on a.order&#95;id=prod.order&#95;id LEFT JOIN so2&#95;hikashop&#95;product AS p ON prod.product&#95;id = p.product&#95;id LEFT JOIN so2&#95;hikashop&#95;product&#95;category AS cat ON cat.product&#95;id = p.product&#95;id OR cat.product&#95;id=p.product&#95;parent&#95;id LEFT JOIN so2&#95;hikashop&#95;category AS categ ON cat.category&#95;id = categ.category&#95;id LEFT JOIN so2&#95;hikashop&#95;product AS p ON p.product&#95;id=prod.product&#95;id WHERE a.order&#95;type='sale' AND cat.category&#95;id IN ('43','46','45','44') AND a.order&#95;created &gt; 1430832408 AND a.order&#95;created  Gentlmen,  I was editing a report, and when I hit save, I got this error.  All help would be gratefully accepted !!  BR,  Joris")*

Hi,

In the file "administrator/components/com_hikashop/classes/widget.php", function "data()" please replace the code: 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-&gt;widget_params-&gt;category_childs){

By: Code:

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-&gt;widget_params-&gt;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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84NzczNDItZXJyb3ItYWZ0ZXItZWRpdGluZy1yZXBvcnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ijsbaanleuven](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile")**
- [![ijsbaanleuven's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar34667.png)](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile") Topic Author
- [ Offline](/forum/user/34667-ijsbaanleuven)

Less More

- Posts: 72
- Thank you received: 2
-
-
- [](http://www.ijsbaanleuven.be)
-

11 years 5 months ago [\#203869](#203869) by [ijsbaanleuven](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile")  Replied by *[ijsbaanleuven](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile")* on topic *[Error after editing report](/forum/3-bug-report/877342-error-after-editing-report#203869 "-- 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 &#42;, p.product&#95;hit as Total, COUNT(a.order&#95;id) AS quantity FROM so2&#95;hikashop&#95;order&#95;product AS prod LEFT JOIN so2&#95;hikashop&#95;order AS a on a.order&#95;id=prod.order&#95;id LEFT JOIN so2&#95;hikashop&#95;product AS p ON prod.product&#95;id = p.product&#95;id LEFT JOIN so2&#95;hikashop&#95;product&#95;category AS cat ON cat.product&#95;id = p.product&#95;id OR cat.product&#95;id=p.product&#95;parent&#95;id LEFT JOIN so2&#95;hikashop&#95;category AS categ ON cat.category&#95;id = categ.category&#95;id LEFT JOIN so2&#95;hikashop&#95;product AS p ON p.product&#95;id=prod.product&#95;id WHERE a.order&#95;type='sale' AND cat.category&#95;id IN ('43','46','45','44') AND a.order&#95;created &gt; 1430832408 AND a.order&#95;created  Gentlmen,  I was editing a report, and when I hit save, I got this error.  All help would be gratefully accepted !!  BR,  Joris")*

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 ?

- [ ![TopSalesPerProduct.jpg](/forum/attachment/24772) ](/forum/attachment/24772 "...PerProduct.jpg") [ ](/forum/attachment/24772?download=1 "...PerProduct.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84NzczNDItZXJyb3ItYWZ0ZXItZWRpdGluZy1yZXBvcnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

11 years 5 months ago [\#203873](#203873) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Error after editing report](/forum/3-bug-report/877342-error-after-editing-report#203873 "-- 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 &#42;, p.product&#95;hit as Total, COUNT(a.order&#95;id) AS quantity FROM so2&#95;hikashop&#95;order&#95;product AS prod LEFT JOIN so2&#95;hikashop&#95;order AS a on a.order&#95;id=prod.order&#95;id LEFT JOIN so2&#95;hikashop&#95;product AS p ON prod.product&#95;id = p.product&#95;id LEFT JOIN so2&#95;hikashop&#95;product&#95;category AS cat ON cat.product&#95;id = p.product&#95;id OR cat.product&#95;id=p.product&#95;parent&#95;id LEFT JOIN so2&#95;hikashop&#95;category AS categ ON cat.category&#95;id = categ.category&#95;id LEFT JOIN so2&#95;hikashop&#95;product AS p ON p.product&#95;id=prod.product&#95;id WHERE a.order&#95;type='sale' AND cat.category&#95;id IN ('43','46','45','44') AND a.order&#95;created &gt; 1430832408 AND a.order&#95;created  Gentlmen,  I was editing a report, and when I hit save, I got this error.  All help would be gratefully accepted !!  BR,  Joris")*

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](/forum/user/34667-ijsbaanleuven "View ijsbaanleuven's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84NzczNDItZXJyb3ItYWZ0ZXItZWRpdGluZy1yZXBvcnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.076 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
