Hello
Environment
- RO CSVI 9.11.0
- Joomla 5.4.7
- VirtueMart 4.8.0.11339
- PHP 8.4.24
Summary
The VirtueMart import addon falls back to "images/stories/virtuemart/..." when the
image location setting of an import template is left empty. That path is a legacy
VirtueMart location and has not been the VirtueMart default for a long time.
VirtueMart 4 ships these defaults in
administrator/components/com_virtuemart/virtuemart_defaults.cfg-dist:
media_category_path=images/virtuemart/category/
media_product_path=images/virtuemart/product/
media_manufacturer_path=images/virtuemart/manufacturer/
media_vendor_path=images/virtuemart/vendor/
VirtueMart itself treats the old path purely as a backward-compatibility fallback:
its installer copies images/stories/virtuemart/* into images/virtuemart/*, and
its media helper has a method literally named getStoriesFb() (stories fallback)
that only kicks in when the modern folder is missing.
Affected code
plugins/csviaddon/virtuemart/com_virtuemart/model/import/product.php:1696
$imgPath = $this->template->get('file_location_product_files', 'images/stories/virtuemart/product/');
plugins/csviaddon/virtuemart/com_virtuemart/model/import/media.php:450, 453, 511, 514
plugins/csviaddon/virtuemart/com_virtuemart/model/import/category.php:665
plugins/csviaddon/virtuemart/com_virtuemart/model/import/manufacturer.php:467
Why it triggers on a saved template
components/com_csvi/src/Entity/Template.php:278-281 replaces an empty string with
the supplied default:
elseif ('' === $value)
{
$value = $default;
}
So a template that stores file_location_product_files as "" does not mean
"use no prefix", it means "use images/stories/virtuemart/product/".
I checked my database and 8 of my templates store these settings as empty strings,
including templates I created myself, simply because I never typed anything in
that field.
Why it is easy to miss in the UI
The form fields use hint= instead of default=, for example in
plugins/csviaddon/virtuemart/com_virtuemart/tmpl/import/image.xml:
<field name="file_location_product_files" type="Text" class="form-control"
hint="images/stories/virtuemart/product/"/>
Since hint renders as an HTML placeholder, the admin sees an empty text box with
the old path greyed out. It reads as "nothing configured", while it is in fact the
value that will be applied. Same in media_image.xml, category_image.xml and
manufacturer_image.xml.
Impact
On a site migrated from Joomla 3 / VirtueMart 2 to Joomla 5 / VirtueMart 4, any
import that processes an image writes file_url values such as
images/stories/virtuemart/product/foo.jpg into #__virtuemart_medias, pointing at
an obsolete folder that the site owner is trying to retire. It also recreates the
folder on disk. The images then resolve to the wrong location or 404 once the old
folder is deleted.
Suggested fix
Instead of a hardcoded string, use the value VirtueMart itself is configured with:
$imgPath = $this->template->get('file_location_product_files', VmConfig::get('media_product_path', 'images/virtuemart/product/'));
and the equivalent for media_category_path and media_manufacturer_path. That way
the addon follows whatever the shop is actually configured to use, and the hint
attributes could be updated to match.
Workaround for other users
Open each VirtueMart import template, Options tab, Images section, and type the
path explicitly instead of leaving the field empty:
images/virtuemart/product/
images/virtuemart/category/
images/virtuemart/manufacturer/
Thanks for looking into it.
Regards
Greg
- webmastergreg
- RO CSVI
- Friday, 21 August 2026
- Subscribe via email
There are no replies made for this post yet.
Be one of the first to reply to this post!
Be one of the first to reply to this post!