53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* User: Yohann Genre
|
|
* Date: 30/10/2015
|
|
* Time: 13:04
|
|
*
|
|
*/
|
|
|
|
namespace AdvancePrices\Loop;
|
|
|
|
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
|
|
use Thelia\Core\Template\Element\BaseLoop;
|
|
use AdvancePrices\WebService\USSProduct;
|
|
use Thelia\Core\Template\Element\LoopResult;
|
|
use Thelia\Core\Template\Element\LoopResultRow;
|
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|
|
|
|
|
class ExternalName extends BaseLoop implements ArraySearchLoopInterface
|
|
{
|
|
|
|
/**
|
|
* @return ArgumentCollection
|
|
*/
|
|
protected function getArgDefinitions()
|
|
{
|
|
return new ArgumentCollection(
|
|
|
|
);
|
|
}
|
|
|
|
public function buildArray()
|
|
{
|
|
$ws = new USSProduct();
|
|
|
|
return $ws->getProductList();
|
|
}
|
|
|
|
public function parseResults(LoopResult $loopResult)
|
|
{
|
|
foreach ($loopResult->getResultDataCollection() as $product) {
|
|
$loopResultRow = new LoopResultRow();
|
|
$loopResultRow->set("NAME", $product->name)
|
|
->set("LABEL", utf8_decode($product->label));
|
|
|
|
$loopResult->addRow($loopResultRow);
|
|
}
|
|
|
|
return $loopResult;
|
|
|
|
}
|
|
|
|
} |