Created
February 7, 2019 15:29
-
-
Save VeroLom/7436fa8e5c4041043f11deda3961fb7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require "standalone.php"; | |
$file_name = 'files/filesToImport/sgimport.xml'; | |
$reader = new XMLReader(); | |
$reader->open($file_name); | |
$doc = new DOMDocument(); | |
$i = 1; | |
while($reader->read()) { | |
if($reader->nodeType == XMLReader::ELEMENT) { | |
if($reader->localName == 'ЭлементСправочника') { | |
$node = simplexml_import_dom($doc->importNode($reader->expand(), true)); | |
?> | |
<p><strong>Код:</strong> <?= $node->Код ?></p> | |
<p><strong>Артикул:</strong> <?= $node->Артикул ?></p> | |
<p><strong>Количество:</strong> <?= $node->Количество ?></p> | |
<p><strong>Оптовая цена:</strong> <?= $node->ОптоваяЦена ?></p> | |
<p><strong>Розничная цена:</strong> <?= $node->РозничнаяЦена ?></p> | |
<? | |
// Get element | |
$sel = new selector('pages'); | |
$sel->types('hierarchy-type')->name('catalog', 'object'); | |
$sel->types('object-type')->id(123); | |
$sel->where('item_code')->equals($node->Код); | |
?><p>Найдено: <?= $sel->length ?></p><? | |
//foreach($sel as $element) { | |
/*?><p><?= $element->type_id ?></p><?*/ | |
//} | |
?><hr /><? | |
$i++; | |
} | |
} | |
} | |
?> | |
<style> | |
p { margin: 0 } | |
hr { margin: 1em 0 } | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment