Answer the question
In order to leave comments, you need to log in
How to regenerate images in Minishop 2 store?
I wanted to clarify how to regenerate all pictures through the CMS when changing the parameters in the file sources.
On the site in modstore in the description of CCK Minishop 2 it is written:
All preview images are generated when the image is loaded. You can specify the necessary parameters in the file source setting (MS has its own, of course).
When changing parameters, you can regenerate thumbnails for all product images at once.
Answer the question
In order to leave comments, you need to log in
Version MS2 2.1 to version 2.3 apparently the same way. In 2.4 the gallery has changed.
Perhaps it will work only for 1 product, there was a script for all products.
=================
Here is a script that will allow you to regenerate all photos. Run it from the admin panel to packages - Console. Console must be pre-installed.
<?php
$step = 5;
$offset = isset($_SESSION['galgenoffset']) && $_SESSION['galgenoffset'] ? $_SESSION['galgenoffset'] : 0;
$miniShop2 = $modx->getService('minishop2');
$modx->setLogLevel(MODX_LOG_LEVEL_ERROR);
$q = $modx->newQuery('msProductFile', array('parent' => 0));
$total = $modx->getCount('msProductFile', $q);
$q->sortby('product_id', 'ASC');
$q->sortby('rank', 'DESC');
$q->limit($step,$offset);
$resources = $modx->getCollection('msProductFile', $q);
foreach ($resources as $resource) {
$modx->runProcessor('mgr/gallery/generate', array('id' => $resource->id),
array('processors_path' => $modx->getOption('core_path').'components/minishop2/processors/'));
}
$_SESSION['galgenoffset'] = $offset + $step;
if ($_SESSION['galgenoffset'] >= $total) {
$sucsess = 100;
$_SESSION['Console']['completed'] = true;
unset($_SESSION['galgenoffset']);
} else {
$sucsess = round($_SESSION['galgenoffset'] / $total, 2) * 100;
$_SESSION['Console']['completed'] = false;
}
for ($i=0; $i<=100; $i++) {
if ($i <= $sucsess) {
print '=';
} else {
print '_';
}
}
$current = $_SESSION['galgenoffset'] ?
$_SESSION['galgenoffset'] :
($sucsess == 100 ? $total : 0);
print "\n";
print $sucsess.'% ('.$current.')'."\n\n";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question