/ Published in: PHP
PHP function that returns product amount wich can be used in any custom development
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; }
URL: https://www.hungryweb.net/cs-cart-addons/