Store images sorted by name when dropped as group

  • Posts: 634
  • Thank you received: 16
9 years 9 months ago #187880

-- HikaShop version -- : 2.3.5
-- HikaMarket version -- : 1.5.1
-- Joomla version -- : 3.3.6

In a massive process of data entry I'm throwing sets of 6 pictures in the image drop area in product frontend edition.

The problem is that there is no apparent logical criteria on how they get sorted there. I believe they just show by the order they have been stored in the system so the smaller ones always show as the main and first pictures.

I drop my sets ordered by name from 01 to 06 in a single drag&drop operation and I would like this order to be respected so the criteria would be filename ordering.

How can this be fixed? I believe this is a major need for most users.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 9 months ago #187881

Hi,

The images are sorted by order of upload (when upload by group) ; because they are not uploaded in the same call (all made using by ajax) there is no possibility to set a dynamic ordering.
But once the image uploaded, you can drag&drop them in order to change the ordering (and save the product to apply the modifications).

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.

  • Posts: 634
  • Thank you received: 16
9 years 9 months ago #187895

Jerome wrote: But once the image uploaded, you can drag&drop them in order to change the ordering (and save the product to apply the modifications).


Yes of course, but this is precisely what I want to avoid, having to reorder them product by product picture by picture.

Is there no way to change the ordering criteria to honour the alphabetical name order?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 9 months ago #187899

Hi,

The ordering is made thanks to a specific column in the HikaShop database.
So if you want to override that, you will have to override how HikaShop store his data in the database ; using a custom plugin and using the trigger "onBeforeProductSave" to change the ordering of the images depending their name.
But at this moment the user won't be able to reorder the images manually.

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.

  • Posts: 634
  • Thank you received: 16
9 years 9 months ago #187912

This sounds worth to try. But, is there some way that onBeforeProductSave differentiates between the first time a product is saved and all other times?

I mean, would make sense that a supposed onBeforeFirstProductSave would do the ordering and on later editions the user ordering if ever changed would be respected.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 9 months ago #187959

Hi,

To be precise, yes.
Because they are two different triggers in HikaShop : onBeforeProductCreate ; onBeforeProductUpdate
So can know where a product is created or updated.
During the update you can have the old product object and you can check the ordering of the images.

They are some possibilities but it requires some further analyze.

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.064 seconds
Powered by Kunena Forum