PHP code example of alaa / magento2-xml-feed-model
1. Go to this page and download the library: Download alaa/magento2-xml-feed-model 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/ */
alaa / magento2-xml-feed-model example snippets
// Reading the configuration file
$file = $this->moduleDirReader->getModuleDir('etc', 'YOUR_MODULE'). '/order_mapped_fields.php';
// do the mappings
/** Alaa\XmlFeedModel\Model\MappedSubjectBuilder $this->mappedSubjectBuilder */
$mappedSubject = $this->mappedSubjectBuilder->build($file, $orderSubject);
// convert the data to xml
/** @var \Alaa\XmlFeedModel\Model\XmlConverter $this->xmlConverter */
$xml = $this->xmlConverter->convert($mappedSubject);
// write the xml to a file
$xml->asXML('var/order/subject.xml');