protected function _buildXMLProducts( MShop_Common_Manager_Interface $orderBaseManager,
		MShop_Order_Item_Base_Interface $base, DOMDocument $dom, DOMElement $orderitem )
	{
		$orderProductManager = $orderBaseManager->getSubManager( 'product' );
		$criteria = $orderProductManager->createSearch();
		$criteria->setConditions( $criteria->compare( '==', 'order.base.product.baseid', $base->getId() ) );
		$criteria->setSortations( array( $criteria->sort( '+', 'order.base.product.position' ) ) );
		$allproducts = $orderProductManager->searchItems( $criteria );

		$products = $childproducts = array();
		foreach( $allproducts as $product )
		{
			if( $product->getOrderProductId() === null )
			{
				$products[] = $product;
				continue;
			}

			$childproducts[ $product->getOrderProductId() ][] = $product;
		}

		$productlist = $dom->createElement( 'productlist' );

		foreach( $products as $product )
		{
			$price = $product->getPrice();
			$total = $price->getValue() + $price->getCosts();

			$productitem = $dom->createElement( 'productitem' );

			$this->_appendChildCDATA( 'position', $product->getPosition(), $dom, $productitem );
			$this->_appendChildCDATA( 'code', $product->getProductCode(), $dom, $productitem );
			$this->_appendChildCDATA( 'name', $product->getName(), $dom, $productitem );
			$this->_appendChildCDATA( 'quantity', $product->getQuantity(), $dom, $productitem );

			$priceitem = $dom->createElement( 'priceitem' );
			$this->_appendChildCDATA( 'price', number_format( $price->getValue(), 2, '.', '' ), $dom, $priceitem );
			$this->_appendChildCDATA( 'shipping', number_format( $price->getCosts(), 2, '.', '' ), $dom, $priceitem );
			$this->_appendChildCDATA( 'discount', number_format( 0.00, 2, '.', '' ), $dom, $priceitem );
			$this->_appendChildCDATA( 'total', number_format( $total, 2, '.', '' ), $dom, $priceitem );
			$productitem->appendChild( $priceitem );

			if( $product->getType() === 'bundle' ) {
				$this->_buildXMLChildList( $product, $childproducts[ $product->getId() ], $dom, $productitem );
			}

			$productlist->appendChild( $productitem );
		}

		$orderitem->appendChild( $productlist );
	}
protected function _buildXMLProducts( MShop_Common_Manager_Interface $orderBaseManager,
		MShop_Order_Item_Base_Interface $base, DOMDocument $dom, DOMElement $orderitem )
	{
		$orderProductManager = $orderBaseManager->getSubManager( 'product' );
		$criteria = $orderProductManager->createSearch();
		$criteria->setConditions( $criteria->compare( '==', 'order.base.product.baseid', $base->getId() ) );
		$criteria->setSortations( array( $criteria->sort( '+', 'order.base.product.position' ) ) );
		$allproducts = $orderProductManager->searchItems( $criteria );

		$products = $childproducts = array();
		foreach( $allproducts as $product )
		{
			if( $product->getOrderProductId() === null )
			{
				$products[] = $product;
				continue;
			}

			$childproducts[ $product->getOrderProductId() ][] = $product;
		}

		$productlist = $dom->createElement( 'productlist' );

		foreach( $products as $product )
		{
			$price = $product->getPrice();
			$total = $price->getValue() + $price->getCosts();

			$productitem = $dom->createElement( 'productitem' );

			$this->_appendChildCDATA( 'position', $product->getPosition(), $dom, $productitem );
			$this->_appendChildCDATA( 'code', $product->getProductCode(), $dom, $productitem );
			$this->_appendChildCDATA( 'name', $product->getName(), $dom, $productitem );
			$this->_appendChildCDATA( 'quantity', $product->getQuantity(), $dom, $productitem );

			$priceitem = $dom->createElement( 'priceitem' );
			$this->_appendChildCDATA( 'price', number_format( $price->getValue(), 2, '.', '' ), $dom, $priceitem );
			$this->_appendChildCDATA( 'shipping', number_format( $price->getCosts(), 2, '.', '' ), $dom, $priceitem );
			$this->_appendChildCDATA( 'discount', number_format( 0.00, 2, '.', '' ), $dom, $priceitem );
			$this->_appendChildCDATA( 'total', number_format( $total, 2, '.', '' ), $dom, $priceitem );
			$productitem->appendChild( $priceitem );

			if( $product->getType() === 'bundle' ) {
				$this->_buildXMLChildList( $product, $childproducts[ $product->getId() ], $dom, $productitem );
			}

			$productlist->appendChild( $productitem );
		}

		$orderitem->appendChild( $productlist );
	}
protected function _buildXMLProducts ( MShop_Common_Manager_Interface $ orderBaseManager , MShop_Order_Item_Base_Interface $ base , DOMDocument $ dom , DOMElement $ orderitem ) { $ orderProductManager = $ orderBaseManager -> getSubManager ( 'product' ) ; $ criteria = $ orderProductManager -> createSearch ( ) ; $ criteria -> setConditions ( $ criteria -> compare ( '==' , 'order.base.product.baseid' , $ base -> getId ( ) ) ) ; $ criteria -> setSortations ( array ( $ criteria -> sort ( '+' , 'order.base.product.position' ) ) ) ; $ allproducts = $ orderProductManager -> searchItems ( $ criteria ) ; $ products = $ childproducts = array ( ) ; foreach ( $ allproducts as $ product ) { if ( $ product -> getOrderProductId ( ) === null ) { $ products [ ] = $ product ; continue ; } $ childproducts [ $ product -> getOrderProductId ( ) ] [ ] = $ product ; } $ productlist = $ dom -> createElement ( 'productlist' ) ; foreach ( $ products as $ product ) { $ price = $ product -> getPrice ( ) ; $ total = $ price -> getValue ( ) + $ price -> getCosts ( ) ; $ productitem = $ dom -> createElement ( 'productitem' ) ; $ this -> _appendChildCDATA ( 'position' , $ product -> getPosition ( ) , $ dom , $ productitem ) ; $ this -> _appendChildCDATA ( 'code' , $ product -> getProductCode ( ) , $ dom , $ productitem ) ; $ this -> _appendChildCDATA ( 'name' , $ product -> getName ( ) , $ dom , $ productitem ) ; $ this -> _appendChildCDATA ( 'quantity' , $ product -> getQuantity ( ) , $ dom , $ productitem ) ; $ priceitem = $ dom -> createElement ( 'priceitem' ) ; $ this -> _appendChildCDATA ( 'price' , number_format ( $ price -> getValue ( ) , 2 , '.' , '' ) , $ dom , $ priceitem ) ; $ this -> _appendChildCDATA ( 'shipping' , number_format ( $ price -> getCosts ( ) , 2 , '.' , '' ) , $ dom , $ priceitem ) ; $ this -> _appendChildCDATA ( 'discount' , number_format ( 0.00 , 2 , '.' , '' ) , $ dom , $ priceitem ) ; $ this -> _appendChildCDATA ( 'total' , number_format ( $ total , 2 , '.' , '' ) , $ dom , $ priceitem ) ; $ productitem -> appendChild ( $ priceitem ) ; if ( $ product -> getType ( ) === 'bundle' ) { $ this -> _buildXMLChildList ( $ product , $ childproducts [ $ product -> getId ( ) ] , $ dom , $ productitem ) ; } $ productlist -> appendChild ( $ productitem ) ; } $ orderitem -> appendChild ( $ productlist ) ; }
Adds the product list to the XML object

@param MShop_Order_Manager_Base_Interface $orderBaseManager Order base manager object
@param MShop_Order_Item_Base_Interface $base Order base object
@param DOMDocument $dom DOM document object with contains the XML structure
@param DOMElement $orderitem DOM element which will be the parent of the new child
@throws DOMException If an error occures
Adds the product list to the XML object