Подмена значений полей при импорте из csv (miniShop2)

Здравствуйте! Помогите, пожалуйста, не первый день бьюсь.
Пытаюсь грузить на сайт из .csv минишоповским скриптом от Василия. При создании товаров ряд значений полей почему-то записывается по умолчанию, независимо от данных в файле. При этом файл читается корректно, в режиме debug правильно формируется массив данных для записи, а вот дальше проблемы.

Подробнее.Сайт на MODX Revolution 2.7.0-pl, хостинг beget, PHP Version 7.1.33-3+ubuntu18.04.1, используется miniShop2. Я не владелец сайта, просто гружу контент, потому настраивать под себя не могу и всех прав не имею — только вход в админку. Запускать пришлось из приложения Console, при этом был вынужден изменить код для ввода с параметров на прямой ввод констант в окно кода:
$file = "core/import/Test2.txt";
$fields = "pagetitle,parent,content,template,source,longtitle";
$update = (bool) TRUE;
$key = "longtitle";
$is_debug = (bool) TRUE;
$delimeter = "|";
И еще поправить расширение файла в тексте скрипта на txt, так как csv мне грузить не разрешается.
elseif (!preg_match('/\.txt$/i', $file)) {
	$modx->log(modX::LOG_LEVEL_ERROR, 'Wrong file extension. File must be an *.csv.');
	exit;
}

Сам код взял отсюда.

Пример того, что получается. Параметры ввода выше. Данные файла
"test1"|"5231"|"тест1,<br>
тест<br>
""тест"" тест"|"2"|"test1long"|
"test2"|"5231"|"тест2,<br>
тест<br>
тест тест"|"2"|"test2long"|

