Knowledgebase is a categorized collection of answers to frequently asked questions (FAQ) and articles. You can read articles in this category or select a subcategory that you are interested in.
How to use script for Magento 2 for auto creation of cms pages using your own template based on magezon page builder or based on HTML?
5. Create cms page as template for insert into many cms pages using Magezon page builder or using standard editor of magento 2. Copy code usung HTML button (if use magento 2 editor)
6. Edit <magento 2 root>/app/code/GoAskle/GoCms/Setup/Setup/UpgradeData.php file in line 42-43 with <<<EOD in begin and in EOD in the end. Place there content of your template and use varible $fval as current city. Make sure that your content not contain double backslashes \\ -- if you have it then replace it with \\\, also replace all \n to \\n
7. Edit <magento 2 root>/app/code/GoAskle/GoCms/Setup/Setup/UpgradeData.php file in line 49-60 inside $data varible and make sure that title, meta title, meta description, meta keywords and identifier (url_key) looks like as you wanted.
8. Edit <magento 2 root>/app/code/GoAskle/GoCms/Setup/etc/module.xml file only in line 4: from current setup_version to +1. Dont use more than 1. Example 0.1.16 need to increase +1 and it will be 0.1.17 and save it.
9. Go to list of your existing cms pages and make sure that no one from existing cms pages have same url_keys as you planned to generate OR script will NOT WORK. Because this script can not create new cms page if cms page with same url_key already exists. So delete pages if needed before go to next step.
10. Go to SSH under cpanel user (may use terminal) into root of your magento 2 and run: bin/magento setup:upgrade or php bin/magento se:upg
12. If you need to run your script again then you need to change <magento 2 root>/app/code/GoAskle/GoCms/Setup/Setup/UpgradeData.php
and after this ALWAYS increase setup_version +1 in this file (if you will not increase setup_version then script will not be started)
<magento 2 root>/app/code/GoAskle/GoCms/Setup/etc/module.xml
because this setup_version is trigger for run script and using point 10 again to start running this script
Article ID: 41
Category: Magento 2
Date added: 2020-08-02 20:31:51
Views : 46
Rating (Votes): (1)