protected function _process()
	{
		$this->_msg( 'Processing catalog demo data', 0 );

		$item = null;
		$context =  $this->_getContext();
		$manager = MShop_Factory::createManager( $context, 'catalog' );

		try
		{
			// Don't delete the catalog node because users are likely use it for production
			$item = $manager->getTree( null, array(), MW_Tree_Manager_Abstract::LEVEL_ONE );

			$this->_removeItems( $item->getId(), 'catalog/list', 'catalog', 'media' );
			$this->_removeItems( $item->getId(), 'catalog/list', 'catalog', 'text' );
			$this->_removeListItems( $item->getId(), 'catalog/list', 'product' );
		}
		catch( Exception $e ) { ; } // If no root node was already inserted into the database


		if( $context->getConfig()->get( 'setup/default/demo', false ) == true )
		{
			$ds = DIRECTORY_SEPARATOR;
			$path = __DIR__ . $ds . 'data' . $ds . 'demo-catalog.php';

			if( ( $data = include( $path ) ) == false ) {
				throw new MShop_Exception( sprintf( 'No file "%1$s" found for catalog domain', $path ) );
			}

			if( $item === null )
			{
				$item = $manager->createItem();
				$item->setCode( $data['code'] );
				$item->setLabel( $data['label'] );
				$item->setConfig( $data['config'] );
				$item->setStatus( $data['status'] );

				$manager->insertItem( $item );
			}


			if( isset( $data['media'] ) ) {
				$this->_addMedia( $item->getId(), $data['media'], 'catalog' );
			}

			if( isset( $data['product'] ) ) {
				$this->_addProducts( $item->getId(), $data['product'], 'catalog' );
			}

			if( isset( $data['text'] ) ) {
				$this->_addTexts( $item->getId(), $data['text'], 'catalog' );
			}

			$this->_status( 'added' );
		}
		else
		{
			$this->_status( 'removed' );
		}
	}
protected function _process()
	{
		$this->_msg( 'Processing catalog demo data', 0 );

		$item = null;
		$context =  $this->_getContext();
		$manager = MShop_Factory::createManager( $context, 'catalog' );

		try
		{
			// Don't delete the catalog node because users are likely use it for production
			$item = $manager->getTree( null, array(), MW_Tree_Manager_Abstract::LEVEL_ONE );

			$this->_removeItems( $item->getId(), 'catalog/list', 'catalog', 'media' );
			$this->_removeItems( $item->getId(), 'catalog/list', 'catalog', 'text' );
			$this->_removeListItems( $item->getId(), 'catalog/list', 'product' );
		}
		catch( Exception $e ) { ; } // If no root node was already inserted into the database


		if( $context->getConfig()->get( 'setup/default/demo', false ) == true )
		{
			$ds = DIRECTORY_SEPARATOR;
			$path = __DIR__ . $ds . 'data' . $ds . 'demo-catalog.php';

			if( ( $data = include( $path ) ) == false ) {
				throw new MShop_Exception( sprintf( 'No file "%1$s" found for catalog domain', $path ) );
			}

			if( $item === null )
			{
				$item = $manager->createItem();
				$item->setCode( $data['code'] );
				$item->setLabel( $data['label'] );
				$item->setConfig( $data['config'] );
				$item->setStatus( $data['status'] );

				$manager->insertItem( $item );
			}


			if( isset( $data['media'] ) ) {
				$this->_addMedia( $item->getId(), $data['media'], 'catalog' );
			}

			if( isset( $data['product'] ) ) {
				$this->_addProducts( $item->getId(), $data['product'], 'catalog' );
			}

			if( isset( $data['text'] ) ) {
				$this->_addTexts( $item->getId(), $data['text'], 'catalog' );
			}

			$this->_status( 'added' );
		}
		else
		{
			$this->_status( 'removed' );
		}
	}
protected function _process ( ) { $ this -> _msg ( 'Processing catalog demo data' , 0 ) ; $ item = null ; $ context = $ this -> _getContext ( ) ; $ manager = MShop_Factory :: createManager ( $ context , 'catalog' ) ; try { // Don't delete the catalog node because users are likely use it for production $ item = $ manager -> getTree ( null , array ( ) , MW_Tree_Manager_Abstract :: LEVEL_ONE ) ; $ this -> _removeItems ( $ item -> getId ( ) , 'catalog/list' , 'catalog' , 'media' ) ; $ this -> _removeItems ( $ item -> getId ( ) , 'catalog/list' , 'catalog' , 'text' ) ; $ this -> _removeListItems ( $ item -> getId ( ) , 'catalog/list' , 'product' ) ; } catch ( Exception $ e ) { ; } // If no root node was already inserted into the database if ( $ context -> getConfig ( ) -> get ( 'setup/default/demo' , false ) == true ) { $ ds = DIRECTORY_SEPARATOR ; $ path = __DIR__ . $ ds . 'data' . $ ds . 'demo-catalog.php' ; if ( ( $ data = include ( $ path ) ) == false ) { throw new MShop_Exception ( sprintf ( 'No file "%1$s" found for catalog domain' , $ path ) ) ; } if ( $ item === null ) { $ item = $ manager -> createItem ( ) ; $ item -> setCode ( $ data [ 'code' ] ) ; $ item -> setLabel ( $ data [ 'label' ] ) ; $ item -> setConfig ( $ data [ 'config' ] ) ; $ item -> setStatus ( $ data [ 'status' ] ) ; $ manager -> insertItem ( $ item ) ; } if ( isset ( $ data [ 'media' ] ) ) { $ this -> _addMedia ( $ item -> getId ( ) , $ data [ 'media' ] , 'catalog' ) ; } if ( isset ( $ data [ 'product' ] ) ) { $ this -> _addProducts ( $ item -> getId ( ) , $ data [ 'product' ] , 'catalog' ) ; } if ( isset ( $ data [ 'text' ] ) ) { $ this -> _addTexts ( $ item -> getId ( ) , $ data [ 'text' ] , 'catalog' ) ; } $ this -> _status ( 'added' ) ; } else { $ this -> _status ( 'removed' ) ; } }
Insert catalog nodes and relations.
Insert catalog nodes and relations .