Discount Unpublished Category

  • Posts: 147
  • Thank you received: 9
  • Hikashop Business
5 years 6 months 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: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 6 months 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: 147
  • Thank you received: 9
  • Hikashop Business
5 years 6 months 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: 5 years 6 months ago by Giscard.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 6 months 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: 147
  • Thank you received: 9
  • Hikashop Business
5 years 6 months ago #306296

Hello,

Thank you very much for your reply.

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

  • Posts: 147
  • Thank you received: 9
  • Hikashop Business
5 years 2 months ago #310290

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 2 months ago #310292

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

  • Posts: 147
  • Thank you received: 9
  • Hikashop Business
5 years 2 months ago #310303

Hello,

Here is the discount.

Thank you in advance.

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 2 months ago #310313

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

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

  • Posts: 147
  • Thank you received: 9
  • Hikashop Business
5 years 2 months ago #310328

Hello,

Yeah sure, I will send you everything you asked.

Thank you very much.

Edit: Send.

Last edit: 5 years 2 months ago by Giscard.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 2 months ago #310330

Hi,

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

$filters = array();
was missing before the line:
$filters[] = '(('.implode(') OR (', $categoriesFilters).'))';
in the patch I had previously made 3 months ago ( www.hikashop.com/forum/discount-coupon/8...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

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

  • Posts: 147
  • Thank you received: 9
  • Hikashop Business
5 years 2 months ago #310339

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

Time to create page: 0.072 seconds
Powered by Kunena Forum