Discount Unpublished Category

  • Posts: 28
  • Thank you received: 1
  • Hikashop Business
2 weeks 4 days ago #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.

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

  • Posts: 65661
  • Thank you received: 9585
  • MODERATOR
2 weeks 2 days ago #306265

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 or Create an account to join the conversation.

  • Posts: 28
  • Thank you received: 1
  • Hikashop Business
2 weeks 2 days ago #306282

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: 2 weeks 2 days ago by Giscard.

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

  • Posts: 65661
  • Thank you received: 9585
  • MODERATOR
2 weeks 2 days ago #306283

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:

$childs[$key] = $categoryClass->getChildren($discount->discount_category_id, true, array(), '', 0, 999, false, 'a.category_id');
						$childs[$key] = array_merge($childs[$key], $categoryClass->getCategories($discount->discount_category_id, 'category_id'));
to:
$childs[$key] = $categoryClass->getCategories($discount->discount_category_id, 'category_id, category_left, category_right');
						if(!empty($childs[$key])) {
							$categoriesFilters = array();
							foreach($childs[$key] as $category) {
								$categoriesFilters[] = 'category_left >= ' . $category->category_left . ' AND category_right <= ' . $category->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->database->setQuery($select);
								$childrenCats = $this->database->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 or Create an account to join the conversation.

  • Posts: 28
  • Thank you received: 1
  • Hikashop Business
2 weeks 1 day ago #306296

Hello,

Thank you very much for your reply.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum