I have tried this query within product_info.php (with QPBB installed on 2.3.1) but keep getting no products
$bought_query = tep_db_query("select p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF( s.status, s.specials_new_products_price, NULL ) AS specials_new_products_price, IF( s.status, s.specials_new_products_price, p.products_price ) AS final_price FROM " . products_description . " pd, ". products . " p LEFT JOIN " . specials . " s ON p.products_id = s.products_id LEFT JOIN " . orders_products . " op ON op.products_id = p.products_id LEFT JOIN " . orders . " o ON op.orders_id = o.orders_id, " . products_to_categories . " p2c WHERE p.products_status = '1' AND p.products_id = p2c.products_id AND pd.products_id = p2c.products_id AND pd.language_id ='" . (int)$languages_id . "' AND o.customers_id ='" . (int)$customer_id ."'");
but if i insert this code within product_listing.php (moving the query to the top of the product_listing.php and altering the query name to match the one QPBB looks for) it gives the results (product_id & price & model)? (note you have to be logged in on a account that has sales history to get results)
<?php
require('includes/application_top.php');
$bought_query = tep_db_query("select p.products_id, p.manufacturers_id, p.products_price, p.products_model, p.products_tax_class_id, IF( s.status, s.specials_new_products_price, NULL ) AS specials_new_products_price, IF( s.status, s.specials_new_products_price, p.products_price ) AS final_price FROM " . products_description . " pd, ". products . " p LEFT JOIN " . specials . " s ON p.products_id = s.products_id LEFT JOIN " . orders_products . " op ON op.products_id = p.products_id LEFT JOIN " . orders . " o ON op.orders_id = o.orders_id, " . products_to_categories . " p2c WHERE p.products_status = '1' AND p.products_id = p2c.products_id AND pd.products_id = p2c.products_id AND pd.language_id ='" . (int)$languages_id . "' AND o.customers_id ='" . (int)$customer_id ."'");
// get the data
echo "<table border=1 cellpadding=5>";
echo "<tr><td>products_id</td><td>products_price</td><td>products_model</td></tr>";
while ( $categories = tep_db_fetch_array($bought_query) ) {
$cPath_new = tep_get_path($categories['products_id']);
echo "<tr><td>" . $categories ["products_id"] . "</td><td>" . $categories["products_price"] . "</td><td>" . $categories["products_model"] . "</td></tr>";
}
echo "</table>";
?>
does anyone know how I can get a copy of product_listing.php to display the results from the SQL query above?
Edited by ShaGGy, 13 January 2012, 03:04.














