Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Product Listing modifcation help needed


2 replies to this topic

#1 ShaGGy

  • Community Member
  • 59 posts
  • Real Name:Les

Posted 13 January 2012, 02:59

I am trying to make a customer history box where a customer can click it and get a list (similar to product_listing.php's output) where the customer can buy more of the same items they have purchased previously.

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.


#2 DunWeb

  • Community Sponsor
  • 10,466 posts
  • Real Name:Chris Dunn
  • Gender:Male
  • Location:Tecumseh, Ontario, Canada N8N 1X8

Posted 13 January 2012, 03:31

Les,

Have up looked at the existing Order History w/Quick Reorder Contribution ??


If nothing else, it may answer your questions and give you guidance to create your own contribution.



Chris
:|: Was this post helpful ? Click the LIKE THIS button :|:

:|: Click Here to learn how I can help you with custom coding, add ons, security and templates :|:

:|: Need an Area Calculator, Pre-Paid Account, Virtual Pin, Auction or Layaway Add on ? Click Here :|:

#3 ShaGGy

  • Community Member
  • 59 posts
  • Real Name:Les

Posted 13 January 2012, 17:02

Thanks Dunweb i did have a look for a module to modify but missed that one [img]http://forums.oscommerce.com//public/style_emoticons/default/smile.png[/img]

Do you know how/what product_listing calls to get its info?

Edited by ShaGGy, 13 January 2012, 17:16.