Doesn't work for me. But based on how the category selection works my guess is that your test product doesn't have any variants.
I think it is the same issue with not being able to include sub-categories, the variant isn't being included because only the parent item has the brand associated with it?
Here is the coupon settings..
And here is the product that the brand is assigned to...
Here is the shopping cart where I tried to apply the coupon...no message appears, but the coupon is not applied...
But I created a test product, without any variants, and re-applied the same coupon code...
I can confirm that the issue is with variants in Hikashop. Hikashop does not store the variant product's manufacturer or categories with the individual product variant record...they rely on the parent product to obtain that information. This is also why (I presume) the category selection doesn't work for us. We have over 1,000 products and about 800 of these are variants (color, size, etc.).
So, this is what I started to do but I need your help to see how to complete this.
In the file /administrator/components/com_awocoupon/helpers/estore/hikashop/couponhandler.php in the function get_storemanufactuer near line 453 I changed:
$db->setQuery('SELECT product_manufacturer_id AS manufacturer_id, product_id FROM #__hikashop_prod
uct WHERE product_id IN ('.$ids.')');
to
$db->setQuery('SELECT parent.product_manufacturer_id AS manufacturer_id, variant.product_id As pro
duct_id FROM (#__hikashop_product parent join #__hikashop_product variant) WHERE ((parent.product_id = variant.product_parent_id) and (variant.product_parent_id <> 0)) AND variant.product_id in ('.$ids.')');
This works with my variant products, but of course it is excluding the items that have no variants and I'm not sure how to adjust this code to include both the original statement (which excludes variants) and my query which only returns variants :(
Okay, I don't have a clue if this is "correct" but it gets us closer to the results we needed. We are needing to sell gift cards for the holidays and this is all that I know how to do...I look forward to the correct way of handling this...I ended up using your original db query with one minor change and then merged the resulting object with my query resulting in the coupon/discount being applied to the product based on manufacturer be it a variant or a single product:
protected function get_storemanufacturer($ids) {
$db = JFactory::getDBO();
$db->setQuery('SELECT parent.product_manufacturer_id AS manufacturer_id, variant.product_id As product_id FROM (#__hikashop_product parent join #__hikashop_product variant) WHERE ((parent.product_id = variant.product_parent_id) and (variant.product_parent_id <> 0)) AND variant.product_id in ('.$ids.')');
$variants = $db->loadObjectList();
$db->setQuery('SELECT product_manufacturer_id AS manufacturer_id, product_id FROM #__hikashop_product WHERE product_manufacturer_id <> 0 AND product_id IN ('.$ids.')'); //manufacturer = 0 should be omitted here
$products = $db->loadObjectList();
$result = (object) array_merge((array) $products, (array) $variants); //merge db objects from both queries
return $result;
}
--> there may be a single query that would combine variants and single products but I couldn't figure it out and I needed the system to go live this weekend for holiday sales.
Thank you for your patience and please be kind ... I am not a programmer, just a 'hak'