Magenerds / PageDesigner

92 stars 41 forks source link

Where is the content of CMS pages / static blocks, created before installing the extension? #43

Open Eddcapone opened 4 years ago

Eddcapone commented 4 years ago

I installed the extension and tried to edit a page, but I noticed that my old HTML is not there anymore? Is this extension only made for completly fresh Magento shops?

indykoning commented 4 years ago

I've got the same issue, what i'm guessing is that the data has to be migrated to the https://github.com/Magenerds/WysiwygWidget extension. When i created a test block before and after installing i noticed what the difference is between the content of the blocks.

Content column Before:

<p>Test 1232433454354353</p>

Content column After:

<div class="pd-row row">
    <div class="pd-col col-md-12">
        {{widget type="Magenerds\WysiwygWidget\Block\Widget\Editor" content="---BASE64---PHA+VGVzdCAxMjMyNDMzNDU0MzU0MzUzPC9wPg=="}}
    </div>
</div>

decoding the base64 reveals PHA+VGVzdCAxMjMyNDMzNDU0MzU0MzUzPC9wPg== is the exact content of the content block before.

There is also a page_designer_json field which also has this widget with the base64 string so it would have to be placed there as well.

{
  "version": "1.0.0",
  "rows": [
    {
      "columns": [
        {
          "gridSize": {
            "md": 12
          },
          "content": "{{widget type=\"Magenerds\\WysiwygWidget\\Block\\Widget\\Editor\" content=\"---BASE64---PHA+VGVzdCAxMjMyNDMzNDU0MzU0MzUzPC9wPg==\"}}",
          "settings": {}
        }
      ],
      "settings": {}
    }
  ]
}

I think it would be a nice feature to add a installData.php which converts these columns to the structure pagedesigner supports. However this would also mean the Wysiwyg widget becomes a requirement.

indykoning commented 4 years ago

Hi, i've created a script to automatically migrate the content to the PageDesigner format. You could get the diff from #48 and apply it as a patch or get the file some other way.

If you newly install pageDesigner it should run automatically. If it is already installed you can run it via

magerun2 dev:console "\Magento\Framework\App\ObjectManager::getInstance()->get(Magenerds\PageDesigner\Job\Migration::class)->migrate();"

To change it back to the normal Magento format you can run

magerun2 dev:console "\Magento\Framework\App\ObjectManager::getInstance()->get(Magenerds\PageDesigner\Job\Migration::class)->revert();"

NOTE: You could lose some data during the revert since it uses the first wysiwyg block to fill the content again.