You are here:  » Great Deals


Great Deals

Submitted by ser_seven on Wed, 2006-08-30 14:31 in

I have realized a page semi-statics where are include header,search form and footer.
I want to also insert in this page a section great deals.
it is possible to create so many featured pages (example featured-phone.php,featured-car.php, and etc) to includes manualy in my semi-statics pages?

Excuse for my continuous questions !!

Bye bye

Submitted by support on Wed, 2006-08-30 15:10

Hello Ser,

I think I can see what you're trying to do. The built in featured products displays products from the list that you can edit in the Admin area.

But if you want to create separate featured products pages, you can do them manually with a list of products in each one. For example:

featured-phone.php

<?php
  
require("includes/common.php");
  
$banner["h2"] = "<strong>Best Deals On Phones</strong>";
  require(
"html/header.php");
  require(
"html/searchform.php");
  require(
"html/banner.php");
  
// ****************************************************
  // * EDIT THE LIST OF FEATURED PRODUCTS TO DISPLAY HERE
  
$featured[] = "Nokia 6110";
  
$featured[] = "Nokia 6210";
  
$featured[] = "Motorola Pebble";
  
// *
  // ****************************************************
  
$sqlNames = array();
  foreach(
$featured as $name)
  {
    
$sqlNames[] = "'".$name."'";
  }
  
$sqlIn implode(",",$sqlNames);
  
$sql "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `".$config_databaseTablePrefix."products` WHERE name IN (".$sqlIn.") GROUP BY name";
  
database_querySelect($sql,$rows);
  
$featured["products"] = $rows;
  foreach(
$featured["products"] as $k => $product)
  {
    if (
$config_useRewrite)
    {
      
$featured["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";
      
$featured["products"][$k]["reviewHREF"] = "review/".tapestry_hyphenate($product["name"]).".html";
    }
    else
    {
      
$featured["products"][$k]["productHREF"] = "products.php?q=".urlencode($product["name"]);
      
$featured["products"][$k]["reviewHREF"] = "reviews.php?q=".urlencode($product["name"]);
    }
  }
  require(
"html/featured.php");
  require(
"html/footer.php");
?>

The values in the $featured[] array must be exactly the same as the product names as they are displayed on your site. I hope I have understood you correctly!

Cheers,
David.

Submitted by ser_seven on Wed, 2006-08-30 15:54

I preferred to have in admin the page /admin/featured-phone.php and in html directory /htlm/featured-phone.php, ecc ecc

But if it is not possible I will do as you have told me

Submitted by support on Wed, 2006-08-30 16:15

Hi Ser,

It is possible but it would require additional tables and new admin scripts to manage each table (or select the table you wish to manage). If you're happy to manage it by editing the files directly it's a much more straight forward solution and far easier to add new featured product sets.

Cheers,
David.

Submitted by ser_seven on Wed, 2006-08-30 18:26

It is all right I will do inserting to hand the codes.
Thanks