Understand how product images get updated

  • Posts: 634
  • Thank you received: 16
6 years 2 months ago #288500

-- HikaShop version -- : 3.3
-- HikaMarket version -- : 2.0.1
-- Joomla version -- : 3.8.5
-- PHP version -- : 7.1

I am developing a way to handle duplicated images with different names in a product.

I made some algorithm that executes after clicking Save or Apply in the hikamarket product form.

I run this code on the event trigger OnAfterUpdate but I apparently find that any change in the images box where images can be deleted, uploaded or reordered is not yet reflected at that point

so my code is processing images not under the changes the user has made but on how images were before entering to edit the product.


At least this is how it looks to me, is like the reordering, deletion and creation of images in the table ' hikashop_files' is made after the execution of trigger OnAfterUpdate.

Am I right?


Victor.

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

  • Posts: 26007
  • Thank you received: 4004
  • MODERATOR
6 years 2 months ago #288510

Hello,

The way that HikaMarket handle the product is the same than HikaShop is handling the products.
Using the HikaShop trigger "onAfterProductUpdate", you will get the same content from HikaShop than from HikaMarket ; but depending the HikaMarket ACL, the product could have less data (for what the vendor cannot access).
Regarding the images ; they are processed after the trigger by the HikaShop core (same for HikaMarket).
You can see the code in "backSaveForm" or "frontSaveForm" (depending if you're in HikaShop or HikaMarket).
First will call :

$this->updateFiles($product, $status, 'images', $product->imagesorder);
And the second will call :
$productClass->updateFiles($product, $status, 'images', $product->imagesorder);
(where productClass is the HikaShop product class ; so the exact same function is called).

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

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

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