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

#   Discount Unpublished Category

##

- **[Giscard](/forum/user/56241-giscard "View Giscard's Profile")**
- [![Giscard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/56241-giscard "View Giscard's Profile") Topic Author
- [ Offline](/forum/user/56241-giscard)

Less More

- Posts: 150
- Thank you received: 11
-
-

7 years 6 months ago [\#306242](#306242) by [Giscard](/forum/user/56241-giscard "View Giscard's Profile")  *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#306242 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")* was created by *[Giscard](/forum/user/56241-giscard "View Giscard's Profile")*

Hello,

I want to discount a whole category with subcategories.
I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished.
I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.

My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?

Thank you in advance.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTc0MDctZGlzY291bnQtdW5wdWJsaXNoZWQtY2F0ZWdvcnk/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: 86556
- Thank you received: 14304
-
-

7 years 6 months ago [\#306265](#306265) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#306265 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hi,

Yes. As long as you activate the "Including sub categories" setting of the discount, it will take into account the sub categories of the selected categories in the coupon, whether they are published or unpublished.

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

- **[Giscard](/forum/user/56241-giscard "View Giscard's Profile")**
- [![Giscard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/56241-giscard "View Giscard's Profile") Topic Author
- [ Offline](/forum/user/56241-giscard)

Less More

- Posts: 150
- Thank you received: 11
-
-

7 years 6 months ago -  7 years 6 months ago [\#306282](#306282) by [Giscard](/forum/user/56241-giscard "View Giscard's Profile")  Replied by *[Giscard](/forum/user/56241-giscard "View Giscard's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#306282 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hello,

But this is not happening. I check "Including sub categories" and category: the category that I want, and the the products that are inside, have no discount.

The discount is active only if I publish the category and one sub category (or all the sub categories) for example.

Thank you in advance.

Last edit: 7 years 6 months ago by [Giscard](/forum/user/56241-giscard "View Giscard's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTc0MDctZGlzY291bnQtdW5wdWJsaXNoZWQtY2F0ZWdvcnk/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: 86556
- Thank you received: 14304
-
-

7 years 6 months ago [\#306283](#306283) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#306283 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hi,

I had looked at the coupon behavior, not the discount behavior when I answered you and had missed that you were talking about discounts.
Indeed, the discounts don't behave properly regarding unpublished sub categories. Like for coupons they should still take them into account.
We'll add a patch for that.
Change the code: Code:

$childs[$key] = $categoryClass-&gt;getChildren($discount-&gt;discount_category_id, true, array(), '', 0, 999, false, 'a.category_id'); $childs[$key] = array_merge($childs[$key], $categoryClass-&gt;getCategories($discount-&gt;discount_category_id, 'category_id'));

to: Code:

$childs[$key] = $categoryClass-&gt;getCategories($discount-&gt;discount_category_id, 'category_id, category_left, category_right'); if(!empty($childs[$key])) { $categoriesFilters = array(); foreach($childs[$key] as $category) { $categoriesFilters[] = 'category_left &gt;= ' . $category-&gt;category_left . ' AND category_right &lt;= ' . $category-&gt;category_right; } if(count($categoriesFilters)) { $filters[] = '(('.implode(') OR (', $categoriesFilters).'))'; hikashop_addACLFilters($filters, 'category_access'); $select = 'SELECT category_id FROM ' . hikashop_table('category') . ' WHERE ' . implode(' AND ',$filters); $this-&gt;database-&gt;setQuery($select); $childrenCats = $this-&gt;database-&gt;loadObjectList(); $childs[$key] = array_merge($childs[$key], $childrenCats); } }

in the file administrator/components/com_hikashop/classes/currency.php and it will work properly. We'll include the patch in the next release of HikaShop.

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

- **[Giscard](/forum/user/56241-giscard "View Giscard's Profile")**
- [![Giscard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/56241-giscard "View Giscard's Profile") Topic Author
- [ Offline](/forum/user/56241-giscard)

Less More

- Posts: 150
- Thank you received: 11
-
-

7 years 6 months ago [\#306296](#306296) by [Giscard](/forum/user/56241-giscard "View Giscard's Profile")  Replied by *[Giscard](/forum/user/56241-giscard "View Giscard's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#306296 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hello,

Thank you very much for your reply.

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

- **[Giscard](/forum/user/56241-giscard "View Giscard's Profile")**
- [![Giscard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/56241-giscard "View Giscard's Profile") Topic Author
- [ Offline](/forum/user/56241-giscard)

Less More

- Posts: 150
- Thank you received: 11
-
-

7 years 2 months ago [\#310290](#310290) by [Giscard](/forum/user/56241-giscard "View Giscard's Profile")  Replied by *[Giscard](/forum/user/56241-giscard "View Giscard's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#310290 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hello,

After the latest update the problem with the specific category fixed, but now I cant use a discount in a category and in her subs even I activate "Including sub categories".

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTc0MDctZGlzY291bnQtdW5wdWJsaXNoZWQtY2F0ZWdvcnk/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: 86556
- Thank you received: 14304
-
-

7 years 2 months ago [\#310292](#310292) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#310292 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hi,

I'm not able to reproduce the issue on my end.
Could you provide a screenshot of the settings of your discount ?

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

- **[Giscard](/forum/user/56241-giscard "View Giscard's Profile")**
- [![Giscard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/56241-giscard "View Giscard's Profile") Topic Author
- [ Offline](/forum/user/56241-giscard)

Less More

- Posts: 150
- Thank you received: 11
-
-

7 years 2 months ago [\#310303](#310303) by [Giscard](/forum/user/56241-giscard "View Giscard's Profile")  Replied by *[Giscard](/forum/user/56241-giscard "View Giscard's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#310303 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hello,

Here is the discount.

Thank you in advance.

- [ ![exp1.jpg](/forum/attachment/47567) ](/forum/attachment/47567 "exp1.jpg") [ ](/forum/attachment/47567?download=1 "exp1.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTc0MDctZGlzY291bnQtdW5wdWJsaXNoZWQtY2F0ZWdvcnk/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: 86556
- Thank you received: 14304
-
-

7 years 2 months ago [\#310313](#310313) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#310313 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hi,

As I'm still not able to reproduce the problem I'm afraid I'll have to look at the problem directly on your website.
Could you provide :
- a backend access
- a FTP access
- a link to the shop
- a link to this thread for reference
via our contact form so that we can look into it ?
[ www.hikashop.com/support/contact-us.html](https://www.hikashop.com/support/contact-us.html)

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

- **[Giscard](/forum/user/56241-giscard "View Giscard's Profile")**
- [![Giscard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/56241-giscard "View Giscard's Profile") Topic Author
- [ Offline](/forum/user/56241-giscard)

Less More

- Posts: 150
- Thank you received: 11
-
-

7 years 2 months ago -  7 years 2 months ago [\#310328](#310328) by [Giscard](/forum/user/56241-giscard "View Giscard's Profile")  Replied by *[Giscard](/forum/user/56241-giscard "View Giscard's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#310328 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hello,

Yeah sure, I will send you everything you asked.

Thank you very much.

Edit: Send.

Last edit: 7 years 2 months ago by [Giscard](/forum/user/56241-giscard "View Giscard's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2Rpc2NvdW50LWNvdXBvbi84OTc0MDctZGlzY291bnQtdW5wdWJsaXNoZWQtY2F0ZWdvcnk/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: 86556
- Thank you received: 14304
-
-

7 years 2 months ago [\#310330](#310330) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#310330 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hi,

Thank you for the accesses. I was able to found the issue.
The line: Code:

$filters = array();

was missing before the line: Code:

$filters[] = '(('.implode(') OR (', $categoriesFilters).'))';

in the patch I had previously made 3 months ago ( [ www.hikashop.com/forum/discount-coupon/8...category.html#306283](https://www.hikashop.com/forum/discount-coupon/897407-discount-unpublished-category.html#306283) ).
Adding that line, it's now working fine on your website as far as I could test.
In fact, the previous code, without that modification was working fine as long as you didn't had several discounts restricted on categories and not directly attached to the products.
That's why I didn't had the issue on my end as I had only one discount enabled with a category with sub categories.
And the update was actually not related to the issue, but it was the fact that you just had less discounts which didn't create the problem.

We'll add that change on our end.

The following user(s) said Thank You: [Giscard](/forum/user/56241-giscard "View Giscard's Profile")

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

- **[Giscard](/forum/user/56241-giscard "View Giscard's Profile")**
- [![Giscard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/56241-giscard "View Giscard's Profile") Topic Author
- [ Offline](/forum/user/56241-giscard)

Less More

- Posts: 150
- Thank you received: 11
-
-

7 years 2 months ago [\#310339](#310339) by [Giscard](/forum/user/56241-giscard "View Giscard's Profile")  Replied by *[Giscard](/forum/user/56241-giscard "View Giscard's Profile")* on topic *[Discount Unpublished Category](/forum/46-discount-coupon/897407-discount-unpublished-category#310339 "Hello,  I want to discount a whole category with subcategories. I have created an exta category (+ subs) for that reason, but I want these categories to be unpublished. I have insert products to user-categories of course, the categories that I have created are for helping me and discount them in back-end.  My question is: As I can see, I cant discount an unpublished hyper-category but I can discount all of its unpublished subcategories?  Thank you in advance.")*

Hello,

I understand now why there was a problem with discounts.
Thank you very much for your help nicolas.
As far as I tested it is working, as you said.

Thank you again.

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

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