Skip to main content

I need category_id in onAfterCategoryCreate event

More
9 years 5 months ago #267105 by progreccor
I try to create my own plugin and read the docs about it.

here is:
Code:
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? Спроси меня как!

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

More
9 years 5 months ago #267120 by Jerome
Hello,

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

Replacing
Code:
if($new) $dispatcher->trigger( 'onAfterCategoryCreate', array( & $element ) ); else $dispatcher->trigger( 'onAfterCategoryUpdate', array( & $element ) ); if(empty($element->$pkey)) { $element->$pkey = $status; if($ordering) { /* ... */ } }
By
Code:
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.
The following user(s) said Thank You: progreccor

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

Time to create page: 0.200 seconds
Powered by Kunena Forum