News:

Looking for documentation? Take a look on our wiki

Main Menu

reuse product image different file title

Started by 2cool, March 15, 2021, 16:43:13 PM

Previous topic - Next topic

2cool

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

#1
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

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

2cool

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

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 for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

2cool

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

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 for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Jörgen

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

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

Hello Patrick

QuoteThe 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

QuoteFor 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



//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


// 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 4.4.5
php 8.1

pinochico

#11
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 for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

AH

Good point -

Not tested on a multi-lingual site

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

Joomla 4.4.5
php 8.1

Studio 42

Quote from: Jörgen on March 16, 2021, 12:44:32 PM
Hello Patrick

QuoteThe 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

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.