Как выполнить экспорт товаров или статей в Cotonti CMS и после выполнить импорт из CVS или Excel файла в базу данных MySQL вашего сайта.
Базовый набор инструментов для экспорта и импорта данных в таблицу модуля "Pages".
Экспорт полей из таблицы БД в файл на 1400 строк занимает 1 секунду.
При экспорте выгружаются все поля, включая экстраполя или поля созданные другими расшерениями вашего сайта на котонти.
Полученный файл импортируем в гугл-таблицы, правим, дополняем, затем скачиваем в формате cvs, а затем уже через "CVS-Tools для Cotonti" импортируем в БД вашего сайта.
На данный момент, инструмент импорта работает с первыми16-тью полями таблицы модуля "Pages", которые создаются модулем при его установке, - page_id, page_alias, page_state, page_cat, page_title, page_text, и так далее, все которые можно посмотреть здесь, но без экстраполей.
Весь список полей:
page_id page_alias page_state page_cat page_title page_desc page_keywords page_metatitle page_metadesc page_text page_parser page_author page_ownerid page_date page_begin page_expire page_updated
Другие поля, по желанию, уже можно дописать самостоятельно.
Файл конфигурации подключения к базе данных.
Файл вхождения, где получаем доступ к инструментам импорта и экспорта данных строк таблицы со статьями.
Сюда записываем имена файлов CVS, которыt загружали в форму импорта/обновления БД.
Файл со сценарием построчного экспорта в CVS-файл.
Файл, который сочетает в своем сценарии сразу два инструмента, - это обновление строки в базе если она есть и добавление, если такой строки нет.
это файл только для импорта.
Остальные файлы не используются. пока хранятся для сравнения и как вариант.
Инструменты хоть и заточены под поля таблицы базы данных модуля статей, но не являются модулем или плагином движка котонти, и поэтому устанавливаются как самостоятельная библиотека.
Её закачиваем в корень вашего сайта.
Открываем public_html/cvstools/dbconfig.php
// БД конфигурация и поключение
const DB_HOST = "localhost";
const DB_USERNAME = "пользователь";
const DB_PASSWORD = "пароль";
const DB_NAME = "имя базы данных";
прописываем свои корректные данные доступа.
Прописываем в адресной строке
https://mydomain.com/cvstools/index.php
где, "mydomain.com" разумеется свой домен.
1. Напрямую скрипт импортирует только CVS-файлы.
2. Электронные таблицы, например как Excel от Microsoft Office или таблицы от LibreOffice "прогоняем" через Google Таблицы.
То есть просто жмем "Новая таблица", "Файл" => "Импортировать".
Выбираем свой документ электронной таблицы будь-то .xlsx, .ods, .tsv или .cvs и импортируем.
3. Импортированный файл приводим в нужный вид (Пункт №3 в параграфе "Принцип работы и возможности библиотеки CVS-Tools для Cotonti" или просто смотрим свой экспортированный файл при помощи этого скрипта).
4. Скачиваем отредактированный файл как .cvs.
5. Всё, если бекап БД сделали - смело импортируем.
Как раз то, что любую электронную таблицу в самых распространных расширениях как .xlsx, .ods, .tsv или .cvs мы можем прогнать и преобразовать через Google Таблицы в нужный нам формат cvs-файл для импорта - делает скрипт действительно универсальным и не требует никаких дополнительных библиотек.
Форум по обсуждению и поддержке инструментов для экспорта и импорта статей из CVS-файлов.
CVS-Tools for Cotonti. Import and export from a CVS or Excel file
How to export products or articles to Cotonti CMS and then import from a CVS or Excel file into the MySQL database of your site.
How to export products or articles to Cotonti CMS and then import from a CVS or Excel file into the MySQL database of your site.
A basic set of tools for exporting and importing data to the Pages module table.
The principle of operation and capabilities of the "CVS-Tools for Cotonti" library:
1. Export articles from the database to a CVS file.
Exporting fields from a database table to a 1400-line file takes 1 second.
When exporting, all fields are unloaded, including extra fields or fields created by other extensions of your site on cotonti.
2. Google spreadsheets (intermediary)
The resulting file is imported into Google tables, edited, supplemented, then downloaded in cvs format, and then imported into your site's database via CVS-Tools for Cotonti.
3. Import articles into the database from a CVS file.
At the moment, the import tool works with the first 16 fields of the Pages module table, which are created by the module during installation, page_id, page_alias, page_state, page_cat, page_title, page_text, and so on, all of which can be viewed here, but without extrapolations.
The entire list of fields:
page_id
page_alias
page_state
page_cat
page_title
page_desc
page_keywords
page_metatitle
page_metadesc
page_text
page_parser
page_author
page_ownerid
page_date
page_begin
page_expire
page_updated
Other fields, if desired, can already be added independently.
The working environment and the list of necessary files in the folder "cvstools":
dbconfig.php
The configuration file for the database connection.
index.php
The entry file, where we get access to tools for importing and exporting data from rows in a table with articles.
fileslist.txt
Here we write down the names of the CVS files that were uploaded to the database import/update form.
exportcsvfile.php
A file with a line-by-line export script to a CVS file.
updateimportcsvfile.php
A file that combines two tools at once in its script is updating a row in the database if there is one and adding it if there is no such row.
importcsvfile.php
this is an import-only file.
The remaining files are not used. for now, they are stored for comparison and as an option.
Although the tools are tailored to the fields of the article module database table, they are not a module or plug-in of the Cotonti engine, and therefore are installed as an independent library.
The installation procedure for "CVS-Tools for Cotonti":
1. Download from the repository using the link below.
2. The downloaded archive contains the folder "cvstools".
We upload it to the root of your site.
3. Connect the database.
Opening it public_html/dbcvstools/dbconfig.php
// DB configuration and connection
const DB_HOST = "localhost";
const DB_USERNAME = "user";
const DB_PASSWORD = "password";
const DB_NAME = "database name";
we register our correct access data.
4. Interface and launch
We write it in the address bar
https://mydomain.com/cvstools/index.php
where, "mydomain.com " of course your domain.
Attention!. Always backup the database before any import.
A forum for discussing and supporting tools for exporting and importing articles from CVS files.
The current version is always available for download on the GitHub public repository.
Актуальная версия доступная для скачивания всегда на публичном репозитории GitHub.