R
R
rimo rur2021-06-09 11:44:27
MODX
rimo rur, 2021-06-09 11:44:27

Images of goods disappeared after updating minishop2 to MODX revo, where to dig?

Help a noob!!!
Today I updated minishop2 to the current version (before that it was beta already from 2014) and I lost all product images (in the admin panel and on the site - there are stubs from ms2). I tried to change the media loading in the settings instead of MS2Images set the filesystem - it does not help. I read the manual for installing and configuring ms2 - nothing is really described how to jump from the old version to the new one and everything remained in place. There is a comment in the docks that the product photo should be uploaded to the gallery (in the product card), but my galleries of all products became empty after the update (there are more than 1500 pieces and manually dragging is not an option). Can someone tell me where to dig? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Localhost, 2021-07-18
@selo

Regenerate images via Console add-on

<?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";

Don't forget to test or backup first

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question