Доброй ночи, появился такой вопрос:
Записываю Json строку в поле textarea с помощью:
$set_json = $product_to_edit->getElement('da3ed180-37d6-45a7-8cf0-f7b3a0de2cd9');
$set_json->set('value', json_encode($product));
затем сохраняю товар
$app->table->item->save($product_to_edit);
и индексирую в базе:
JBModelSearchindex::model()->updateByItem($product_to_edit, true);
После запуск скрипта несколько раз происходит следующее:
"da3ed180-37d6-45a7-8cf0-f7b3a0de2cd9": { "0": { "value": "{\"additionalInfo\":null,\"code\":\"3090\",\"description\":\"\\u0421\\u0430\\u043b\\u0430\\u0442 \\u0438\\u0437 \\u0441\\u0432\\u0435\\u0436\\u0435\\u0439 \\u043a\\u0430\\u043f\\u0443\\u0441\\u0442\\u044b, \\u0441\\u043e\\u0447\\u043d\\u044b\\u0445 \\u0442\\u043e\\u043c\\u0430\\u0442\\u043e\\u0432, \\u043e\\u0433\\u0443\\u0440\\u0446\\u043e\\u0432, \\u0441\\u043b\\u0430\\u0434\\u043a\\u043e\\u0433\\u043e \\u043f\\u0435\\u0440\\u0446\\u0430, \\u0443\\u0437\\u0431\\u0435\\u043a\\u0441\\u043a\\u043e\\u0439 \\u0437\\u0435\\u043b\\u0435\\u043d\\u0438, \\u0447\\u0435\\u0441\\u043d\\u043e\\u043a\\u0430, \\u0437\\u0430\\u043f\\u0440\\u0430\\u0432\\u043b\\u044f\\u0435\\u0442\\u0441\\u044f \\u0440\\u0430\\u0441\\u0442\\u0438\\u0442\\u0435\\u043b\\u044c\\u043d\\u044b\\u043c \\u043c\\u0430\\u0441\\u043b\\u043e\\u043c.\",\"id\":\"15b3de8c-94ad-4a6c-a4e5-7bf292f7b223\",\"isDeleted\":false,\"name\":\"\\u0421\\u0430\\u043b\\u0430\\u0442 \\u0424\\u0435\\u0440\\u0433\\u0430\\u043d\\u0441\\u043a\\u0438\\u0439\",\"seoDescription\":null,\"seoKeywords\":null,\"seoText\":null,\"seoTitle\":null,\"tags\":null,\"carbohydrateAmount\":11.01,\"carbohydrateFullAmount\":24.222,\"differentPricesOn\":[],\"doNotPrintInCheque\":false,\"energyAmount\":253.635,\"energyFullAmount\":557.997,\"fatAmount\":21.56,\"fatFullAmount\":47.432,\"fiberAmount\":3.888,\"fiberFullAmount\":8.5536,\"groupId\":null,\"groupModifiers\":[{\"maxAmount\":5,\"minAmount\":0,\"modifierId\":\"48fbbcf3-91be-4610-bc3a-7b2738b87e37\",\"required\":false,\"childModifiers\":[{\"maxAmount\":0,\"minAmount\":0,\"modifierId\":\"2c99c793-b9d1-43a7-8d25-2c047317be6e\",\"required\":false,\"defaultAmount\":0,\"hideIfDefaultAmount\":false},{\"maxAmount\":0,\"minAmount\":0,\"modifierId\":\"235c0199-dac0-4a83-aeab-0668bce6bac7\",\"required\":false,\"defaultAmount\":0,\"hideIfDefaultAmount\":false}],\"childModifiersHaveMinMaxRestrictions\":false}],\"measureUnit\":\"\\u043f\\u043e\\u0440\\u0446\",\"modifiers\":[],\"price\":3.9,\"productCategoryId\":\"0691c8c6-0bea-a73c-0170-c9d3c9048536\",\"prohibitedToSaleOn\":[{\"terminalId\":\"c868da30-ff51-8b44-0166-553e3a4fb6a5\"},{\"terminalId\":\"04be39cd-4ec4-d46b-0178-c634e5dec9b2\"},{\"terminalId\":\"e49e0f75-b716-3005-0167-68c32c632160\"},{\"terminalId\":\"c868da30-ff51-8b44-0166-57c41c1e0855\"},{\"terminalId\":\"e49e0f75-b716-3005-0167-68c32c631aa3\"}],\"type\":\"dish\",\"useBalanceForSell\":false,\"weight\":0.22,\"images\":[{\"imageId\":\"2cb54bc5-baa6-43b2-926c-72a6cf8746ba\",\"imageUrl\":\"https:\\\/\\\/102922.selcdn.ru\\\/nomenclature_images_test\\\/b4e2fe1b-1812-11e9-80e9-a45d36c3ac65\\\/ca705ad7-21cc-4900-b648-8229b04fd389.png\",\"uploadDate\":\"2021-04-13 23:23:39\"}],\"isIncludedInMenu\":true,\"order\":2,\"parentGroup\":\"f164b1a1-4b59-4dd2-b76b-c06f4be77046\"}" }, "1": { "value": "{\"additionalInfo\":null,\"code\":\"3090\",\"description\":\"\\u0421\\u0430\\u043b\\u0430\\u0442 \\u0438\\u0437 \\u0441\\u0432\\u0435\\u0436\\u0435\\u0439 \\u043a\\u0430\\u043f\\u0443\\u0441\\u0442\\u044b, \\u0441\\u043e\\u0447\\u043d\\u044b\\u0445 \\u0442\\u043e\\u043c\\u0430\\u0442\\u043e\\u0432, \\u043e\\u0433\\u0443\\u0440\\u0446\\u043e\\u0432, \\u0441\\u043b\\u0430\\u0434\\u043a\\u043e\\u0433\\u043e \\u043f\\u0435\\u0440\\u0446\\u0430, \\u0443\\u0437\\u0431\\u0435\\u043a\\u0441\\u043a\\u043e\\u0439 \\u0437\\u0435\\u043b\\u0435\\u043d\\u0438, \\u0447\\u0435\\u0441\\u043d\\u043e\\u043a\\u0430, \\u0437\\u0430\\u043f\\u0440\\u0430\\u0432\\u043b\\u044f\\u0435\\u0442\\u0441\\u044f \\u0440\\u0430\\u0441\\u0442\\u0438\\u0442\\u0435\\u043b\\u044c\\u043d\\u044b\\u043c \\u043c\\u0430\\u0441\\u043b\\u043e\\u043c.\",\"id\":\"15b3de8c-94ad-4a6c-a4e5-7bf292f7b223\",\"isDeleted\":false,\"name\":\"\\u0421\\u0430\\u043b\\u0430\\u0442 \\u0424\\u0435\\u0440\\u0433\\u0430\\u043d\\u0441\\u043a\\u0438\\u0439\",\"seoDescription\":null,\"seoKeywords\":null,\"seoText\":null,\"seoTitle\":null,\"tags\":null,\"carbohydrateAmount\":11.01,\"carbohydrateFullAmount\":24.222,\"differentPricesOn\":[],\"doNotPrintInCheque\":false,\"energyAmount\":253.635,\"energyFullAmount\":557.997,\"fatAmount\":21.56,\"fatFullAmount\":47.432,\"fiberAmount\":3.888,\"fiberFullAmount\":8.5536,\"groupId\":null,\"groupModifiers\":[{\"maxAmount\":5,\"minAmount\":0,\"modifierId\":\"48fbbcf3-91be-4610-bc3a-7b2738b87e37\",\"required\":false,\"childModifiers\":[{\"maxAmount\":0,\"minAmount\":0,\"modifierId\":\"2c99c793-b9d1-43a7-8d25-2c047317be6e\",\"required\":false,\"defaultAmount\":0,\"hideIfDefaultAmount\":false},{\"maxAmount\":0,\"minAmount\":0,\"modifierId\":\"235c0199-dac0-4a83-aeab-0668bce6bac7\",\"required\":false,\"defaultAmount\":0,\"hideIfDefaultAmount\":false}],\"childModifiersHaveMinMaxRestrictions\":false}],\"measureUnit\":\"\\u043f\\u043e\\u0440\\u0446\",\"modifiers\":[],\"price\":3.9,\"productCategoryId\":\"0691c8c6-0bea-a73c-0170-c9d3c9048536\",\"prohibitedToSaleOn\":[{\"terminalId\":\"c868da30-ff51-8b44-0166-553e3a4fb6a5\"},{\"terminalId\":\"04be39cd-4ec4-d46b-0178-c634e5dec9b2\"},{\"terminalId\":\"e49e0f75-b716-3005-0167-68c32c632160\"},{\"terminalId\":\"c868da30-ff51-8b44-0166-57c41c1e0855\"},{\"terminalId\":\"e49e0f75-b716-3005-0167-68c32c631aa3\"}],\"type\":\"dish\",\"useBalanceForSell\":false,\"weight\":0.22,\"images\":[{\"imageId\":\"2cb54bc5-baa6-43b2-926c-72a6cf8746ba\",\"imageUrl\":\"https:\\\/\\\/102922.selcdn.ru\\\/nomenclature_images_test\\\/b4e2fe1b-1812-11e9-80e9-a45d36c3ac65\\\/ca705ad7-21cc-4900-b648-8229b04fd389.png\",\"uploadDate\":\"2021-04-13 23:23:39\"}],\"isIncludedInMenu\":true,\"order\":2,\"parentGroup\":\"f164b1a1-4b59-4dd2-b76b-c06f4be77046\"}" }, "2": { "value": "{\"additionalInfo\":null,\"code\":\"3090\",\"description\":\"\\u0421\\u0430\\u043b\\u0430\\u0442 \\u0438\\u0437 \\u0441\\u0432\\u0435\\u0436\\u0435\\u0439 \\u043a\\u0430\\u043f\\u0443\\u0441\\u0442\\u044b, \\u0441\\u043e\\u0447\\u043d\\u044b\\u0445 \\u0442\\u043e\\u043c\\u0430\\u0442\\u043e\\u0432, \\u043e\\u0433\\u0443\\u0440\\u0446\\u043e\\u0432, \\u0441\\u043b\\u0430\\u0434\\u043a\\u043e\\u0433\\u043e \\u043f\\u0435\\u0440\\u0446\\u0430, \\u0443\\u0437\\u0431\\u0435\\u043a\\u0441\\u043a\\u043e\\u0439 \\u0437\\u0435\\u043b\\u0435\\u043d\\u0438, \\u0447\\u0435\\u0441\\u043d\\u043e\\u043a\\u0430, \\u0437\\u0430\\u043f\\u0440\\u0430\\u0432\\u043b\\u044f\\u0435\\u0442\\u0441\\u044f \\u0440\\u0430\\u0441\\u0442\\u0438\\u0442\\u0435\\u043b\\u044c\\u043d\\u044b\\u043c \\u043c\\u0430\\u0441\\u043b\\u043e\\u043c.\",\"id\":\"15b3de8c-94ad-4a6c-a4e5-7bf292f7b223\",\"isDeleted\":false,\"name\":\"\\u0421\\u0430\\u043b\\u0430\\u0442 \\u0424\\u0435\\u0440\\u0433\\u0430\\u043d\\u0441\\u043a\\u0438\\u0439\",\"seoDescription\":null,\"seoKeywords\":null,\"seoText\":null,\"seoTitle\":null,\"tags\":null,\"carbohydrateAmount\":11.01,\"carbohydrateFullAmount\":24.222,\"differentPricesOn\":[],\"doNotPrintInCheque\":false,\"energyAmount\":253.635,\"energyFullAmount\":557.997,\"fatAmount\":21.56,\"fatFullAmount\":47.432,\"fiberAmount\":3.888,\"fiberFullAmount\":8.5536,\"groupId\":null,\"groupModifiers\":[{\"maxAmount\":5,\"minAmount\":0,\"modifierId\":\"48fbbcf3-91be-4610-bc3a-7b2738b87e37\",\"required\":false,\"childModifiers\":[{\"maxAmount\":0,\"minAmount\":0,\"modifierId\":\"2c99c793-b9d1-43a7-8d25-2c047317be6e\",\"required\":false,\"defaultAmount\":0,\"hideIfDefaultAmount\":false},{\"maxAmount\":0,\"minAmount\":0,\"modifierId\":\"235c0199-dac0-4a83-aeab-0668bce6bac7\",\"required\":false,\"defaultAmount\":0,\"hideIfDefaultAmount\":false}],\"childModifiersHaveMinMaxRestrictions\":false}],\"measureUnit\":\"\\u043f\\u043e\\u0440\\u0446\",\"modifiers\":[],\"price\":3.9,\"productCategoryId\":\"0691c8c6-0bea-a73c-0170-c9d3c9048536\",\"prohibitedToSaleOn\":[{\"terminalId\":\"c868da30-ff51-8b44-0166-553e3a4fb6a5\"},{\"terminalId\":\"04be39cd-4ec4-d46b-0178-c634e5dec9b2\"},{\"terminalId\":\"e49e0f75-b716-3005-0167-68c32c632160\"},{\"terminalId\":\"c868da30-ff51-8b44-0166-57c41c1e0855\"},{\"terminalId\":\"e49e0f75-b716-3005-0167-68c32c631aa3\"}],\"type\":\"dish\",\"useBalanceForSell\":false,\"weight\":0.22,\"images\":[{\"imageId\":\"2cb54bc5-baa6-43b2-926c-72a6cf8746ba\",\"imageUrl\":\"https:\\\/\\\/102922.selcdn.ru\\\/nomenclature_images_test\\\/b4e2fe1b-1812-11e9-80e9-a45d36c3ac65\\\/ca705ad7-21cc-4900-b648-8229b04fd389.png\",\"uploadDate\":\"2021-04-13 23:23:39\"}],\"isIncludedInMenu\":true,\"order\":2,\"parentGroup\":\"f164b1a1-4b59-4dd2-b76b-c06f4be77046\"}" }, "3": { "value": "{\"additionalInfo\":null,\"code\":\"3090\",\"description\":\"\\u0421\\u0430\\u043b\\u0430\\u0442 \\u0438\\u0437 \\u0441\\u0432\\u0435\\u0436\\u0435\\u0439 \\u043a\\u0430\\u043f\\u0443\\u0441\\u0442\\u044b, \\u0441\\u043e\\u0447\\u043d\\u044b\\u0445 \\u0442\\u043e\\u043c\\u0430\\u0442\\u043e\\u0432, \\u043e\\u0433\\u0443\\u0440\\u0446\\u043e\\u0432, \\u0441\\u043b\\u0430\\u0434\\u043a\\u043e\\u0433\\u043e \\u043f\\u0435\\u0440\\u0446\\u0430, \\u0443\\u0437\\u0431\\u0435\\u043a\\u0441\\u043a\\u043e\\u0439 \\u0437\\u0435\\u043b\\u0435\\u043d\\u0438, \\u0447\\u0435\\u0441\\u043d\\u043e\\u043a\\u0430, \\u0437\\u0430\\u043f\\u0440\\u0430\\u0432\\u043b\\u044f\\u0435\\u0442\\u0441\\u044f \\u0440\\u0430\\u0441\\u0442\\u0438\\u0442\\u0435\\u043b\\u044c\\u043d\\u044b\\u043c \\u043c\\u0430\\u0441\\u043b\\u043e\\u043c.\",\"id\":\"15b3de8c-94ad-4a6c-a4e5-7bf292f7b223\",\"isDeleted\":false,\"name\":\"\\u0421\\u0430\\u043b\\u0430\\u0442 \\u0424\\u0435\\u0440\\u0433\\u0430\\u043d\\u0441\\u043a\\u0438\\u0439\",\"seoDescription\":null,\"seoKeywords\":null,\"seoText\":null,\"seoTitle\":null,\"tags\":null,\"carbohydrateAmount\":11.01,\"carbohydrateFullAmount\":24.222,\"differentPricesOn\":[],\"doNotPrintInCheque\":false,\"energyAmount\":253.635,\"energyFullAmount\":557.997,\"fatAmount\":21.56,\"fatFullAmount\":47.432,\"fiberAmount\":3.888,\"fiberFullAmount\":8.5536,\"groupId\":null,\"groupModifiers\":[{\"maxAmount\":5,\"minAmount\":0,\"modifierId\":\"48fbbcf3-91be-4610-bc3a-7b2738b87e37\",\"required\":false,\"childModifiers\":[{\"maxAmount\":0,\"minAmount\":0,\"modifierId\":\"2c99c793-b9d1-43a7-8d25-2c047317be6e\",\"required\":false,\"defaultAmount\":0,\"hideIfDefaultAmount\":false},{\"maxAmount\":0,\"minAmount\":0,\"modifierId\":\"235c0199-dac0-4a83-aeab-0668bce6bac7\",\"required\":false,\"defaultAmount\":0,\"hideIfDefaultAmount\":false}],\"childModifiersHaveMinMaxRestrictions\":false}],\"measureUnit\":\"\\u043f\\u043e\\u0440\\u0446\",\"modifiers\":[],\"price\":3.9,\"productCategoryId\":\"0691c8c6-0bea-a73c-0170-c9d3c9048536\",\"prohibitedToSaleOn\":[{\"terminalId\":\"c868da30-ff51-8b44-0166-553e3a4fb6a5\"},{\"terminalId\":\"04be39cd-4ec4-d46b-0178-c634e5dec9b2\"},{\"terminalId\":\"e49e0f75-b716-3005-0167-68c32c632160\"},{\"terminalId\":\"c868da30-ff51-8b44-0166-57c41c1e0855\"},{\"terminalId\":\"e49e0f75-b716-3005-0167-68c32c631aa3\"}],\"type\":\"dish\",\"useBalanceForSell\":false,\"weight\":0.22,\"images\":[{\"imageId\":\"2cb54bc5-baa6-43b2-926c-72a6cf8746ba\",\"imageUrl\":\"https:\\\/\\\/102922.selcdn.ru\\\/nomenclature_images_test\\\/b4e2fe1b-1812-11e9-80e9-a45d36c3ac65\\\/ca705ad7-21cc-4900-b648-8229b04fd389.png\",\"uploadDate\":\"2021-04-13 23:23:39\"}],\"isIncludedInMenu\":true,\"order\":2,\"parentGroup\":\"f164b1a1-4b59-4dd2-b76b-c06f4be77046\"}" } },
это код из базы, таблица zoo_item столбец elements для записи
Каждое мое сохранение элемента добавляет в элемент da3ed180-37d6-45a7-8cf0-f7b3a0de2cd9 новый элемент массива со значением, а не перезаписывает его
Может сталкивался кто-нибудь и сможет что-нибудь подсказать?
Версии:
Joomla: 3.9.25 JBZoo: 4.10.3 GNU GPL (Community Edition) by SmetDenis Zoo: 3.3.37
Edited by webinsight, 14 April 2021 - 22:52.