Return to Snippet

Revision: 69325
at May 30, 2015 17:25 by hungryweb


Initial Code
function fn_hw_product_stock($product_id){
	$values = db_get_row("SELECT amount, tracking FROM ?:products WHERE product_id = ?s LIMIT 1", $product_id);
	$amount = $values['amount'];
	if($values['tracking'] == 'O'){
		$options_amount = db_get_row("SELECT SUM(amount) as amount FROM ?:product_options_inventory WHERE product_id = ?s LIMIT 1", $product_id);
		$amount = $options_amount['amount'];
	}
	return $amount;
}

Initial URL
https://www.hungryweb.net/cs-cart-addons/

Initial Description
PHP function that returns product amount wich can be used in any custom development

Initial Title
Get Product Amount

Initial Tags


Initial Language
PHP