// Webservice: Stock
This commit is contained in:
@@ -78,6 +78,20 @@ class StockCore extends ObjectModel
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$webserviceParameters
|
||||
*/
|
||||
protected $webserviceParameters = array(
|
||||
'fields' => array(
|
||||
'id_warehouse' => array('xlink_resource' => 'warehouses'),
|
||||
'id_product' => array('xlink_resource' => 'products'),
|
||||
'id_product_attribute' => array('xlink_resource' => 'combinations'),
|
||||
'real_quantity' => array('getter' => 'getWsRealQuantity', 'setter' => false),
|
||||
),
|
||||
'hidden_fields' => array(
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* @see ObjectModel::update()
|
||||
*/
|
||||
@@ -130,4 +144,14 @@ class StockCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Webservice : used to get the real quantity of a product
|
||||
*/
|
||||
public function getWsRealQuantity()
|
||||
{
|
||||
$manager = StockManagerFactory::getManager();
|
||||
$quantity = $manager->getProductRealQuantities($this->id_product, $this->id_product_attribute, $this->id_warehouse, true);
|
||||
return $quantity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user