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

#   Acymailing Filter on Orders not working

##

- **[carniel](/forum/user/39404-carniel "View carniel's Profile")**
- [![carniel's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/crossing_kangaroo.png)](/forum/user/39404-carniel "View carniel's Profile") Topic Author
- [ Offline](/forum/user/39404-carniel)

Less More

- Posts: 27
- Thank you received: 1
-
-
-

10 years 11 months ago [\#223758](#223758) by [carniel](/forum/user/39404-carniel "View carniel's Profile")  *[Acymailing Filter on Orders not working](/forum/30-integrations/881026-acymailing-filter-on-orders-not-working#223758 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.3.10 -- Browser(s) name and version -- : Safari 6.2.8  I try to integrate Acymailing with Hikashop and move a user to a list when he buys a product. Created a filter in Acymailing with Hikashop customers - bought - product -&gt; move to list There is a completed order for that product in Hikashop. When I process &quot;View users&quot; there are 0 chosen I turned on Joomla Debug and it shows this query:  SELECT DISTINCT b.user&#95;email FROM jom30&#95;hikashop&#95;order&#95;product AS a LEFT JOIN jom30&#95;hikashop&#95;order AS c ON a.order&#95;id = c.order&#95;id LEFT JOIN jom30&#95;hikashop&#95;user AS b on c.order&#95;user&#95;id = b.user&#95;id WHERE c.order&#95;status IN ('') AND a.product&#95;id = 10  I think the problem is the order&#95;status .. checked in the database and the order&#95;status is &quot;confirmed&quot; The error is maybe the empty list but I cannot figure out why its empty. Maybe its a language problem - its german.  Thx Eva")* was created by *[carniel](/forum/user/39404-carniel "View carniel's Profile")*

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.5
-- PHP version -- : 5.3.10
-- Browser(s) name and version -- : Safari 6.2.8

I try to integrate Acymailing with Hikashop and move a user to a list when he buys a product.
Created a filter in Acymailing with Hikashop customers - bought - product -&gt; move to list
There is a completed order for that product in Hikashop.
When I process "View users" there are 0 chosen
I turned on Joomla Debug and it shows this query:

SELECT DISTINCT b.user_email
FROM jom30_hikashop_order_product AS a
LEFT JOIN jom30_hikashop_order AS c
ON a.order_id = c.order_id
LEFT JOIN jom30_hikashop_user AS b
on c.order_user_id = b.user_id
WHERE c.order_status IN ('')
AND a.product_id = 10

I think the problem is the order_status .. checked in the database and the order_status is "confirmed"
The error is maybe the empty list but I cannot figure out why its empty. Maybe its a language problem - its german.

Thx Eva

---

There are no kangaroos in Austria! ![;-)](/media/kunena/emoticons/24.png ";-)")

- [ ![Snap&#95;2015-12-10&#95;at&#95;15&#95;12&#95;27.png](/forum/attachment/28401) ](/forum/attachment/28401 "...t&#95;15&#95;12&#95;27.png") [ ](/forum/attachment/28401?download=1 "...t&#95;15&#95;12&#95;27.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84ODEwMjYtYWN5bWFpbGluZy1maWx0ZXItb24tb3JkZXJzLW5vdC13b3JraW5nP3RtcGw9bWFya2Rvd24=) 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: 86587
- Thank you received: 14325
-
-

10 years 11 months ago [\#223775](#223775) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Acymailing Filter on Orders not working](/forum/30-integrations/881026-acymailing-filter-on-orders-not-working#223775 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.3.10 -- Browser(s) name and version -- : Safari 6.2.8  I try to integrate Acymailing with Hikashop and move a user to a list when he buys a product. Created a filter in Acymailing with Hikashop customers - bought - product -&gt; move to list There is a completed order for that product in Hikashop. When I process &quot;View users&quot; there are 0 chosen I turned on Joomla Debug and it shows this query:  SELECT DISTINCT b.user&#95;email FROM jom30&#95;hikashop&#95;order&#95;product AS a LEFT JOIN jom30&#95;hikashop&#95;order AS c ON a.order&#95;id = c.order&#95;id LEFT JOIN jom30&#95;hikashop&#95;user AS b on c.order&#95;user&#95;id = b.user&#95;id WHERE c.order&#95;status IN ('') AND a.product&#95;id = 10  I think the problem is the order&#95;status .. checked in the database and the order&#95;status is &quot;confirmed&quot; The error is maybe the empty list but I cannot figure out why its empty. Maybe its a language problem - its german.  Thx Eva")*

Hi,

Change the code: Code:

function onAcyProcessFilter_hikaorder(&amp;$query,$filter,$num){ if(!$this-&gt;loadAcymailing()) return; $config =&amp; hikashop_config(); $statuses = explode(',',$config-&gt;get('invoice_order_statuses','confirmed,shipped')); $condition = array(); foreach($statuses as $status){ $condition[] = $query-&gt;db-&gt;Quote($status); } $myquery = "SELECT DISTINCT b.user_email FROM #__hikashop_order_product AS a LEFT JOIN #__hikashop_order AS c ON a.order_id = c.order_id LEFT JOIN #__hikashop_user AS b on c.order_user_id = b.user_id WHERE c.order_status IN (".implode(',',$condition).")"; if(!empty($filter['product']) AND is_numeric($filter['product'])) $myquery .= " AND a.product_id = ".(int) $filter['product']; elseif(!empty($filter['cat']) AND is_numeric($filter['cat'])) $myquery .= " AND a.product_id IN (SELECT product_id FROM #__hikashop_product_category WHERE category_id = ".$filter['cat'].")"; $datesVar = array('creationdatesup','creationdateinf'); foreach($datesVar as $oneDate){ if(empty($filter[$oneDate])) continue; $filter[$oneDate] = acymailing_replaceDate($filter[$oneDate]); if(!is_numeric($filter[$oneDate])) $filter[$oneDate] = strtotime($filter[$oneDate]); } if(empty($filter['datefield'])) $filter['datefield'] = 'order_created'; if(!empty($filter['creationdateinf'])) $myquery .= ' AND c.&#96;'.$filter['datefield'].'&#96; &gt; '.$filter['creationdateinf']; if(!empty($filter['creationdatesup'])) $myquery .= ' AND c.&#96;'.$filter['datefield'].'&#96; &lt; '.$filter['creationdatesup']; $query-&gt;db-&gt;setQuery($myquery); $allEmails = acymailing_loadResultArray($query-&gt;db); if(empty($allEmails)) $allEmails[] = 'none'; if(empty($filter['type'])){ $query-&gt;where[] = "sub.email NOT IN ('".implode("','",$allEmails)."')"; }else{ $query-&gt;where[] = "sub.email IN ('".implode("','",$allEmails)."')"; } }

to: Code:

function onAcyProcessFilter_hikaorder(&amp;$query,$filter,$num){ if(!$this-&gt;loadAcymailing()) return; $config =&amp; hikashop_config(); $statuses = $config-&gt;get('invoice_order_statuses','confirmed,shipped'); if(empty($statuses)) $statuses = 'confirmed,shipped'; $statuses = explode(',',$statuses); $condition = array(); foreach($statuses as $status){ if(!empty($status)) $condition[] = $query-&gt;db-&gt;Quote($status); } $myquery = "SELECT DISTINCT b.user_email FROM #__hikashop_order_product AS a LEFT JOIN #__hikashop_order AS c ON a.order_id = c.order_id LEFT JOIN #__hikashop_user AS b on c.order_user_id = b.user_id"; $filters = array(); if(count($condition)) $filters[] = "c.order_status IN (".implode(',',$condition).")"; if(!empty($filter['product']) AND is_numeric($filter['product'])) $filters[] = "a.product_id = ".(int) $filter['product']; elseif(!empty($filter['cat']) AND is_numeric($filter['cat'])) $filters[] = "a.product_id IN (SELECT product_id FROM #__hikashop_product_category WHERE category_id = ".$filter['cat'].")"; $datesVar = array('creationdatesup','creationdateinf'); foreach($datesVar as $oneDate){ if(empty($filter[$oneDate])) continue; $filter[$oneDate] = acymailing_replaceDate($filter[$oneDate]); if(!is_numeric($filter[$oneDate])) $filter[$oneDate] = strtotime($filter[$oneDate]); } if(empty($filter['datefield'])) $filter['datefield'] = 'order_created'; if(!empty($filter['creationdateinf'])) $filters[] = 'c.&#96;'.$filter['datefield'].'&#96; &gt; '.$filter['creationdateinf']; if(!empty($filter['creationdatesup'])) $filters[] = 'c.&#96;'.$filter['datefield'].'&#96; &lt; '.$filter['creationdatesup']; if(count($filters)){ $myquery.=' WHERE '.implode(' AND ',$filters); } $query-&gt;db-&gt;setQuery($myquery); $allEmails = acymailing_loadResultArray($query-&gt;db); if(empty($allEmails)) $allEmails[] = 'none'; if(empty($filter['type'])){ $query-&gt;where[] = "sub.email NOT IN ('".implode("','",$allEmails)."')"; }else{ $query-&gt;where[] = "sub.email IN ('".implode("','",$allEmails)."')"; } }

in the file plugins/acymailing/hikashop/hikashop.php and that should fix the problem.

The following user(s) said Thank You: [carniel](/forum/user/39404-carniel "View carniel's Profile")

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

- **[carniel](/forum/user/39404-carniel "View carniel's Profile")**
- [![carniel's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/crossing_kangaroo.png)](/forum/user/39404-carniel "View carniel's Profile") Topic Author
- [ Offline](/forum/user/39404-carniel)

Less More

- Posts: 27
- Thank you received: 1
-
-
-

10 years 11 months ago [\#223853](#223853) by [carniel](/forum/user/39404-carniel "View carniel's Profile")  Replied by *[carniel](/forum/user/39404-carniel "View carniel's Profile")* on topic *[Acymailing Filter on Orders not working](/forum/30-integrations/881026-acymailing-filter-on-orders-not-working#223853 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.5 -- PHP version -- : 5.3.10 -- Browser(s) name and version -- : Safari 6.2.8  I try to integrate Acymailing with Hikashop and move a user to a list when he buys a product. Created a filter in Acymailing with Hikashop customers - bought - product -&gt; move to list There is a completed order for that product in Hikashop. When I process &quot;View users&quot; there are 0 chosen I turned on Joomla Debug and it shows this query:  SELECT DISTINCT b.user&#95;email FROM jom30&#95;hikashop&#95;order&#95;product AS a LEFT JOIN jom30&#95;hikashop&#95;order AS c ON a.order&#95;id = c.order&#95;id LEFT JOIN jom30&#95;hikashop&#95;user AS b on c.order&#95;user&#95;id = b.user&#95;id WHERE c.order&#95;status IN ('') AND a.product&#95;id = 10  I think the problem is the order&#95;status .. checked in the database and the order&#95;status is &quot;confirmed&quot; The error is maybe the empty list but I cannot figure out why its empty. Maybe its a language problem - its german.  Thx Eva")*

That fixed it, thank you! Outstanding support ![:-)](/media/kunena/emoticons/3.png ":-)")

---

There are no kangaroos in Austria! ![;-)](/media/kunena/emoticons/24.png ";-)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84ODEwMjYtYWN5bWFpbGluZy1maWx0ZXItb24tb3JkZXJzLW5vdC13b3JraW5nP3RtcGw9bWFya2Rvd24=) 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.049 seconds

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