HikaMarket default product category

  • Posts: 43
  • Thank you received: 0
5 years 1 week ago #206201

-- HikaMarket version -- : 1.6.3

Hi,

Currently the standard value for product category when adding a product in HikaMarket front-end is set to 'Product categories'. How do I change that to a blank value so that every vendor doesn't also add products to the root by mistake in addition to the actual/intended product category?

Not all vendors will understand the need to remove/delete the root category.

Thanks,
David

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

  • Posts: 24214
  • Thank you received: 3743
  • MODERATOR
5 years 1 week ago #206204

Hi,

In the view "productmarket | form", replace

	$categories = null;
	if(!empty($this->product->categories))
		$categories = array_keys($this->product->categories);
By
	$categories = null;
	if(!empty($this->product->categories) && !empty($this->product->product_id))
		$categories = array_keys($this->product->categories);
Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: DavidThor

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

  • Posts: 43
  • Thank you received: 0
5 years 1 week ago #206229

Thanks. Perfect! //David

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

  • Posts: 99
  • Thank you received: 7
  • Hikamarket Multivendor Hikashop Business
1 month 6 days ago #319889

Sorry for bringing back a 4 years old thread.

We have the same issue exactly so we applied Jerome's suggestion and the 'Product categories' indeed disappear when creating a product!

So far, so good!

Moving a little bit further we creates a test product leaving "Product categories" blank. When we saved the new product the 'Product categories' value was assigned to the product automatically.

Our question is...

Can we set the field "Product categories" to be mandatory so that the product is not created if left blank?

Thank you

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

  • Posts: 24214
  • Thank you received: 3743
  • MODERATOR
1 month 5 days ago #319930

Hello,

The HikaMarket (and HikaShop) algorithms are made to set-up a category if nothing is specified.
By default, HikaMarket will use the current category (you were browsing the vendor product listing) or "vendor root category".
I'm afraid that to change that, it will require to modify the HikaMarket core, the usage of the trigger "onBeforeProductCreate" could work but the way to detect that HikaMarket fill that empty field could be tricky.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Moderators: Obsidev
Time to create page: 0.071 seconds
Powered by Kunena Forum