Example #1
0
 /**
  * Offers parser
  */
 public function parse()
 {
     $this->dispatcher->dispatch(Events::BUFFER_PARSE_OFFERS_PRE, null);
     $this->attrChanges(Description::PACKAGEOFFERS);
     $offers = $this->xml->elements(Description::PACKAGEOFFERS, Description::OFFERS, Description::OFFER);
     $this->createOffers($offers);
     $this->dispatcher->dispatch(Events::BUFFER_PARSE_OFFERS_END, null);
 }
Example #2
0
 /**
  * Stock parser
  */
 public function parse()
 {
     $this->dispatcher->dispatch(Events::BUFFER_PARSE_STOCK_PRE, null);
     $this->attrChanges(Description::CATALOG);
     $groups = $this->xml->elements(Description::CLASSI, Description::GROUPS, Description::GROUP);
     $this->createGroups($groups);
     $properties = $this->xml->elements(Description::CLASSI, Description::PROPERTIES, Description::PROPERY);
     $this->createProperties($properties);
     $catalog = $this->xml->elements(Description::CATALOG);
     if (empty($catalog)) {
         throw new NotExistElementException('Need ID catalog');
     }
     $catalogId = $catalog[0]->value(Description::ID);
     $products = $this->xml->elements(Description::CATALOG, Description::PRODUCTS, Description::PRODUCT);
     $this->createProducts($products, $catalogId);
     $this->dispatcher->dispatch(Events::BUFFER_PARSE_STOCK_END, null);
 }