concretecms-community-store / community_store

An open, free and community developed eCommerce system for Concrete CMS
https://concretecms-community-store.github.io/community_store/
MIT License
106 stars 66 forks source link

Update title of product images when creating/updating products? #864

Closed mlocati closed 3 months ago

mlocati commented 3 months ago

A customer of mine has an online shop with thousands of product pictures.

She takes photos with his cell phone, and uploads them to the website.

Now she's having a situation like this:

immagine

As you can see, the file titles are not very "descriptive" (and she's having a hard time finding the correct photos).

What about adding the following new settings to the Store > Settings > Product Images dashboard page?

Section: File Titles Label: Automatically set the image titles to the product names Select with options:

  • never (selected by default)
  • always
  • only if the file title is the same as the file name

For example, if a product named "Red T-shirt" has 3 pictures named IMG_1.jpg (primary), IMG_2.jpg, and IMG_3.jpg, those pictures will have the titles "Red T-shirt", "Red T-shirt (2)", and "Red T-shirt (3)".

For batch processing, I'd also add a way to bach update the file titles for every product, with a brand new CLI command.

If that's ok, I can of course create a pull request.

mlocati commented 3 months ago

I forgot to mention that, if this settings is enabled, the file titles will be automatically updated when a product gets created/updaed.

Mesuva commented 3 months ago

This sounds great to me, I totally see where you are going with this.

The only other option I can think of is where a client might upload files with meaningful filenames, but they end up being shown with .jpg on the end. A client might upload 'Back of t-shirt.jpg'.

I wonder if we should consider an option where it uses the default title, but removes the file suffix automatically. Maybe it would also do a find and replace on underscores.

That would be a separate checkbox, not part of the three options you've proposed. (and just an idea, could come later, but maybe worth considering if you're creating a helper function to work out an image title)

The other considering is that the current store code will look at the image description and use that if it exists, before using the title. That complicates things a little. I think we'd perhaps keep that behaviour in place.

mlocati commented 3 months ago

What about these two <select>:

Automatically set the image titles to the product names

Automatically set the image descriptions to the product names

And this checkbox:

File title adjustments [ ] replace underscores with spaces

Mesuva commented 3 months ago

I may have confused things a bit by mentioning the descriptions. I'm just referring to this bit here: https://github.com/concretecms-community-store/community_store/blob/8fceb806a1455ab2045dc55aa31aa9a025361ac2/blocks/community_product/view.php#L560

It sets the lightbox title to the file description if it exists on the file, otherwise just uses the title.

So I don't think you'd need a second option, as that behaviour would continue.

But I also think we'd adjust the language a bit:

Set image titles to:

And a note could be added: If a file description has been added against a file, this will be displayed in lightbox captions, regardless of the setting above.

I don't think we need a separate option for replacing the underscores, I reckon just include that whenever file extensions are stripped - I can't imagine why you'd ever want them on a title.

mlocati commented 3 months ago
  • if the file title has not been alter since upload

alter or altered?

Mesuva commented 3 months ago

Sorry, yes, altered.

mlocati commented 3 months ago

When speaking with a native, I always ask myself if I'm wrong when somethings sounds strange to me. Glad this isn't the case 😜