I need category_id in onAfterCategoryCreate event

  • Posts: 2293
  • Thank you received: 315
7 years 7 months ago #267105

I try to create my own plugin and read the docs about it.

here is:

onAfterCategoryCreate(&$element)

This function will be triggered by HikaShop after a category is created successfully. The $element variable will be an object with the category information as attributes of the object including the category_id

I think that I can get category_id but when debug this event - I can't. It empty...
Why?


Я не явлюсь официальной службой поддержки!
Я здесь добровольно!

Хочешь получить купон на скидку Hikashop? Спроси меня как!
Attachments:

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 7 months ago #267120

Hello,

Please modify the HikaShop category class in order to place the trigger call after the category_id is set in the object

Replacing

	if($new)
		$dispatcher->trigger( 'onAfterCategoryCreate', array( & $element ) );
	else
		$dispatcher->trigger( 'onAfterCategoryUpdate', array( & $element ) );

	if(empty($element->$pkey)) {
		$element->$pkey = $status;
		if($ordering) {
			/* ... */
		}
	}
By
	if($new) {
		$element->$pkey = $status;
		$dispatcher->trigger( 'onAfterCategoryCreate', array( & $element ) );
	} else
		$dispatcher->trigger( 'onAfterCategoryUpdate', array( & $element ) );

	if($new && $ordering) {
		/* ... */
	}
So you will have that information in the "onAfterCategoryCreate" event.

We will update the package in our side.

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: progreccor

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

Time to create page: 0.058 seconds
Powered by Kunena Forum