PHP code example of gillbeits / commerceml

1. Go to this page and download the library: Download gillbeits/commerceml library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gillbeits / commerceml example snippets


$parser = new \CommerceMLParser\Parser(); // Создание экземпляра класса парсера
$parser->addListener("CategoryEvent", function (\CommerceMLParser\Event\CategoryEvent $categoryEvent) {
    $categories = $categoryEvent->getCategory()->fetch(); // array of Category
}); // добавление функции обработки события CategoryEvent
$parser->parse($pathToImportXmlFile); // полный путь до файла import.xml (Commerce ML 2) выгрузки из 1с