Результат работы:
[2020-02-10 03:57:29] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 25)
Trying to set time limit = 600 sec: error
[2020-02-10 03:57:29] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 72)
Raw data for import: 
Array
(
    [0] => test1
    [1] => 5231
    [2] => тест1,

тест

"тест" тест
    [3] => 2
    [4] => test1long
    [5] => 
)
[2020-02-10 03:57:29] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 106)
Array with importing data: 
Array
(
    [pagetitle] => test1
    [parent] => 5231
    [content] => тест1,

тест

"тест" тест
    [source] => 2
    [longtitle] => test1long
    [class_key] => msProduct
    [context_key] => web
    [tvs] => 
)
[2020-02-10 03:57:29] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 123)
SQL query for check for duplicate: 
SELECT msProduct.id FROM `modx_site_content` AS `msProduct` JOIN `modx_ms2_products` `Data` ON msProduct.id = Data.id WHERE `msProduct`.`longtitle` = 'test1long' 
[2020-02-10 03:57:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
No foreign key definition for parentClass: msProduct using relation alias: Data
[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1129)
Could not getOne: foreign key definition for alias Data not found.
[2020-02-10 03:57:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
No foreign key definition for parentClass: msProduct using relation alias: msProductData
[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1250)
Foreign key definition for class , alias msProductData not found, or cardinality is not 'one'.
[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1256)
Could not add related object! Array
(
    [id] => 
    [article] => 
    [price] => 0
    [old_price] => 0
    [weight] => 0
    [image] => 
    [thumb] => 
    [vendor] => 0
    [made_in] => 
    [new] => 
    [popular] => 
    [favorite] => 
    [tags] => 
    [color] => 
    [size] => 
    [source] => 1
)
[2020-02-10 03:57:29] (ERROR @ /home/s19231/www/core/model/modx/modx.class.php : 1670)
[OnDocFormSave]
[2020-02-10 03:57:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
No foreign key definition for parentClass: msProduct using relation alias: Data

[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1129)
Could not getOne: foreign key definition for alias Data not found.

[2020-02-10 03:57:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
No foreign key definition for parentClass: msProduct using relation alias: msProductData

[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1250)
Foreign key definition for class , alias msProductData not found, or cardinality is not 'one'.

[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1256)
Could not add related object! Array
(
    [id] => 
    [article] => 
    [price] => 0
    [old_price] => 0
    [weight] => 0
    [image] => 
    [thumb] => 
    [vendor] => 0
    [made_in] => 
    [new] => 
    [popular] => 
    [favorite] => 
    [tags] => 
    [color] => 
    [size] => 
    [source] => 1
)

[2020-02-10 03:57:29] (ERROR @ /home/s19231/www/core/model/modx/modx.class.php : 1670)
[OnDocFormSave]
[2020-02-10 03:57:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
No foreign key definition for parentClass: msProduct using relation alias: Data

[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1129)
Could not getOne: foreign key definition for alias Data not found.

[2020-02-10 03:57:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
No foreign key definition for parentClass: msProduct using relation alias: msProductData

[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1250)
Foreign key definition for class , alias msProductData not found, or cardinality is not 'one'.

[2020-02-10 03:57:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1256)
Could not add related object! Array
(
    [id] => 
    [article] => 
    [price] => 0
    [old_price] => 0
    [weight] => 0
    [image] => 
    [thumb] => 
    [vendor] => 0
    [made_in] => 
    [new] => 
    [popular] => 
    [favorite] => 
    [tags] => 
    [color] => 
    [size] => 
    [source] => 1
)

[2020-02-10 03:57:29] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 156)
Successful create: 
Array
(
    [id] => 6631
)
[2020-02-10 03:57:29] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 184)
You in debug mode, so we process only 1 row. Time: 0.7503481 s

Значения полей созданного товара
Array
(
    [id] => 6631
    [type] => document
    [contentType] => text/html
    [pagetitle] => test1
    [longtitle] => test1long
    [description] => 
    [alias] => test1
    [alias_visible] => 1
    [link_attributes] => 
    [published] => 
    [pub_date] => 0
    [unpub_date] => 0
    [parent] => 5231
    [isfolder] => 
    [introtext] => 
    [content] => тест1,

тест

"тест" тест
    [richtext] => 1
    [template] => 0
    [menuindex] => 35
    [searchable] => 1
    [cacheable] => 1
    [createdby] => 6060
    [createdon] => 2020-02-10 03:57:29
    [editedby] => 0
    [editedon] => 0
    [deleted] => 
    [deletedon] => 0
    [deletedby] => 0
    [publishedon] => 0
    [publishedby] => 0
    [menutitle] => 
    [donthit] => 
    [privateweb] => 
    [privatemgr] => 
    [content_dispo] => 0
    [hidemenu] => 
    [class_key] => msProduct
    [context_key] => web
    [content_type] => 1
    [uri] => test1
    [uri_override] => 0
    [hide_children_in_tree] => 0
    [show_in_tree] => 0
    [exclude_alias_in_childs] => 0
    [properties] => Array
        (
            [stercseo] => Array
                (
                    [index] => 1
                    [follow] => 1
                    [sitemap] => 1
                    [priority] => 0.5
                    [changefreq] => weekly
                )

        )

    [article] => 
    [price] => 0
    [old_price] => 0
    [weight] => 0
    [image] => 
    [thumb] => 
    [vendor] => 0
    [made_in] => 
    [new] => 
    [popular] => 
    [favorite] => 
    [tags] => 
    [color] => 
    [size] => 
    [source] => 1
    [vendor.id] => 
    [vendor.name] => 
    [vendor.resource] => 0
    [vendor.country] => 
    [vendor.logo] => 
    [vendor.address] => 
    [vendor.phone] => 
    [vendor.fax] => 
    [vendor.email] => 
    [vendor.description] => 
    [vendor.properties] => 
)

Получается, что массив записан правильно, товар создается, но процессор create выдает ошибки и заменяет ряд полей своими значениями (в этом примере поле source, в которое записывается 1 вместо 2, но то же, например, с article (всегда записывается пустая строка).

Что можно сделать?

Еще есть сложности с режимом обновлений, с полями id, alias, uri, но это вроде преодолимо, а без загрузки Source смыл теряется.

PHP я базово понимаю, но в MODX, MiniShop, SQL разбираться уже сложно.

Большое спасибо за помошь!
Павел
10 февраля 2020, 05:03
modx.pro
75
0

Комментарии: 3

Павел
12 февраля 2020, 03:47
0
Еще немного поисследовал поведение. Судя по всему, перезаписывается всегда один и тот же массив, который отражен в логе (правда, с пометкой «не удалось создать»):

[id] =>
[article] =>
[price] => 0
[old_price] => 0
[weight] => 0
[image] =>
[thumb] =>
[vendor] => 0
[made_in] =>
[new] =>
[popular] =>
[favorite] =>
[tags] =>
[color] =>
[size] =>
[source] => 1

Но вот удается создать, блин, судя по результату. Там, где пусто, записывается "".
При этом далее присваивается новый id, так что id — это единственное поле из всего этого списка, которое не остается со значением как в списке.
И еще не так, как в csv-файле, пишется значение поля menuindex. Уж не знаю, о чем это говорит.

Может, дело в каких-то системных параметрах, или какие-то плагины перехватывают события? Как это можно проверить? Потому что на тестовых серверах же все проверяли, у всех работает.

Если ничего не поможет, имеет ли смысл поправить скрипт следующим образом — прописать дополнительно после вызова процессора эти поля через set и save, а уже потом вернуться к обработке галереи? Или как лучше?
    Павел
    13 февраля 2020, 02:19
    0
    Продолжение истории. Вот то же, но с двумя добавленными рисунками галереи. Не загрузились никуда.

    В поля добавлено gallery,gallery
    В файл |«core/import/1.jpg»|«core/import/2.jpg»
    Хвост лога (до этого все аналогично предыдущему)

    [2020-02-13 02:06:29] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 168)
    Importing images: 
    Array
    (
        [0] => core/import/1.jpg
        [1] => core/import/2.jpg
    )
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
    No foreign key definition for parentClass: msProduct using relation alias: Data
    [2020-02-13 02:06:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1129)
    Could not getOne: foreign key definition for alias Data not found.
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
    No foreign key definition for parentClass: msProduct using relation alias: msProductData
    [2020-02-13 02:06:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1250)
    Foreign key definition for class , alias msProductData not found, or cardinality is not 'one'.
    [2020-02-13 02:06:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1256)
    Could not add related object! Array
    (
        [id] => 
        [article] => 
        [price] => 0
        [old_price] => 0
        [weight] => 0
        [image] => 
        [thumb] => 
        [vendor] => 0
        [made_in] => 
        [new] => 
        [popular] => 
        [favorite] => 
        [tags] => 
        [color] => 
        [size] => 
        [source] => 1
    )
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 2369)
    xPDOObject::isDirty() -- Attempt to check if an unknown field (rank) has been modified.
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1452)
    Error 42000 executing statement:
    INSERT INTO  () VALUES ()
    Array
    (
        [0] => 42000
        [1] => 1064
        [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() VALUES ()' at line 1
    )
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (INFO @ /home/s19231/www/core/components/minishop2/model/minishop2/msproductfile.class.php : 183)
    [miniShop2] phpThumb messages for "/6698/43149578f613e527801af67c1b4d1c3ed250751e.jpg". Array
    (
        [0] => phpThumb() v1.7.15-201810050741 in file "phpthumb.class.php" on line 229
        [1] => setCacheDirectory() starting with config_cache_directory = "/home/s19231/www/core/cache/phpthumb/" in file "phpthumb.class.php" on line 1005
        [2] => setting config_cache_directory to $this->realPathSafe(/home/s19231/www/core/cache/phpthumb) = "/home/s19231/www/core/cache/phpthumb" in file "phpthumb.class.php" on line 1033
        [3] => setSourceFilename(/home/s19231/www/ms_rSw1vN) set $this->sourceFilename to "/home/s19231/www/ms_rSw1vN" in file "phpthumb.class.php" on line 294
        [4] => Addding ImageMagick formats to $AvailableImageOutputFormats (text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 963
        [5] => $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 969
        [6] => $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 980
        [7] => $this->thumbnailFormat set to $this->f "png" in file "phpthumb.class.php" on line 987
        [8] => $this->thumbnailQuality set to "90" in file "phpthumb.class.php" on line 997
        [9] => $this->sourceFilename set to "/home/s19231/www/ms_rSw1vN" in file "phpthumb.class.php" on line 894
        [10] => SetCacheFilename() _src set from md5($this->sourceFilename) "/home/s19231/www/ms_rSw1vN" = "599784eb771f5d738b28521b91c099fb" in file "phpthumb.class.php" on line 3542
        [11] => SetCacheFilename() _par set from md5(_bg000000_farC_zcT_h90_w120_dpi150) in file "phpthumb.class.php" on line 3575
        [12] => starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 3340
        [13] => getimagesize(/home/s19231/www/ms_rSw1vN) says image is 1024x768 in file "phpthumb.class.php" on line 3350
        [14] => $this->useRawIMoutput=false because "bg" is set in file "phpthumb.class.php" on line 1589
        [15] => $this->useRawIMoutput=false after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1595
        [16] => phpThumb_tempnam() returning "/home/s19231/www/core/cache/phpthumb/pThumbNxdqIO" in file "phpthumb.class.php" on line 4377
        [17] => ImageMagickSwitchAvailable(thumbnail) = 1 in file "phpthumb.class.php" on line 1531
        [18] => getimagesize(/home/s19231/www/ms_rSw1vN) SUCCEEDED: Array
    (
        [0] => 1024
        [1] => 768
        [2] => 2
        [3] => width="1024" height="768"
        [bits] => 8
        [channels] => 3
        [mime] => image/jpeg
    )
     in file "phpthumb.class.php" on line 1686
        [19] => ImageMagickSwitchAvailable(density) = 1 in file "phpthumb.class.php" on line 1531
        [20] => getimagesize(/home/s19231/www/ms_rSw1vN) returned [w=1024;h=768;f=2] in file "phpthumb.class.php" on line 1701
        [21] => source dimensions set to 1024x768 in file "phpthumb.class.php" on line 1704
        [22] => SetOrientationDependantWidthHeight() starting with "1024"x"768" in file "phpthumb.class.php" on line 3319
        [23] => SetOrientationDependantWidthHeight() setting w="120", h="90" in file "phpthumb.class.php" on line 3335
        [24] => ImageMagickSwitchAvailable(repage) = 1 in file "phpthumb.class.php" on line 1531
        [25] => Remaining $this->fltr after ImageMagick: (array(0) { } ) in file "phpthumb.class.php" on line 2248
        [26] => ImageMagick called as (convert '/home/s19231/www/ms_rSw1vN[0]' -flatten -density '150' -thumbnail 'x90' -gravity north -crop '120x90+0+0' +repage png:'/home/s19231/www/core/cache/phpthumb/pThumbNxdqIO' 2>&1) in file "phpthumb.class.php" on line 2266
        [27] => ImageMagick failed with message (convert: unable to open image 'png:/home/s19231/www/core/cache/phpthumb/pThumbNxdqIO': No such file or directory @ error/blob.c/OpenBlob/3497.) in file "phpthumb.class.php" on line 2271
        [28] => deleting "/home/s19231/www/core/cache/phpthumb/pThumbNxdqIO" in file "phpthumb.class.php" on line 2303
        [29] => ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3386
        [30] => SetOrientationDependantWidthHeight() starting with "1024"x"768" in file "phpthumb.class.php" on line 3319
        [31] => SetOrientationDependantWidthHeight() setting w="120", h="90" in file "phpthumb.class.php" on line 3335
        [32] => EXIF thumbnail extraction: (size=4834; type="2"; 160x120) in file "phpthumb.class.php" on line 3443
        [33] => starting SourceImageToGD() in file "phpthumb.class.php" on line 3701
        [34] => starting ImageCreateFromFilename(/home/s19231/www/ms_rSw1vN) in file "phpthumb.class.php" on line 3616
        [35] => ImageCreateFromFilename found ($getimagesizeinfo[2]==2) in file "phpthumb.class.php" on line 3625
        [36] => Calling imagecreatefromjpeg(/home/s19231/www/ms_rSw1vN) in file "phpthumb.class.php" on line 3633
        [37] => Not using EXIF thumbnail data because $this->gdimg_source is already set in file "phpthumb.class.php" on line 3769
        [38] => CalculateThumbnailDimensions() starting with [W,H,sx,sy,sw,sh] initially set to [1024,768,,,,] in file "phpthumb.class.php" on line 3191
        [39] => CalculateThumbnailDimensions() starting with [x,y,w,h] initially set to [0,0,1024,768] in file "phpthumb.class.php" on line 3206
        [40] => CreateGDoutput() returning canvas "120x90" in file "phpthumb.class.php" on line 3314
        [41] => ImageResizeFunction($o, $s, 0, 0, 0, 0, 120, 90, 1024, 768) in file "phpthumb.class.php" on line 4352
        [42] => memory_get_usage() after copy-resize = 5444424 in file "phpthumb.class.php" on line 426
        [43] => memory_get_usage() after imagedestroy = 5444512 in file "phpthumb.class.php" on line 428
        [44] => AntiOffsiteLinking() says this is allowed in file "phpthumb.class.php" on line 2510
        [45] => skipping AlphaChannelFlatten() because ($this->thumbnailFormat == "png") in file "phpthumb.class.php" on line 2573
        [46] => GenerateThumbnail() completed successfully in file "phpthumb.class.php" on line 440
        [47] => imageinterlace($this->gdimg_output, 1) in file "phpthumb.class.php" on line 470
        [48] => RenderOutput() attempting imagepng($this->gdimg_output) in file "phpthumb.class.php" on line 473
        [49] => Specified thumbnailQuality "90" is outside the accepted range (0-9, or -1). Using 6 as default value. in file "phpthumb.class.php" on line 517
        [50] => RenderOutput() completing with $this->outputImageData = 30732 bytes in file "phpthumb.class.php" on line 571
    )
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 2369)
    xPDOObject::isDirty() -- Attempt to check if an unknown field (rank) has been modified.
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1452)
    Error 42000 executing statement:
    INSERT INTO  () VALUES ()
    Array
    (
        [0] => 42000
        [1] => 1064
        [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() VALUES ()' at line 1
    )
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 240)
    Error 42000 executing statement: 
    Array
    (
        [0] => 42000
        [1] => 1064
        [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `msProductFile` WHERE  ( `msProductFile`.`product_id` IS NULL AND `msProductF' at line 1
    )
    [2020-02-13 02:06:29] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 184)
    Successful upload  "core/import/1.jpg": 
    Array
    (
        [id] => 
        [product_id] => 6698
        [parent] => 0
        [name] => 1
        [file] => 43149578f613e527801af67c1b4d1c3ed250751e.jpg
        [path] => 6698/
        [source] => 1
        [type] => image
        [rank] => 0
        [createdon] => 2020-02-13 02:06:29
        [createdby] => 6060
        [hash] => 43149578f613e527801af67c1b4d1c3ed250751e
        [properties] => Array
            (
                [size] => 780831
                [width] => 1024
                [height] => 768
                [bits] => 8
                [mime] => image/jpeg
            )
    
        [url] => /6698/43149578f613e527801af67c1b4d1c3ed250751e.jpg
    )
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
    No foreign key definition for parentClass: msProduct using relation alias: Data
    [2020-02-13 02:06:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1129)
    Could not getOne: foreign key definition for alias Data not found.
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1826)
    No foreign key definition for parentClass: msProduct using relation alias: msProductData
    [2020-02-13 02:06:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1250)
    Foreign key definition for class , alias msProductData not found, or cardinality is not 'one'.
    [2020-02-13 02:06:29] (WARN @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1256)
    Could not add related object! Array
    (
        [id] => 
        [article] => 
        [price] => 0
        [old_price] => 0
        [weight] => 0
        [image] => 
        [thumb] => 
        [vendor] => 0
        [made_in] => 
        [new] => 
        [popular] => 
        [favorite] => 
        [tags] => 
        [color] => 
        [size] => 
        [source] => 1
    )
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 2369)
    xPDOObject::isDirty() -- Attempt to check if an unknown field (rank) has been modified.
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1452)
    Error 42000 executing statement:
    INSERT INTO  () VALUES ()
    Array
    (
        [0] => 42000
        [1] => 1064
        [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() VALUES ()' at line 1
    )
    [2020-02-13 02:06:29] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:30] (INFO @ /home/s19231/www/core/components/minishop2/model/minishop2/msproductfile.class.php : 183)
    [miniShop2] phpThumb messages for "/6698/14d68190d97c561a8b8fcd5e4184b483578ee8d4.jpg". Array
    (
        [0] => phpThumb() v1.7.15-201810050741 in file "phpthumb.class.php" on line 229
        [1] => setCacheDirectory() starting with config_cache_directory = "/home/s19231/www/core/cache/phpthumb/" in file "phpthumb.class.php" on line 1005
        [2] => setting config_cache_directory to $this->realPathSafe(/home/s19231/www/core/cache/phpthumb) = "/home/s19231/www/core/cache/phpthumb" in file "phpthumb.class.php" on line 1033
        [3] => setSourceFilename(/home/s19231/www/ms_Xx9KPT) set $this->sourceFilename to "/home/s19231/www/ms_Xx9KPT" in file "phpthumb.class.php" on line 294
        [4] => Addding ImageMagick formats to $AvailableImageOutputFormats (text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 963
        [5] => $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 969
        [6] => $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 980
        [7] => $this->thumbnailFormat set to $this->f "png" in file "phpthumb.class.php" on line 987
        [8] => $this->thumbnailQuality set to "90" in file "phpthumb.class.php" on line 997
        [9] => $this->sourceFilename set to "/home/s19231/www/ms_Xx9KPT" in file "phpthumb.class.php" on line 894
        [10] => SetCacheFilename() _src set from md5($this->sourceFilename) "/home/s19231/www/ms_Xx9KPT" = "a16edb955bcfdd83a6374c361eb3dd22" in file "phpthumb.class.php" on line 3542
        [11] => SetCacheFilename() _par set from md5(_bg000000_farC_zcT_h90_w120_dpi150) in file "phpthumb.class.php" on line 3575
        [12] => starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 3340
        [13] => getimagesize(/home/s19231/www/ms_Xx9KPT) says image is 1024x768 in file "phpthumb.class.php" on line 3350
        [14] => $this->useRawIMoutput=false because "bg" is set in file "phpthumb.class.php" on line 1589
        [15] => $this->useRawIMoutput=false after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1595
        [16] => phpThumb_tempnam() returning "/home/s19231/www/core/cache/phpthumb/pThumbjfurAV" in file "phpthumb.class.php" on line 4377
        [17] => ImageMagickSwitchAvailable(thumbnail) = 1 in file "phpthumb.class.php" on line 1531
        [18] => getimagesize(/home/s19231/www/ms_Xx9KPT) SUCCEEDED: Array
    (
        [0] => 1024
        [1] => 768
        [2] => 2
        [3] => width="1024" height="768"
        [bits] => 8
        [channels] => 3
        [mime] => image/jpeg
    )
     in file "phpthumb.class.php" on line 1686
        [19] => ImageMagickSwitchAvailable(density) = 1 in file "phpthumb.class.php" on line 1531
        [20] => getimagesize(/home/s19231/www/ms_Xx9KPT) returned [w=1024;h=768;f=2] in file "phpthumb.class.php" on line 1701
        [21] => source dimensions set to 1024x768 in file "phpthumb.class.php" on line 1704
        [22] => SetOrientationDependantWidthHeight() starting with "1024"x"768" in file "phpthumb.class.php" on line 3319
        [23] => SetOrientationDependantWidthHeight() setting w="120", h="90" in file "phpthumb.class.php" on line 3335
        [24] => ImageMagickSwitchAvailable(repage) = 1 in file "phpthumb.class.php" on line 1531
        [25] => Remaining $this->fltr after ImageMagick: (array(0) { } ) in file "phpthumb.class.php" on line 2248
        [26] => ImageMagick called as (convert '/home/s19231/www/ms_Xx9KPT[0]' -flatten -density '150' -thumbnail 'x90' -gravity north -crop '120x90+0+0' +repage png:'/home/s19231/www/core/cache/phpthumb/pThumbjfurAV' 2>&1) in file "phpthumb.class.php" on line 2266
        [27] => ImageMagick failed with message (convert: unable to open image 'png:/home/s19231/www/core/cache/phpthumb/pThumbjfurAV': No such file or directory @ error/blob.c/OpenBlob/3497.) in file "phpthumb.class.php" on line 2271
        [28] => deleting "/home/s19231/www/core/cache/phpthumb/pThumbjfurAV" in file "phpthumb.class.php" on line 2303
        [29] => ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3386
        [30] => SetOrientationDependantWidthHeight() starting with "1024"x"768" in file "phpthumb.class.php" on line 3319
        [31] => SetOrientationDependantWidthHeight() setting w="120", h="90" in file "phpthumb.class.php" on line 3335
        [32] => EXIF thumbnail extraction: (size=4295; type="2"; 160x120) in file "phpthumb.class.php" on line 3443
        [33] => starting SourceImageToGD() in file "phpthumb.class.php" on line 3701
        [34] => starting ImageCreateFromFilename(/home/s19231/www/ms_Xx9KPT) in file "phpthumb.class.php" on line 3616
        [35] => ImageCreateFromFilename found ($getimagesizeinfo[2]==2) in file "phpthumb.class.php" on line 3625
        [36] => Calling imagecreatefromjpeg(/home/s19231/www/ms_Xx9KPT) in file "phpthumb.class.php" on line 3633
        [37] => Not using EXIF thumbnail data because $this->gdimg_source is already set in file "phpthumb.class.php" on line 3769
        [38] => CalculateThumbnailDimensions() starting with [W,H,sx,sy,sw,sh] initially set to [1024,768,,,,] in file "phpthumb.class.php" on line 3191
        [39] => CalculateThumbnailDimensions() starting with [x,y,w,h] initially set to [0,0,1024,768] in file "phpthumb.class.php" on line 3206
        [40] => CreateGDoutput() returning canvas "120x90" in file "phpthumb.class.php" on line 3314
        [41] => ImageResizeFunction($o, $s, 0, 0, 0, 0, 120, 90, 1024, 768) in file "phpthumb.class.php" on line 4352
        [42] => memory_get_usage() after copy-resize = 5499816 in file "phpthumb.class.php" on line 426
        [43] => memory_get_usage() after imagedestroy = 5499904 in file "phpthumb.class.php" on line 428
        [44] => AntiOffsiteLinking() says this is allowed in file "phpthumb.class.php" on line 2510
        [45] => skipping AlphaChannelFlatten() because ($this->thumbnailFormat == "png") in file "phpthumb.class.php" on line 2573
        [46] => GenerateThumbnail() completed successfully in file "phpthumb.class.php" on line 440
        [47] => imageinterlace($this->gdimg_output, 1) in file "phpthumb.class.php" on line 470
        [48] => RenderOutput() attempting imagepng($this->gdimg_output) in file "phpthumb.class.php" on line 473
        [49] => Specified thumbnailQuality "90" is outside the accepted range (0-9, or -1). Using 6 as default value. in file "phpthumb.class.php" on line 517
        [50] => RenderOutput() completing with $this->outputImageData = 26306 bytes in file "phpthumb.class.php" on line 571
    )
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 2369)
    xPDOObject::isDirty() -- Attempt to check if an unknown field (rank) has been modified.
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 1452)
    Error 42000 executing statement:
    INSERT INTO  () VALUES ()
    Array
    (
        [0] => 42000
        [1] => 1064
        [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() VALUES ()' at line 1
    )
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1320)
    Could not get table class for class: msProductFile
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/xpdo.class.php : 1289)
    Could not get table name for class: msProductFile
    [2020-02-13 02:06:30] (ERROR @ /home/s19231/www/core/xpdo/om/xpdoobject.class.php : 240)
    Error 42000 executing statement: 
    Array
    (
        [0] => 42000
        [1] => 1064
        [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `msProductFile` WHERE  ( `msProductFile`.`product_id` IS NULL AND `msProductF' at line 1
    )
    [2020-02-13 02:06:30] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 184)
    Successful upload  "core/import/2.jpg": 
    Array
    (
        [id] => 
        [product_id] => 6698
        [parent] => 0
        [name] => 2
        [file] => 14d68190d97c561a8b8fcd5e4184b483578ee8d4.jpg
        [path] => 6698/
        [source] => 1
        [type] => image
        [rank] => 0
        [createdon] => 2020-02-13 02:06:29
        [createdby] => 6060
        [hash] => 14d68190d97c561a8b8fcd5e4184b483578ee8d4
        [properties] => Array
            (
                [size] => 777835
                [width] => 1024
                [height] => 768
                [bits] => 8
                [mime] => image/jpeg
            )
    
        [url] => /6698/14d68190d97c561a8b8fcd5e4184b483578ee8d4.jpg
    )
    [2020-02-13 02:06:30] (INFO @ /home/s19231/www/core/components/console/processors/exec.class.php(24) : eval()'d code : 192)
    You in debug mode, so we process only 1 row. Time: 0.8449910 s

    Как-то после этого заполнять значения других полей через set кажется бессмысленным. Или все-таки стоит попробовать. Может быть проблема в неверных значениях других полей?
      Павел
      13 февраля 2020, 02:57
      0
      Картинки по указанным url существуют. Данные в базу, как я понимаю, записаны. А на странице картинки не видны, ни по линку на товар, ни в админке.
      Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
      3