You are here:  » Display All featured product


Display All featured product

Submitted by technoarenasol on Tue, 2013-01-01 18:33 in

Hi David

In Featured Product only products which available but i want to display all product which i insert in admin/featured.php..its does not matter its available in any merchant or not ....

In same situation on product page you give me solution like :
{code saved}

http://www.pricetapestry.com/node/4835

I know some similar technique for this problem..I am try this technique but not successes.

Problem on this line

$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants, ".$sqlCase." FROM `".$config_databaseTablePrefix."products` WHERE normalised_name IN (".$sqlIn.") GROUP BY normalised_name ORDER BY sequence";

In this point only takes products which available on products table

Thank
Amin

Submitted by support on Wed, 2013-01-02 09:12

Hi Amin,

Since you would need to supplement the results array with unselected product names and suitable values for the summary fields (e.g. minPrice which is displayed by default by the Featured Products display module) would it be an option to take Featured Products directly from master.csv rather than the `products` table? This could be done as follows;

  require("includes/MagicParser.php");
  function myFeaturedRecordHandler($record)
  {
    global $featured;
    global $featuredNames;
    if (!in_array($record["name"],$featuredNames)) return;
    $row = array();
    $row["name"] = $record["name"];
    $row["normalised_name"] = tapestry_normalise($record["name"]);
    $row["productHREF"] = tapestry_productHREF($row);
    $row["reviewHREF"] = tapestry_reviewHREF($row);
    $row["image_url"] = $record["image_url"];
    $featured["products"][] = $row;
  }
  $sql = "SELECT * FROM `".$config_databaseTablePrefix."featured` ORDER BY sequence";
  if (database_querySelect($sql,$rows))
  {
    $featured = array();
    foreach($rows as $row) $featuredNames[] = $row["name"];
    MagicParser_parse($config_feedDirectory."master.csv","myRecordHandler","csv|44|1|34");
    require("html/featured.php");
  }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com