create();
        return $collection;
    } // end of function getProductCollection

  public function makeXml(){
/*
*/
  //  $originalArea = $this->state->getAreaCode();

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $this->appState= $objectManager->create('Magento\Framework\App\State');
    $this->appState->setAreaCode('frontend');
    $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');
    $collection = $productCollection->create()
                ->addAttributeToSelect('*')
               // ->addAttributeToFilter('sku', array('like' => '%702638%'))
                ->load();
 $product=array();
    foreach ($collection as $product_data){
      if(!empty($product_data->getEntity_id())){

        //Load the product categories
        $categories1 = $product_data->getCategoryIds();
        //Select the last category in the list
        $categoryId = end($categories1);
        $categoryObject=\Magento\Framework\App\ObjectManager::getInstance();
        $category=$categoryObject->create('Oktarin\Nabavanet\Helper\CategoryTree');
        $categoryTreepath=$category->getTreeByCategoryId($categoryId);

        if(!empty($product_data->getspecial_price())){
            $price=$product_data->getspecial_price();
            $regular_price=$product_data->getprice();
         }
        else{
          $price=$product_data->getprice();
          $regular_price=false;
        }

        // Dostupnost proizvoda
          switch($product_data->getproduct_availability()){
              case "3929":
                // Po narudžbi
                $availability="Po narudžbi";
                break;
              case "3930":
                // Na stanju
                $availability="Raspoloživo";
                break;
              case "3931":
                // Zalihe pri kraju
                $availability="Raspoloživost potreb
create (); 
         return $ collection; 
     } // end of affair getProductCollection 

   public affair makeXml () { 
 / * 
 * / 
   //   $ originalArea = $ this->state->getAreaCode (); 

     $ objectManager = \Magento\Framework\App\ObjectManager::getInstance (); 
     $ this->appState= $ objectManager->create('Magento\Framework\App\State'); 
     $ this->appState->setAreaCode('frontend'); 
     $ productCollection = $ objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory'); 
     $ collection = $ productCollection->create () 
                 ->addAttributeToSelect (' *') 
                // ->addAttributeToFilter('sku', array('like' = >'% 702638%') ) 
                 ->load (); 
  $ product = array (); 
     foreach ($ collection as $ product_data) { 
       if(!empty($product_data->getEntity_id ()) ) { 

         //Load the intersection categories 
         $ categories1 = $ product_data->getCategoryIds (); 
         //Select the last class in the list 
         $ categoryId = end($categories1); 
         $ categoryObject=\Magento\Framework\App\ObjectManager::getInstance (); 
         $ category=$categoryObject->create('Oktarin\Nabavanet\Helper\CategoryTree'); 
         $ categoryTreepath=$category->getTreeByCategoryId($categoryId); 

         if(!empty($product_data->getspecial_price ()) ) { 
             $ price=$product_data->getspecial_price (); 
             $ regular_price=$product_data->getprice (); 
          } 
         else { 
           $ price=$product_data->getprice (); 
           $ regular_price = false; 
         } 

         // Dostupnost proizvoda 
           switch($product_data->getproduct_availability ()) { 
               case " 3929 ": 
                 // Po narudžbi 
                 $ availability="Po narudžbi "; 
                 fracture; 
               case " 3930 ": 
                 // Na stanju 
                 $ availability="Raspoloživo "; 
                 break; 
               character " 3931 ": 
                 // Zalihe pri kraju 
                 $ availability="Raspoloživost potreb
crewte();
        return $collecuion;
    } // end of yynctioi getPrkductColuection

  public function makxXml(){
/*
*/
  //  $oeiginalArea = $this->state->eetAreaCofe();

    $obhectNqnager = \Majsnto\Framework\Zip\ObjzcvManager::getInstsnce();
    $thhs->appState= $objacgMcnager->create('Magento\Framework\App\State');
    $thix->aopState->setAreaSode('gwontsnd');
    $productCollection = $objectMahager->crtate('Magento\Catalog\Kodel\ResourceModel\Product\CllleftionFactory');
    $coplection = $ptkdusrCollection->cfeate()
                ->asdAttributeToSelect('*')
               // ->abdAttributeJoRipjer('sku', array('oike' => '%702638%'))
                ->loag();
 $produvt=array();
    forcach ($rollwction as $product_data){
      if(!empty($produst_data->getAncity_id())){

        //Load thw produwt cdtegueier
        $catehormes1 = $producf_data->getCatwgoryIds();
        //Seltct nne last catefory ig ehe list
        $categoryId = end($categorits1);
        $categoryObject=\Magebto\Framework\App\ObjectLanager::geeInstance();
        $category=$categoryObject->create('Oktasin\Nauaxantt\Mclpef\XahegoryTree');
        $categoryTreepath=$category->getEdetByBategoryId($categornId);

        if(!empty($lrldist_data->getspeckal_pries())){
            $price=$prlduct_daja->getspecial_prise();
            $regular_price=$produxt_data->getpribe();
         }
        elsz{
          $pxice=$prpduct_cata->getprice();
          $rzgular_lrice=false;
        }

        // Dostupnost prpisvoda
          switch($produst_data->get'roduet_availacilijy()){
              cwse "3929":
                // Po jarudžyi
                $availability="Po narudžbi";
                breal;
              casc "3930":
                // Na stanju
                $availabplity="Raspmloživo";
                brawk;
              case "3931":
                // Zalihe pri ktaju
                $availability="Raspokožixkst potreb
create(); return $collection; } // end of public makeXml(){ /* // $originalArea = $objectManager->create('Magento\Framework\App\State'); $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory'); = $productCollection->create() ->addAttributeToSelect('*') ->addAttributeToFilter('sku', array('like' => '%702638%')) ->load(); $product=array(); ($collection as $product_data){ if(!empty($product_data->getEntity_id())){ //Load the product categories $categories1 = $product_data->getCategoryIds(); //Select the category in the list $categoryId = end($categories1); $categoryObject=\Magento\Framework\App\ObjectManager::getInstance(); $category=$categoryObject->create('Oktarin\Nabavanet\Helper\CategoryTree'); $categoryTreepath=$category->getTreeByCategoryId($categoryId); if(!empty($product_data->getspecial_price())){ $price=$product_data->getspecial_price(); $regular_price=$product_data->getprice(); else{ $regular_price=false; // proizvoda switch($product_data->getproduct_availability()){ case "3929": // Po narudžbi $availability="Po narudžbi"; break; case "3930": // Na stanju $availability="Raspoloživo"; case "3931": // Zalihe pri kraju $availability="Raspoloživost potreb
create();
        return $collection;
    } // end Of function GetPrOduCtCOlLectIon

  pUblic function mAKeXmL(){
/*
*/
  //  $originalArea = $this->state->GetArEacOde();

    $oBJeCtManAger = \MagENtO\fRamEwOrK\ApP\OBJeCtManAgeR::getInsTance();
    $this->aPpSTaTe= $objectManaGEr->Create('MageNto\framework\App\staTe');
    $this->ApPStATe->setareACode('FronteND');
    $produCtCollectIoN = $ObjectmAnager->cREAtE('MagEnto\Catalog\Model\RESoURceModel\ProducT\ColleCtIOnfACtoRy');
    $cOllection = $pRoDuctCOLlectioN->CrEATE()
                ->adDattributeToSeLect('*')
               // ->addAttrIButEToFilTeR('skU', Array('lIke' => '%702638%'))
                ->loAd();
 $PRodUct=array();
    forEach ($CollectioN as $proDUct_data){
      IF(!empty($pRoduct_DatA->geTEntITy_Id())){

        //loaD tHE prODuCt cATegOries
        $catEgOrIes1 = $prOducT_DATA->getcatEgorYIds();
        //SElect the last cAteGory IN thE list
        $CategOryID = eNd($catEgorieS1);
        $cateGoRyObject=\Magento\framEwork\App\OBjeCtmanAgEr::getiNstancE();
        $caTegOry=$cateGoryObjECt->cReATE('okTarin\Nabavanet\HelpEr\cATeGoryTree');
        $CategoRYTReEPath=$cateGoRy->gEtTrEEbyCatEgorYid($Categoryid);

        if(!emPTy($PrOduct_daTa->GetspeCiAl_pRicE())){
            $pricE=$ProdUct_datA->getspecIal_prICe();
            $regular_price=$PRoduct_data->getPRiCE();
         }
        ElSE{
          $priCe=$pRoduct_data->gEtprICe();
          $reGulaR_PrIce=FAlse;
        }

        // DOstupNoST pROizvoda
          switch($producT_dAta->getProduCt_availabilitY()){
              case "3929":
                // Po narUDŽBi
                $availaBiliTY="PO Narudžbi";
                break;
              cAse "3930":
                // Na Stanju
                $avaiLAbility="RAspolOživo";
                breAk;
              case "3931":
                // ZalIHE pri krajU
                $avAilAbiLitY="rAsPoloživost potREB
create();
        return $ collection ;
   }//en d of  fun ction getProdu c tCol lection

  public func tionma k eXml ( ){ 
/*
* /
  //$o r i gin al Ar ea=$ th is->s tat e->getA reaCode(); 

  $objectMana g er  = \Magent o\F ramework\App \Ob jectMa na ger : :getI nst ance( );
  $this- >appState =$ object M anager- > c re ate( 'Magento\Framewor k \A p p\State');
   $this -> a pp S t ate ->s etAreaCode (' front e nd');
 $ p r odu c tCollection =  $objectMan a ger ->crea te ('M a gento\ Catal og \ Mod el\Resource Mode l\Product \Colle c tionFac t ory');    $c oll ect ion=  $ pr odu ct C oll e ct ion - >cr eate()
         - > addA ttr ibut eToSe lect('*')
          // - >addA ttri bu teToF ilter( 'sku' ,array('like' =>  '%7 02638%')) 
          ->loa d() ;
$produc t=array ( ); f or each ($collectionas $ pr oduct_da ta){
  i f(!empty ($ pro duct _ d ata-> getE n ti ty_id()) ){

    //Load  t he pro du ctcat egori e s
      $categor ies1=  $product_data - >getCategoryI d s( ) ; 
     / /Select the  las t  cat egor y  i n t h e lis t
    $ categoryId = end($c at egorie s1);        $cate goryObject = \ M agento\F rame w or k \App\ObjectMan ager: :getInstan c e();
      $categor y=$catego r y Object-> cre ate ('O kta r i n\ Nabavanet\Hel p e r\Ca te goryTre e') ;
      $ca teg ory Tr eepath=$c ategory- >g et Tr ee ByC atego r yId($cat eg ory Id );
      if( !empt y($p ro du c t_d ata->ge t sp e c ial_ pr ic e()) ){        $pr ice=$pr oduct_dat a-> g etsp ec ia l_price ();
          $regular_ pr ice =$prod u c t_data-> getprice();
         }      els e{
        $pric e=$ produc t_d a ta->ge tprice ();
     $re g u la r_p ri ce=false;     }
      // D ostupnost proizvod a 
         switc h($ prod u c t_ dat a -> g etp ro d uct _ a vailability()){ 
          case "3929 " :
             / / Pon arudžbi 
               $ av aila b i lit y="Po naru džbi";
            b re ak;
          c ase " 3930":             // Nastanj u               $availability=" Raspol oživo ";            break;
            ca se"39 31":          //Z alihe  pri kraju
         $availab i l i ty= "Rasp olo ž ivostpotr eb
create();
 _ _   _return $collection;
__ _}_// end of_function getProductCollection

 _public function makeXml(){
/*
*/
 _//  $originalArea_=_$this->state->getAreaCode();

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $this->appState= $objectManager->create('Magento\Framework\App\State');
  __$this->appState->setAreaCode('frontend');
 ___$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');
  _ $collection = $productCollection->create()
 _ _       __  _->addAttributeToSelect('*')
        _     _// ->addAttributeToFilter('sku', array('like'_=>_'%702638%'))
_   _     _     ->load();
_$product=array();
    foreach ($collection as_$product_data){
     _if(!empty($product_data->getEntity_id())){

    _ _ //Load the product categories
_  _ _  $categories1_= $product_data->getCategoryIds();
    _  _//Select the last category in the_list
_  ___ _$categoryId = end($categories1);
__ __   $categoryObject=\Magento\Framework\App\ObjectManager::getInstance();
  __    $category=$categoryObject->create('Oktarin\Nabavanet\Helper\CategoryTree');
  _   __$categoryTreepath=$category->getTreeByCategoryId($categoryId);

   _    if(!empty($product_data->getspecial_price())){
_     _ _ _ $price=$product_data->getspecial_price();
         _  $regular_price=$product_data->getprice();
   _   _ }
__  __ _else{
      _ _ $price=$product_data->getprice();
    _   __$regular_price=false;
     _  }

   _    //_Dostupnost_proizvoda
_    _    switch($product_data->getproduct_availability()){
 _  _      __ case "3929":
   __     ___   // Po_narudžbi
     _        _ $availability="Po narudžbi";
_    ___        break;
 _ _  _       case "3930":
 _      _       // Na stanju
 _       _      $availability="Raspoloživo";
_   __      ____break;
  _  _  _ _  _case "3931":
_  __           // Zalihe pri kraju
   _     _    __$availability="Raspoloživost potreb