From 9da84c0840b90d954afec769d1254abcfc2c2a93 Mon Sep 17 00:00:00 2001 From: Touxten <156076965+Touxten@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:02:18 +0200 Subject: [PATCH 01/13] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d730779f..2d2e2cb4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ![Téléchargements](https://img.shields.io/github/downloads/PrestaSafe/prettyblocks/total) -Le premier page builder open conçu pour PrestaShop ! +Le premier page builder open source conçu pour PrestaShop ! La documentation technique est disponible ici : [https://prettyblocks.io/](https://prettyblocks.io/): From 2f6694867f316a5127e84a7cc6212d3072c4c641 Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Tue, 3 Sep 2024 17:40:20 +0200 Subject: [PATCH 02/13] reload app when all blocks are deleted --- _dev/src/components/LeftPanel.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_dev/src/components/LeftPanel.vue b/_dev/src/components/LeftPanel.vue index b0e61ff3..8f06471d 100644 --- a/_dev/src/components/LeftPanel.vue +++ b/_dev/src/components/LeftPanel.vue @@ -196,7 +196,7 @@ const deleteAllBlocks = async () => { if (response.success) { toaster.show(response.message) - prettyBlocksContext.reloadIframe() + window.location.reload() } }) .catch(error => console.error(error)); From c1d3119ab5ae5bea40c8cd8a500847a906d44e67 Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Tue, 3 Sep 2024 17:40:51 +0200 Subject: [PATCH 03/13] fix change url with id and enpoint --- _dev/src/store/pinia.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_dev/src/store/pinia.js b/_dev/src/store/pinia.js index d24079b0..181f582a 100644 --- a/_dev/src/store/pinia.js +++ b/_dev/src/store/pinia.js @@ -196,6 +196,11 @@ export const usePrettyBlocksContext = defineStore('prettyBlocksContext', { }, pushUrl(url) { const currentUrl = new URL(window.location.href); + + // Remove 'id' and 'endpoint' parameters if they exist + currentUrl.searchParams.delete('id'); + currentUrl.searchParams.delete('endpoint'); + currentUrl.searchParams.set('startup_url', this.updateFilteredURL(url)); window.history.replaceState({}, '', currentUrl.toString()); }, @@ -208,6 +213,7 @@ export const usePrettyBlocksContext = defineStore('prettyBlocksContext', { } else if (!url.includes('prettyblocks')) { url += '&prettyblocks=1'; } + return url; }, reloadIframe(currentSrc = false) { From 91f0c47b5ad84ed0cf81cbb7de219bd198a07e44 Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Tue, 3 Sep 2024 17:42:00 +0200 Subject: [PATCH 04/13] load tinyslider if settings are not set --- prettyblocks.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/prettyblocks.php b/prettyblocks.php index 198b419b..e816bbd6 100755 --- a/prettyblocks.php +++ b/prettyblocks.php @@ -72,7 +72,7 @@ public function __construct() { $this->name = 'prettyblocks'; $this->tab = 'administration'; - $this->version = '3.1.0'; + $this->version = '3.1.1'; $this->author = 'PrestaSafe'; $this->need_instance = 1; $this->js_path = $this->_path . 'views/js/'; @@ -443,7 +443,8 @@ public function hookdisplayHeader($params) // todo register css and js on iframe only from Hook } // load default blocks styles - if (!TplSettings::getSettings('remove_default_blocks')) { + + if (!TplSettings::getSettings('remove_default_blocks', false)) { $this->context->controller->registerStylesheet( 'tiny-slider-css', 'https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.4/tiny-slider.css', From 1044dc3fa88bb58254b9b96017bcdd630ac49148 Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Tue, 3 Sep 2024 17:42:17 +0200 Subject: [PATCH 05/13] update tinyslider configuration --- views/js/front.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/views/js/front.js b/views/js/front.js index ad098684..691b6606 100644 --- a/views/js/front.js +++ b/views/js/front.js @@ -1,22 +1,33 @@ document.addEventListener('DOMContentLoaded', function () { if (document.querySelectorAll('.prettyblocks-tns').length > 0) { var sliders = document.querySelectorAll('.prettyblocks-tns'); + sliders.forEach(function (slider) { tns({ container: slider, items: 1, slideBy: 'page', - autoWidth: true, - center: true, - // autoHeight: true, autoplay: true, - nav: false, // disable dots - controls: false, // disable controls + autoplayTimeout: 4000, autoplayButtonOutput: false, - mouseDrag: true, + nav: false, + controls: false, loop: true, - rewind: true, - autoplayTimeout: 4000, + gutter: 10, + autoWidth: true, + center: true, + autoHeight: true, + responsive: { + 640: { + items: 1 + }, + 768: { + items: 1 + }, + 1024: { + items: 1 + } + } }); }); } From 5ceda35153f66d8506ac1583c020bdbbea10f081 Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Tue, 3 Sep 2024 17:42:38 +0200 Subject: [PATCH 06/13] update default blocks --- .../blocks/category/category_description_block.tpl | 2 +- views/templates/blocks/cms/cms_content_block.tpl | 8 +++++--- views/templates/blocks/custom_text/default.tpl | 2 +- views/templates/blocks/customimage/default.tpl | 2 +- views/templates/blocks/tinyslider/default.tpl | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/views/templates/blocks/category/category_description_block.tpl b/views/templates/blocks/category/category_description_block.tpl index 13a44fcd..d3093fac 100644 --- a/views/templates/blocks/category/category_description_block.tpl +++ b/views/templates/blocks/category/category_description_block.tpl @@ -18,7 +18,7 @@ *} {if isset($category) && isset($category.description)} -
+
{$category.description nofilter}
{/if} diff --git a/views/templates/blocks/cms/cms_content_block.tpl b/views/templates/blocks/cms/cms_content_block.tpl index 3007dd80..06face42 100644 --- a/views/templates/blocks/cms/cms_content_block.tpl +++ b/views/templates/blocks/cms/cms_content_block.tpl @@ -16,6 +16,8 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * International Registered Trademark & Property of PrestaSafe *} -{if isset($cms) && isset($cms.content)} - {$cms.content nofilter} -{/if} +
+ {if isset($cms) && isset($cms.content)} + {$cms.content nofilter} + {/if} +
diff --git a/views/templates/blocks/custom_text/default.tpl b/views/templates/blocks/custom_text/default.tpl index 33d413c1..75b33e3f 100644 --- a/views/templates/blocks/custom_text/default.tpl +++ b/views/templates/blocks/custom_text/default.tpl @@ -17,7 +17,7 @@ * International Registered Trademark & Property of PrestaSafe *} {if $block.settings.content} -
+
{$block.settings.content nofilter}
{/if} \ No newline at end of file diff --git a/views/templates/blocks/customimage/default.tpl b/views/templates/blocks/customimage/default.tpl index 6c3abd3f..ea201b10 100644 --- a/views/templates/blocks/customimage/default.tpl +++ b/views/templates/blocks/customimage/default.tpl @@ -17,7 +17,7 @@ * International Registered Trademark & Property of PrestaSafe *} {if $block.settings.image} -
+
{/if} \ No newline at end of file diff --git a/views/templates/blocks/tinyslider/default.tpl b/views/templates/blocks/tinyslider/default.tpl index 7de8623a..87da6b06 100644 --- a/views/templates/blocks/tinyslider/default.tpl +++ b/views/templates/blocks/tinyslider/default.tpl @@ -16,7 +16,7 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * International Registered Trademark & Property of PrestaSafe *} -
+
{foreach from=$block.states item=state}
{$state.alt_image} From 5736b7706e09cb2aa442e1e676581880b1f4bc7c Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Tue, 3 Sep 2024 17:45:07 +0200 Subject: [PATCH 07/13] fix forcereload. --- _dev/src/scripts/eventHandler.js | 3 +-- views/js/build/build.js | 10 +++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/_dev/src/scripts/eventHandler.js b/_dev/src/scripts/eventHandler.js index 5bd82b89..694d6219 100644 --- a/_dev/src/scripts/eventHandler.js +++ b/_dev/src/scripts/eventHandler.js @@ -33,10 +33,9 @@ export const eventHandler = async (event) => { current_url: custom_url } }); + prettyBlocksContext.changeUrl(custom_url) if(force_reload) { window.location.reload() - }else{ - prettyBlocksContext.changeUrl(custom_url) } } diff --git a/views/js/build/build.js b/views/js/build/build.js index 2119c4d1..4f19cb66 100644 --- a/views/js/build/build.js +++ b/views/js/build/build.js @@ -9092,10 +9092,11 @@ This will fail in production.`); current_url: custom_url } }); + console.log("changeUrl", custom_url); + console.log("force_reload", force_reload); + prettyBlocksContext.changeUrl(custom_url); if (force_reload) { window.location.reload(); - } else { - prettyBlocksContext.changeUrl(custom_url); } } if (event.data.type == "updateTitleComponent") { @@ -9630,6 +9631,7 @@ This will fail in production.`); this.sendPrettyBlocksEvents("getContext"); this.sendPrettyBlocksEvents("getZones"); this.hideLoader(); + this.emit("iframeLoaded"); }, 100); }); }, @@ -9644,6 +9646,7 @@ This will fail in production.`); this.pushUrl(url); this.showLoader(); this.setIframe(); + this.emit("urlChanged", url); }, showLoader() { this.$patch((state) => { @@ -9657,6 +9660,8 @@ This will fail in production.`); }, pushUrl(url) { const currentUrl = new URL(window.location.href); + currentUrl.searchParams.delete("id"); + currentUrl.searchParams.delete("endpoint"); currentUrl.searchParams.set("startup_url", this.updateFilteredURL(url)); window.history.replaceState({}, "", currentUrl.toString()); }, @@ -9677,7 +9682,6 @@ This will fail in production.`); if (currentSrc === false) { currentSrc = url; } - console.log("currentSrc", currentSrc); this.iframe.domElement.src = ""; setTimeout(() => { this.iframe.domElement.src = currentSrc; From ed89ee9ef2fddfd546c497d435c4ccfcbafafbe7 Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Wed, 4 Sep 2024 14:05:12 +0200 Subject: [PATCH 08/13] fix #252 --- _dev/src/components/Modal.vue | 7 ++++++- _dev/src/components/PanelThemeSettings.vue | 1 + prettyblocks.php | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/_dev/src/components/Modal.vue b/_dev/src/components/Modal.vue index 5d0d263c..46adc9c9 100644 --- a/_dev/src/components/Modal.vue +++ b/_dev/src/components/Modal.vue @@ -54,7 +54,12 @@ onBeforeUnmount(() => { }) - +/** + * reload blocks after save settings + */ +prettyBlocksContext.on('afterSaveSettings', () => { + getBlocksAvailable() +}) const getBlocksAvailable = () => { HttpClient.get(ajax_urls.blocks_available) diff --git a/_dev/src/components/PanelThemeSettings.vue b/_dev/src/components/PanelThemeSettings.vue index 23b3334d..a5d0dae9 100644 --- a/_dev/src/components/PanelThemeSettings.vue +++ b/_dev/src/components/PanelThemeSettings.vue @@ -77,6 +77,7 @@ HttpClient.post(ajax_urls.state, params) if (data.message) { prettyBlocksContext.displayMessage(data.message) prettyBlocksContext.reloadIframe() + prettyBlocksContext.emit('afterSaveSettings') } }) .catch(error => console.error(error)); diff --git a/prettyblocks.php b/prettyblocks.php index e816bbd6..76458d9f 100755 --- a/prettyblocks.php +++ b/prettyblocks.php @@ -678,7 +678,6 @@ public function hookActionRegisterThemeSettings() 'description' => $this->l('Remove default blocks (if you using yours custom blocks)'), // description to display 'tab' => 'Settings', 'default' => false, // default value (Boolean) - 'private' => true, ], ]; } @@ -695,8 +694,7 @@ public function hookActionRegisterBlock($params) new PrettyBlocksCmsContentBlock($this), new PrettyBlocksCategoryDescriptionBlock($this), ]; - - if (!TplSettings::getSettings('remove_default_blocks')) { + if (!TplSettings::getSettings('remove_default_blocks', false)) { $defaultsBlocks[] = new PrettyBlocksTinySlider($this); $defaultsBlocks[] = new PrettyBlocksCustomImage($this); $defaultsBlocks[] = new PrettyBlocksFAQ($this); From a28181488897c70e360fa0296321aff07d1eec1b Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Wed, 4 Sep 2024 14:10:32 +0200 Subject: [PATCH 09/13] clear code --- _dev/src/components/Block.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/_dev/src/components/Block.vue b/_dev/src/components/Block.vue index 335f4f7d..31d09165 100644 --- a/_dev/src/components/Block.vue +++ b/_dev/src/components/Block.vue @@ -53,7 +53,6 @@ const AddOnZOne = async (code) => { ajax_token: security_app.ajax_token, }; let url = ajax_urls.block_action_urls; - console.log(url, params) let data = await HttpClient.get(url, params); prettyBlocksContext.emit("toggleModal"); From 9f735c384702fad0a80105f42f27e44f2298e86a Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Wed, 4 Sep 2024 14:10:53 +0200 Subject: [PATCH 10/13] update tinySlider template --- views/css/_dev/main.css | 2 +- views/css/dist/main.css | 2 +- views/css/iframe.css | 1 + views/js/front.js | 8 ++++---- views/templates/blocks/tinyslider/default.tpl | 14 ++++++++------ 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/views/css/_dev/main.css b/views/css/_dev/main.css index 7c9176ff..039d6a41 100644 --- a/views/css/_dev/main.css +++ b/views/css/_dev/main.css @@ -168,4 +168,4 @@ left: 50%; right: 50%; transform: translateX(-50%); -} \ No newline at end of file +} diff --git a/views/css/dist/main.css b/views/css/dist/main.css index be11c8bd..287a3b05 100644 --- a/views/css/dist/main.css +++ b/views/css/dist/main.css @@ -1652,4 +1652,4 @@ paint-order: markers; } } -} \ No newline at end of file +} diff --git a/views/css/iframe.css b/views/css/iframe.css index 2ab26d3b..5a2917f8 100644 --- a/views/css/iframe.css +++ b/views/css/iframe.css @@ -106,6 +106,7 @@ border-radius: 4px; } + /* [data-prettyblocks-zone].ondrag{ background-color: #646cff; border: 1px solid #646cff; diff --git a/views/js/front.js b/views/js/front.js index 691b6606..2106e09d 100644 --- a/views/js/front.js +++ b/views/js/front.js @@ -1,7 +1,7 @@ document.addEventListener('DOMContentLoaded', function () { if (document.querySelectorAll('.prettyblocks-tns').length > 0) { var sliders = document.querySelectorAll('.prettyblocks-tns'); - + sliders.forEach(function (slider) { tns({ container: slider, @@ -14,9 +14,9 @@ document.addEventListener('DOMContentLoaded', function () { controls: false, loop: true, gutter: 10, - autoWidth: true, - center: true, - autoHeight: true, + autoWidth: false, + center: false, + autoHeight: false, responsive: { 640: { items: 1 diff --git a/views/templates/blocks/tinyslider/default.tpl b/views/templates/blocks/tinyslider/default.tpl index 87da6b06..77c164cf 100644 --- a/views/templates/blocks/tinyslider/default.tpl +++ b/views/templates/blocks/tinyslider/default.tpl @@ -16,10 +16,12 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * International Registered Trademark & Property of PrestaSafe *} -
- {foreach from=$block.states item=state} -
- {$state.alt_image} +
+
+ {foreach from=$block.states item=state} +
+ {$state.alt_image}
- {/foreach} -
+ {/foreach} +
+
\ No newline at end of file From dc9ef419837bad0a7c76440ada5659e96734e220 Mon Sep 17 00:00:00 2001 From: Prestasafe Date: Wed, 4 Sep 2024 14:11:33 +0200 Subject: [PATCH 11/13] php-cs-fixer --- prettyblocks.php | 1 - 1 file changed, 1 deletion(-) diff --git a/prettyblocks.php b/prettyblocks.php index 76458d9f..8b2f63af 100755 --- a/prettyblocks.php +++ b/prettyblocks.php @@ -283,7 +283,6 @@ public function hookdisplayBackOfficeHeader($params) $this->context->controller->addJS($this->_path . 'views/js/back.js'); } $this->context->controller->addCSS($this->_path . 'views/css/back.css'); - } public function install() From 75daa5a7ad5744bc7c3ebec0a3068c84fab80148 Mon Sep 17 00:00:00 2001 From: PrestaSafe Date: Tue, 10 Sep 2024 11:04:11 +0200 Subject: [PATCH 12/13] Fix block order on paste --- _dev/yarn.lock | 22 +++++++++++----------- classes/PrettyBlocksModel.php | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/_dev/yarn.lock b/_dev/yarn.lock index 4db517ac..1fbf1040 100644 --- a/_dev/yarn.lock +++ b/_dev/yarn.lock @@ -12,10 +12,10 @@ resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.24.8.tgz" integrity sha512-WzfbgXOkGzZiXXCqk43kKwZjzwx4oulxZi3nq2TYL9mOjQv6kYwul9mz6ID36njuL7Xkp6nJEfok848Zj10j/w== -"@esbuild/darwin-arm64@0.21.5": +"@esbuild/linux-x64@0.21.5": version "0.21.5" - resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz" - integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== + resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz" + integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== "@headlessui/vue@^1.7.19": version "1.7.22" @@ -107,10 +107,15 @@ resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@rollup/rollup-darwin-arm64@4.19.0": +"@rollup/rollup-linux-x64-gnu@4.19.0": version "4.19.0" - resolved "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.19.0.tgz" - integrity sha512-emvKHL4B15x6nlNTBMtIaC9tLPRpeA5jMvRLXVbl/W9Ie7HhkrE7KQjvgS9uxgatL1HmHWDXk5TTS4IaNJxbAA== + resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.19.0.tgz" + integrity sha512-HBndjQLP8OsdJNSxpNIN0einbDmRFg9+UQeZV1eiYupIRuZsDEoeGU43NQsS34Pp166DtwQOnpcbV/zQxM+rWA== + +"@rollup/rollup-linux-x64-musl@4.19.0": + version "4.19.0" + resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.19.0.tgz" + integrity sha512-HxfbvfCKJe/RMYJJn0a12eiOI9OOtAUF4G6ozrFUK95BNyoJaSiBjIOHjZskTUffUrB84IPKkFG9H9nEvJGW6A== "@swc/helpers@^0.2.13": version "0.2.14" @@ -698,11 +703,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@~2.3.2, fsevents@~2.3.3: - version "2.3.3" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" diff --git a/classes/PrettyBlocksModel.php b/classes/PrettyBlocksModel.php index 98f6b46f..b9d5192f 100644 --- a/classes/PrettyBlocksModel.php +++ b/classes/PrettyBlocksModel.php @@ -970,9 +970,11 @@ public static function copyZone($zone_name, $zone_name_to_paste, $id_lang, $id_s $query->where('zone_name = \'' . $zone_name . '\''); $query->where('id_lang = ' . (int) $id_lang); $query->where('id_shop = ' . (int) $id_shop); + $query->orderBy('position ASC'); $results = $db->executeS($query); $result = true; - + $lastPosition = self::getLastPosition($zone_name, $id_lang, $id_shop); + foreach ($results as $row) { $model = new PrettyBlocksModel(null, $id_lang, $id_shop); $model->zone_name = $zone_name_to_paste; @@ -985,6 +987,8 @@ public static function copyZone($zone_name, $zone_name_to_paste, $id_lang, $id_s $model->instance_id = $row['instance_id']; $model->id_shop = (int) $id_shop; $model->id_lang = (int) $id_lang; + $model->position = $row['position'] + $lastPosition; + $lastPosition++; if (!$model->save()) { $errors[] = $model; } @@ -993,6 +997,19 @@ public static function copyZone($zone_name, $zone_name_to_paste, $id_lang, $id_s return $errors; } + public static function getLastPosition($zone_name, $id_lang, $id_shop) + { + $db = Db::getInstance(); + $query = new DbQuery(); + $query->select('MAX(position)') + ->from('prettyblocks') + ->where('zone_name = \'' . $zone_name . '\'') + ->where('id_lang = ' . (int) $id_lang) + ->where('id_shop = ' . (int) $id_shop); + + return (int) $db->getValue($query); + } + /** * deleteBlocksFromZone * delete all blocks from a zone From 98d7ac22e744173015adb6343eb15994b82cdf25 Mon Sep 17 00:00:00 2001 From: PrestaSafe Date: Tue, 10 Sep 2024 11:04:52 +0200 Subject: [PATCH 13/13] php cs fixer --- classes/PrettyBlocksModel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/PrettyBlocksModel.php b/classes/PrettyBlocksModel.php index b9d5192f..0639ac6a 100644 --- a/classes/PrettyBlocksModel.php +++ b/classes/PrettyBlocksModel.php @@ -974,7 +974,7 @@ public static function copyZone($zone_name, $zone_name_to_paste, $id_lang, $id_s $results = $db->executeS($query); $result = true; $lastPosition = self::getLastPosition($zone_name, $id_lang, $id_shop); - + foreach ($results as $row) { $model = new PrettyBlocksModel(null, $id_lang, $id_shop); $model->zone_name = $zone_name_to_paste; @@ -988,7 +988,7 @@ public static function copyZone($zone_name, $zone_name_to_paste, $id_lang, $id_s $model->id_shop = (int) $id_shop; $model->id_lang = (int) $id_lang; $model->position = $row['position'] + $lastPosition; - $lastPosition++; + ++$lastPosition; if (!$model->save()) { $errors[] = $model; }