♥Tsimi Posted June 9, 2018 Share Posted June 9, 2018 @puggybelle Close.... You cannot use $product_info[products_quantity] in the new_products modules. Two reasons why. 1. look at the code, all variables are like $new_products['products_id'] or $new_products['products_image'] use $new_products and not $product_info because well it is a new_products module. 2. the p.products_quantity check is not inside the new products database query so it cannot understand and check for it. Therefore we use the same function as we used in the product_listing file, tep_get_products_stock, which checks for the products_quantity. That combined with the right variable $new_products['products_id'] becomes if ( tep_get_products_stock($new_products['products_id']) >= 1) { If you want to know what the tep_get_products_stock does. Here the function code (inside general.php) //// // Return a product's stock // TABLES: products function tep_get_products_stock($products_id) { $products_id = tep_get_prid($products_id); $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $stock_values = tep_db_fetch_array($stock_query); return $stock_values['products_quantity']; } Link to comment Share on other sites More sharing options...
Guest Posted June 10, 2018 Share Posted June 10, 2018 Got it - Thanks for all of your help! - Andrea Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.