controller/jobs/src/Controller/Jobs/Catalog/Import/Xml/Standard.php
protected function importNode( \DomElement $node, $domains, $parentid, array &$map )
	{
		$manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' );

		if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null )
		{
			try
			{
				$item = $manager->findItem( $attr->nodeValue, $domains );
				$manager->moveItem( $item->getId(), $item->getParentId(), $parentid );

				$item = $this->process( $item, $node );
				$currentid = $manager->saveItem( $item )->getId();
				unset( $item );

				$tree = $manager->getTree( $currentid, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST );

				foreach( $tree->getChildren() as $child ) {
					$map[$child->getCode()] = $child->getId();
				}

				return $currentid;
			}
			catch( \Aimeos\MShop\Exception $e ) {} // not found, create new
		}

		$item = $this->process( $manager->createItem(), $node );
		return $manager->insertItem( $item, $parentid )->getId();
	}
protected function importNode( \DomElement $node, $domains, $parentid, array &$map )
	{
		$manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' );

		if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null )
		{
			try
			{
				$item = $manager->findItem( $attr->nodeValue, $domains );
				$manager->moveItem( $item->getId(), $item->getParentId(), $parentid );

				$item = $this->process( $item, $node );
				$currentid = $manager->saveItem( $item )->getId();
				unset( $item );

				$tree = $manager->getTree( $currentid, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST );

				foreach( $tree->getChildren() as $child ) {
					$map[$child->getCode()] = $child->getId();
				}

				return $currentid;
			}
			catch( \Aimeos\MShop\Exception $e ) {} // not found, create new
		}

		$item = $this->process( $manager->createItem(), $node );
		return $manager->insertItem( $item, $parentid )->getId();
	}
protected function importNode ( \ DomElement $ node , $ domains , $ parentid , array & $ map ) { $ manager = \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'catalog' ) ; if ( ( $ attr = $ node -> attributes -> getNamedItem ( 'ref' ) ) !== null ) { try { $ item = $ manager -> findItem ( $ attr -> nodeValue , $ domains ) ; $ manager -> moveItem ( $ item -> getId ( ) , $ item -> getParentId ( ) , $ parentid ) ; $ item = $ this -> process ( $ item , $ node ) ; $ currentid = $ manager -> saveItem ( $ item ) -> getId ( ) ; unset ( $ item ) ; $ tree = $ manager -> getTree ( $ currentid , [ ] , \ Aimeos \ MW \ Tree \ Manager \ Base :: LEVEL_LIST ) ; foreach ( $ tree -> getChildren ( ) as $ child ) { $ map [ $ child -> getCode ( ) ] = $ child -> getId ( ) ; } return $ currentid ; } catch ( \ Aimeos \ MShop \ Exception $ e ) { } // not found, create new } $ item = $ this -> process ( $ manager -> createItem ( ) , $ node ) ; return $ manager -> insertItem ( $ item , $ parentid ) -> getId ( ) ; }
Imports a single category node

@param \DomElement $node DOM node of "catalogitem" element
@param string[] $domains List of domain names whose referenced items will be updated in the catalog items
@param string|null $parentid ID of the parent catalog node
@param array &$map Will contain the associative list of code/ID pairs of the child categories
@return string Catalog ID of the imported category
Imports a single category node