onAfterProductUpdate(&$element) working wrong?

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
10 years 5 months ago #194877

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 2.5

I built a plugin that triggers under this functions:

function onAfterProductCreate(&$element) {
            $this->fillProductDescription($element);
}
        
        function onAfterProductUpdate(&$element){
            $this->fillProductDescription($element);
        }

It works fine both from Frontend and Backend when creating or updating a product, BUT, when publishing or unpublishing from the product list action button it gets triggered too without passing the product as $element so my plugin works wrongly as it has no reference on which product fields it has to use.

Is this a bug?

How can I change the code to pass the porduct ID as a parameter form product listings?


Attachments:

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 5 months ago #194881

Hi,

The controller toggle use the HikaShop class to save the update object ; even if the object just contain the "product_id" and "product_published" data, it use the product class to save the element so the trigger (onAfterProductUpdate) will give you an "element" whit just this data (with also the "old" which contain the old value for the product).

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.

Time to create page: 0.062 seconds
Powered by Kunena Forum