Author Topic: reuse product image different file title  (Read 2574 times)

2cool

  • Jr. Member
  • **
  • Posts: 271
reuse product image different file title
« on: March 15, 2021, 16:43:13 pm »
For my shop I have lots of products using the same image with different product specifications.
Most of the time
Right now when I change 'File Title' and 'Displayed image subtitle' this is changed for all other products too.

Is it possible to have different titles and subtitles? or should I copy each image?

Regards,
Pas

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3664
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: reuse product image different file title
« Reply #1 on: March 15, 2021, 18:50:46 pm »
Should it not be possible to use two different media descriptions. But referring to the same image. Never tested.
Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1207
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: reuse product image different file title
« Reply #2 on: March 15, 2021, 20:29:53 pm »
You should copy each image, sorry
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

2cool

  • Jr. Member
  • **
  • Posts: 271
Re: reuse product image different file title
« Reply #3 on: March 15, 2021, 20:37:16 pm »
I was afraid of this answer :(
I normally duplicate a product and change the specifications (size and description) and use these changes also as file title and displayed image subtitle.

Is there an easy way to duplicate the images maybe?

Regards,
Pas

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1207
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: reuse product image different file title
« Reply #4 on: March 15, 2021, 20:46:53 pm »
Hmm, it was good to find out how and where the information is stored
- file title
- image subtitle

I don't think they attach to the product, but to the picture.
And according to your own words, you only have it in the DB once.

But I may be wrong, I don't know exactly if you are talking about a meta title or an image title.
A screenshot would help me
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

2cool

  • Jr. Member
  • **
  • Posts: 271
Re: reuse product image different file title
« Reply #5 on: March 15, 2021, 21:12:23 pm »
Hi Pinochico,

This is the settings 'File Title' and 'Displayed image subtitle'
I set both to product specifications. So for example 'ill add '95x190cm white'
Correct me if i'm wrong but this is displayed beneath each product image.

Thanks,
Pas

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1207
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: reuse product image different file title
« Reply #6 on: March 15, 2021, 22:10:54 pm »
In table #__virtuemart_product_medias are only:
id
virtuemart_product_id   
virtuemart_media_id
ordering

In table #__virtuemart_medias are only:
virtuemart_media_id
file_title
file_description

then all info about you wrote is connected only to medias.

If you have image in DB only one time (don't use upload button for the same image), then I have right - information are the same for the same picture.
If you need other info for image to other product, you have to upload the same image again and again for every product == you create new row in DB medias
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3664
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: reuse product image different file title
« Reply #7 on: March 15, 2021, 22:28:28 pm »
This a kind of wonky, but if You create a image media with a filename that exists You will get a new media item.
This item gets an extra extension added f.e _typeless
If You then add your image url to the media item, you will actually get two media items that point to the same image :)
In other words only one image stored on the disk, but two media items.

There must be a better way to do this, but it is actually doable.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4486
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: reuse product image different file title
« Reply #8 on: March 16, 2021, 11:03:45 am »
Nice trick Jörgen.
But a solution is perhaps to add a clone functionality for media(not possible in core for now) and call a ajax plugin for eg.
It's possible to add this button in the media list view, for eg. so you can select multiples medias
In tihs case you can use smae file.
The only problem i see, is if you update a file, only 1 record get updated with the new file.

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3664
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: reuse product image different file title
« Reply #9 on: March 16, 2021, 12:44:32 pm »
Hello Patrick

Quote
The only problem i see, is if you update a file, only 1 record get updated with the new file.

Do not really understand what You mean by update a file ? Changing  the file content, but keeping the name will still use the same file in every media item.

Do you perhaps mean changing file name for all items at once? If that is wanted, then you can just change the content of the image file.


Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3487
  • VirtueMart Version: 3.8.9
Re: reuse product image different file title
« Reply #10 on: March 16, 2021, 12:50:56 pm »
Quote
For my shop I have lots of products using the same image with different product specifications.
Most of the time
Right now when I change 'File Title' and 'Displayed image subtitle' this is changed for all other products too.

Is it possible to have different titles and subtitles? or should I copy each image?

Maybe this will help - you can adapt it to get the title to be the product name etc:-

This is very common - If you have NOT added meta data for an image you can "define it on the fly" in the product/category page displaying the image by making overrides to the views

Then your image ALT will be the product name that is displaying the image:

For product pages you can do

products/default_images.php

Code: [Select]

//QUORVIA ADD ALT AS product name  IF EMPTY META
if (empty ($this->product->images[0]->file_meta)) {
$this->product->images[0]->file_meta  = $this->product->product_name;
}

and if you want to do something similar for the category browse page

in and override to sublayouts/products.php
Code: [Select]

// display thumb image
//QUORVIA ADD ALT as description IF EMPTY META
if (empty ($product->images[0]->file_meta)) {
$product->images[0]->file_meta  = $product->product_name;
}
echo $product->images[0]->displayMediaThumb('class="browseProductImage " width="150" height="150" loading="lazy"', false);
?>

Regards
A

Joomla 3.9.27
php 7.4

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1207
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: reuse product image different file title
« Reply #11 on: March 16, 2021, 13:28:01 pm »
Don't forget about east europe language (č,ř,ž,... ) or french language (') in product name or mad admin (", ¨,...), then you must use php function for product name ($product->product_name).

If you forget, then html code will be broken (alt have to only one time use "")
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3487
  • VirtueMart Version: 3.8.9
Re: reuse product image different file title
« Reply #12 on: March 16, 2021, 14:41:20 pm »
Good point -

Not tested on a multi-lingual site

Luckily - I do not have a multi lingual site
Regards
A

Joomla 3.9.27
php 7.4

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4486
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: reuse product image different file title
« Reply #13 on: March 16, 2021, 15:01:26 pm »
Hello Patrick

Quote
The only problem i see, is if you update a file, only 1 record get updated with the new file.

Do not really understand what You mean by update a file ? Changing  the file content, but keeping the name will still use the same file in every media item.

Do you perhaps mean changing file name for all items at once? If that is wanted, then you can just change the content of the image file.


Jörgen @ Kreativ Fotografi

In the product form, you can replace a image by another image.
If you do this, then the reference for other clones in media DB using this image is not updated because media id is not the same for the clones.
Do you understand better ?

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3664
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: reuse product image different file title
« Reply #14 on: March 16, 2021, 15:49:42 pm »
Yes, I think I got what you mean. Will check later.

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.