protected function _getProductListTypeId( MShop_Common_Manager_Interface $productListManager, $code )
	{
		$productListTypeManager = $productListManager->getSubManager( 'type' );

		$search = $productListTypeManager->createSearch();
		$search->setConditions( $search->compare( '==', 'product.list.type.code', $code ) );
		$items = $productListTypeManager->searchItems( $search );

		if( ( $suggestionType = reset( $items ) ) === false  ) {
			//create suggestion list type
			$suggestionType = $productListTypeManager->createItem();
			$suggestionType->setCode( $code );
			$suggestionType->setLabel( ucfirst( $code ) );
			$suggestionType->setDomain( 'product' );
			$suggestionType->setStatus( 1 );
			$suggestionType->setSiteId( $this->_getContext()->getLocale()->getSiteId() );

			$productListTypeManager->saveItem( $suggestionType );
		}

		return $suggestionType->getId();
	}
protected function _getProductListTypeId( MShop_Common_Manager_Interface $productListManager, $code )
	{
		$productListTypeManager = $productListManager->getSubManager( 'type' );

		$search = $productListTypeManager->createSearch();
		$search->setConditions( $search->compare( '==', 'product.list.type.code', $code ) );
		$items = $productListTypeManager->searchItems( $search );

		if( ( $suggestionType = reset( $items ) ) === false  ) {
			//create suggestion list type
			$suggestionType = $productListTypeManager->createItem();
			$suggestionType->setCode( $code );
			$suggestionType->setLabel( ucfirst( $code ) );
			$suggestionType->setDomain( 'product' );
			$suggestionType->setStatus( 1 );
			$suggestionType->setSiteId( $this->_getContext()->getLocale()->getSiteId() );

			$productListTypeManager->saveItem( $suggestionType );
		}

		return $suggestionType->getId();
	}
protected function _getProductListTypeId ( MShop_Common_Manager_Interface $ productListManager , $ code ) { $ productListTypeManager = $ productListManager -> getSubManager ( 'type' ) ; $ search = $ productListTypeManager -> createSearch ( ) ; $ search -> setConditions ( $ search -> compare ( '==' , 'product.list.type.code' , $ code ) ) ; $ items = $ productListTypeManager -> searchItems ( $ search ) ; if ( ( $ suggestionType = reset ( $ items ) ) === false ) { //create suggestion list type $ suggestionType = $ productListTypeManager -> createItem ( ) ; $ suggestionType -> setCode ( $ code ) ; $ suggestionType -> setLabel ( ucfirst ( $ code ) ) ; $ suggestionType -> setDomain ( 'product' ) ; $ suggestionType -> setStatus ( 1 ) ; $ suggestionType -> setSiteId ( $ this -> _getContext ( ) -> getLocale ( ) -> getSiteId ( ) ) ; $ productListTypeManager -> saveItem ( $ suggestionType ) ; } return $ suggestionType -> getId ( ) ; }
Gets or creates product list type item with specified code.

@param MShop_Common_Manager_Interface $productListManager Manager for list types of product domain
@param string $code Code of product list type

@return int Suggestion product list type id
Gets or creates product list type item with specified code .