Skip to content

webitproff/cot_page_cvstools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

CVS-Tools for Cotonti.

Import and export data from a CVS file into DB MySQL.

Как выполнить экспорт товаров или статей в Cotonti CMS и после выполнить импорт из CVS или Excel файла в базу данных MySQL вашего сайта.

Базовый набор инструментов для экспорта и импорта данных в таблицу модуля "Pages".

Принцип работы и возможности библиотеки "CVS-Tools для Cotonti":

1. Экспорт статей из базы данных в CVS файл.

Экспорт полей из таблицы БД в файл на 1400 строк занимает 1 секунду.

При экспорте выгружаются все поля, включая экстраполя или поля созданные другими расшерениями вашего сайта на котонти.

2. Google spreadsheets (посредник)

Полученный файл импортируем в гугл-таблицы, правим, дополняем, затем скачиваем в формате cvs, а затем уже через "CVS-Tools для Cotonti" импортируем в БД вашего сайта.

3. Импорт статей в базу данных из CVS файла.

На данный момент, инструмент импорта  работает с первыми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

Другие поля, по желанию, уже можно дописать самостоятельно.

Рабочая среда и список необходимых файлов в папке "cvstools":

dbconfig.php

Файл конфигурации подключения к базе данных.

index.php

Файл вхождения, где получаем доступ к инструментам импорта и экспорта данных строк таблицы со статьями.

fileslist.txt

Сюда записываем имена файлов CVS, которыt загружали в форму импорта/обновления БД.

exportcsvfile.php

Файл со сценарием построчного экспорта в CVS-файл.

updateimportcsvfile.php

Файл, который сочетает в своем сценарии сразу два инструмента, - это обновление строки в базе если она есть и добавление, если такой строки нет.

importcsvfile.php

это файл только для импорта.

Остальные файлы не используются. пока хранятся для сравнения и как вариант.

Инструменты хоть и заточены под поля таблицы базы данных модуля статей, но не являются модулем или плагином движка котонти, и поэтому устанавливаются как самостоятельная библиотека.

 

Порядок установки "CVS-Tools для Cotonti":

1. Скачиваем с репозитория по ссылке ниже.

2. В скачаном архиве находится папка "cvstools".

Её закачиваем в корень вашего сайта.

3. Подключаем базу.

Открываем public_html/cvstools/dbconfig.php

    // БД конфигурация и поключение  
    const DB_HOST = "localhost";
    const DB_USERNAME = "пользователь";
    const DB_PASSWORD = "пароль";
    const DB_NAME = "имя базы данных";

прописываем свои корректные данные доступа.

4. Интерфейс и запуск

Прописываем в адресной строке

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-файлов.


ENGLISH

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.

About

CVS-Инструменты для Cotonti. Импорт данных из файла CVS в базу данных MySQL. Экспорт статей из БД в CVS-файл

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages