public function increase( $productCode, $warehouseCode, $amount )
	{
		$context = $this->_getContext();

		$productManager = MShop_Factory::createManager( $context, 'product' );
		$search = $productManager->createSearch();
		$search->setConditions( $search->compare( '==', 'product.code', $productCode ) );
		$productIds = array_keys( $productManager->searchItems( $search ) );

		$warehouseManager = $this->getSubManager( 'warehouse' );
		$search = $warehouseManager->createSearch();
		$search->setConditions( $search->compare( '==', 'product.stock.warehouse.code', $warehouseCode ) );
		$warehouseIds = array_keys( $warehouseManager->searchItems( $search ) );

		if( empty( $warehouseIds ) ) {
			throw new MShop_Product_Exception( sprintf( 'No warehouse for code "%1$s" found', $warehouseCode ) );
		}

		$search = $this->createSearch();
		$expr = array(
			$search->compare( '==', 'product.stock.siteid', $context->getLocale()->getSitePath() ),
			$search->compare( '==', 'product.stock.productid', $productIds ),
			$search->compare( '==', 'product.stock.warehouseid', $warehouseIds ),
		);
		$search->setConditions( $search->combine( '&&', $expr ) );

		$types = array(
			'product.stock.siteid' => $this->_searchConfig['product.stock.siteid']['internaltype'],
			'product.stock.productid' => $this->_searchConfig['product.stock.productid']['internaltype'],
			'product.stock.warehouseid' => $this->_searchConfig['product.stock.warehouseid']['internaltype'],
		);
		$translations = array(
			'product.stock.siteid' => '"siteid"',
			'product.stock.productid' => '"prodid"',
			'product.stock.warehouseid' => '"warehouseid"',
		);

		$conditions = $search->getConditionString( $types, $translations );

		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			/** mshop/product/manager/stock/default/item/stocklevel
			 * Increases or decreases the stock level for the given product and warehouse code
			 *
			 * The stock level is decreased for the ordered products each time
			 * an order is placed by a customer successfully. Also, updates
			 * from external sources like ERP systems can increase the stock
			 * level of a product if no absolute values are set via saveItem()
			 * instead.
			 *
			 * The stock level must be from one of the sites that are configured
			 * via the context item. If the current site is part of a tree of
			 * sites, the statement can increase or decrease stock levels from
			 * the current site and all parent sites if the stock level is
			 * inherited by one of the parent sites.
			 *
			 * Each time the stock level is updated, the modification time is
			 * set to the current timestamp and the editor field is updated.
			 *
			 * @param string SQL statement for increasing/decreasing the stock level
			 * @since 2014.03
			 * @category Developer
			 * @see mshop/product/manager/stock/default/item/insert
			 * @see mshop/product/manager/stock/default/item/update
			 * @see mshop/product/manager/stock/default/item/newid
			 * @see mshop/product/manager/stock/default/item/delete
			 * @see mshop/product/manager/stock/default/item/search
			 * @see mshop/product/manager/stock/default/item/count
			 */
			$path = 'mshop/product/manager/stock/default/item/stocklevel';
			$stmt = $conn->create( str_replace( ':cond', $conditions, $context->getConfig()->get( $path, $path ) ) );

			$stmt->bind( 1, $amount, MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->bind( 2, date( 'Y-m-d H:i:s' ) ); //mtime
			$stmt->bind( 3, $context->getEditor() );

			$stmt->execute()->finish();

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}
	}
public function increase( $productCode, $warehouseCode, $amount )
	{
		$context = $this->_getContext();

		$productManager = MShop_Factory::createManager( $context, 'product' );
		$search = $productManager->createSearch();
		$search->setConditions( $search->compare( '==', 'product.code', $productCode ) );
		$productIds = array_keys( $productManager->searchItems( $search ) );

		$warehouseManager = $this->getSubManager( 'warehouse' );
		$search = $warehouseManager->createSearch();
		$search->setConditions( $search->compare( '==', 'product.stock.warehouse.code', $warehouseCode ) );
		$warehouseIds = array_keys( $warehouseManager->searchItems( $search ) );

		if( empty( $warehouseIds ) ) {
			throw new MShop_Product_Exception( sprintf( 'No warehouse for code "%1$s" found', $warehouseCode ) );
		}

		$search = $this->createSearch();
		$expr = array(
			$search->compare( '==', 'product.stock.siteid', $context->getLocale()->getSitePath() ),
			$search->compare( '==', 'product.stock.productid', $productIds ),
			$search->compare( '==', 'product.stock.warehouseid', $warehouseIds ),
		);
		$search->setConditions( $search->combine( '&&', $expr ) );

		$types = array(
			'product.stock.siteid' => $this->_searchConfig['product.stock.siteid']['internaltype'],
			'product.stock.productid' => $this->_searchConfig['product.stock.productid']['internaltype'],
			'product.stock.warehouseid' => $this->_searchConfig['product.stock.warehouseid']['internaltype'],
		);
		$translations = array(
			'product.stock.siteid' => '"siteid"',
			'product.stock.productid' => '"prodid"',
			'product.stock.warehouseid' => '"warehouseid"',
		);

		$conditions = $search->getConditionString( $types, $translations );

		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			/** mshop/product/manager/stock/default/item/stocklevel
			 * Increases or decreases the stock level for the given product and warehouse code
			 *
			 * The stock level is decreased for the ordered products each time
			 * an order is placed by a customer successfully. Also, updates
			 * from external sources like ERP systems can increase the stock
			 * level of a product if no absolute values are set via saveItem()
			 * instead.
			 *
			 * The stock level must be from one of the sites that are configured
			 * via the context item. If the current site is part of a tree of
			 * sites, the statement can increase or decrease stock levels from
			 * the current site and all parent sites if the stock level is
			 * inherited by one of the parent sites.
			 *
			 * Each time the stock level is updated, the modification time is
			 * set to the current timestamp and the editor field is updated.
			 *
			 * @param string SQL statement for increasing/decreasing the stock level
			 * @since 2014.03
			 * @category Developer
			 * @see mshop/product/manager/stock/default/item/insert
			 * @see mshop/product/manager/stock/default/item/update
			 * @see mshop/product/manager/stock/default/item/newid
			 * @see mshop/product/manager/stock/default/item/delete
			 * @see mshop/product/manager/stock/default/item/search
			 * @see mshop/product/manager/stock/default/item/count
			 */
			$path = 'mshop/product/manager/stock/default/item/stocklevel';
			$stmt = $conn->create( str_replace( ':cond', $conditions, $context->getConfig()->get( $path, $path ) ) );

			$stmt->bind( 1, $amount, MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->bind( 2, date( 'Y-m-d H:i:s' ) ); //mtime
			$stmt->bind( 3, $context->getEditor() );

			$stmt->execute()->finish();

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}
	}
public function increase ( $ productCode , $ warehouseCode , $ amount ) { $ context = $ this -> _getContext ( ) ; $ productManager = MShop_Factory :: createManager ( $ context , 'product' ) ; $ search = $ productManager -> createSearch ( ) ; $ search -> setConditions ( $ search -> compare ( '==' , 'product.code' , $ productCode ) ) ; $ productIds = array_keys ( $ productManager -> searchItems ( $ search ) ) ; $ warehouseManager = $ this -> getSubManager ( 'warehouse' ) ; $ search = $ warehouseManager -> createSearch ( ) ; $ search -> setConditions ( $ search -> compare ( '==' , 'product.stock.warehouse.code' , $ warehouseCode ) ) ; $ warehouseIds = array_keys ( $ warehouseManager -> searchItems ( $ search ) ) ; if ( empty ( $ warehouseIds ) ) { throw new MShop_Product_Exception ( sprintf ( 'No warehouse for code "%1$s" found' , $ warehouseCode ) ) ; } $ search = $ this -> createSearch ( ) ; $ expr = array ( $ search -> compare ( '==' , 'product.stock.siteid' , $ context -> getLocale ( ) -> getSitePath ( ) ) , $ search -> compare ( '==' , 'product.stock.productid' , $ productIds ) , $ search -> compare ( '==' , 'product.stock.warehouseid' , $ warehouseIds ) , ) ; $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; $ types = array ( 'product.stock.siteid' => $ this -> _searchConfig [ 'product.stock.siteid' ] [ 'internaltype' ] , 'product.stock.productid' => $ this -> _searchConfig [ 'product.stock.productid' ] [ 'internaltype' ] , 'product.stock.warehouseid' => $ this -> _searchConfig [ 'product.stock.warehouseid' ] [ 'internaltype' ] , ) ; $ translations = array ( 'product.stock.siteid' => '"siteid"' , 'product.stock.productid' => '"prodid"' , 'product.stock.warehouseid' => '"warehouseid"' , ) ; $ conditions = $ search -> getConditionString ( $ types , $ translations ) ; $ dbm = $ context -> getDatabaseManager ( ) ; $ dbname = $ this -> _getResourceName ( ) ; $ conn = $ dbm -> acquire ( $ dbname ) ; try { /** mshop/product/manager/stock/default/item/stocklevel
			 * Increases or decreases the stock level for the given product and warehouse code
			 *
			 * The stock level is decreased for the ordered products each time
			 * an order is placed by a customer successfully. Also, updates
			 * from external sources like ERP systems can increase the stock
			 * level of a product if no absolute values are set via saveItem()
			 * instead.
			 *
			 * The stock level must be from one of the sites that are configured
			 * via the context item. If the current site is part of a tree of
			 * sites, the statement can increase or decrease stock levels from
			 * the current site and all parent sites if the stock level is
			 * inherited by one of the parent sites.
			 *
			 * Each time the stock level is updated, the modification time is
			 * set to the current timestamp and the editor field is updated.
			 *
			 * @param string SQL statement for increasing/decreasing the stock level
			 * @since 2014.03
			 * @category Developer
			 * @see mshop/product/manager/stock/default/item/insert
			 * @see mshop/product/manager/stock/default/item/update
			 * @see mshop/product/manager/stock/default/item/newid
			 * @see mshop/product/manager/stock/default/item/delete
			 * @see mshop/product/manager/stock/default/item/search
			 * @see mshop/product/manager/stock/default/item/count
			 */ $ path = 'mshop/product/manager/stock/default/item/stocklevel' ; $ stmt = $ conn -> create ( str_replace ( ':cond' , $ conditions , $ context -> getConfig ( ) -> get ( $ path , $ path ) ) ) ; $ stmt -> bind ( 1 , $ amount , MW_DB_Statement_Abstract :: PARAM_INT ) ; $ stmt -> bind ( 2 , date ( 'Y-m-d H:i:s' ) ) ; //mtime $ stmt -> bind ( 3 , $ context -> getEditor ( ) ) ; $ stmt -> execute ( ) -> finish ( ) ; $ dbm -> release ( $ conn , $ dbname ) ; } catch ( Exception $ e ) { $ dbm -> release ( $ conn , $ dbname ) ; throw $ e ; } }
Increases the stock level of the product for the warehouse.

@param string $productCode Unique code of a product
@param string $warehouseCode Unique code of the warehouse
@param integer $amount Amount the stock level should be increased
Increases the stock level of the product for the warehouse .