You are here:  » help with featured produts

Support Forum



help with featured produts

Submitted by enrique on Thu, 2009-02-26 12:55 in

Hi David!
I would like to modify featured products because I would like to show all info of the product (photo,name,description,price and deeplink) can you help me?

Submitted by support on Thu, 2009-02-26 13:04

Hello enrique,

Sure - as there will be more information, do you want them displayed in a list, like the search results?

Cheers,
David.

Submitted by enrique on Thu, 2009-02-26 13:21

No, i would like to use the products that I inside in the admin panel in featured
I inside only 1.

and this product i would like to show all not only the photo and the name,
i would like to show the product similar than /products.php?q=iCage for example

that i can see
the name the price, the photo, the coment this product, and the deeplink.

is possible to put this in the featured?

i've this code

$sql = "SELECT * FROM `".$config_databaseTablePrefix."featured` ORDER BY sequence";
database_querySelect($sql,$rows);
$blurb["products"] = $rows;

foreach($blurb["products"] as $k => $product)
{
if ($config_useRewrite)
{
$blurb["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";

$blurb["products"][$k]["reviewHREF"] = "review/".tapestry_hyphenate($product["name"]).".html";
}
else
{
$blurb["products"][$k]["productHREF"] = "products.php?q=".urlencode($product["name"]);

$blurb["products"][$k]["reviewHREF"] = "reviews.php?q=".urlencode($product["name"]);

}
}

foreach($blurb["products"] as $product):

print "" . $product["name"] . "";

endforeach;

but this code only shows the name, not the name,photo,description and deeplink,
when i try to put some "experiments..." i broke all.

can you help me?

Submitted by support on Thu, 2009-02-26 13:21

Hi,

Sure - you can make it look the same. Please try this code to replace html/featured.php:

<div class='searchresults'>
  <table width='100%'>
    <?php foreach($featured["products"] as $product): ?>
      <tr>
        <td>
          <?php if ($product["image_url"]): ?>
          <img border='0' width='80' src='<?php print $product["image_url"]; ?>' alt='<?php print $product["name"]; ?>' />
          <?php endif; ?>
        </td>
        <td width='50'>&nbsp;</td>
        <td valign='middle'>
          <h4><a href='<?php print tapestry_buyURL($product); ?>'><?php print $product["name"]; ?></a></h4>
          <p><?php print $product["description"]; ?></p>
          <p>
          <span class='nobr'>
          <strong><?php print $config_currencyHTML.$product["price"]; ?></strong>
          from
          <a href='<?php print tapestry_buyURL($product); ?>'><?php print $product["merchant"]; ?></a>
          </p>
          </span>
        </td>
      </tr>
    <?php endforeach; ?>
  </table>
</div>

Cheers,
David.

Submitted by enrique on Thu, 2009-02-26 14:22

Hi!!!
i try your code and works but not than i like it.
I have a class called blurb.php

<?php
// THIS PAGE IS DISPLAYED ON THE HOME PAGE AT THE TOP. IT'S THE BIT WITH THE PICTURE.
// IF YOU WANT TO ADD SOME TEXT ABOUT YOUR WEBSITE AT THE BOTTOM OF THE HOME PAGE,
// EDIT featuredblurb.php.
$sql = "SELECT * FROM `".$config_databaseTablePrefix."featured` ORDER BY sequence";
database_querySelect($sql,$rows);
$blurb["products"] = $rows;
    foreach($blurb["products"] as $k => $product)
    {
      if ($config_useRewrite)
      {
        $blurb["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";
        $blurb["products"][$k]["reviewHREF"] = "review/".tapestry_hyphenate($product["name"]).".html";
      }
      else
      {
        $blurb["products"][$k]["productHREF"] = "products.php?q=".urlencode($product["name"]);
        $blurb["products"][$k]["reviewHREF"] = "reviews.php?q=".urlencode($product["name"]);
      }
    }
    foreach($blurb["products"] as $product):
        print "<p><a href='". $product["productHREF"] ."' title='" . $product["name"] . "'>" . $product["name"] . "</a></p>";
    endforeach;

this is the code of blurb.php

if i put here your code appears all featured, why? because i modify the featured.php to have a randomize.

with this class i can control the admin featured and i can put an object (for example a laptop)
an appears but only the name
i try to change this but doesn't works

<div class='searchresults'>
  <table width='100%'>
    <?php foreach($blurb["products"] as $product): ?>
      <tr>
        <td>
          <?php if ($product["image_url"]): ?>
          <img border='0' width='80' src='<?php print $product["image_url"]; ?>' alt='<?php print $product["name"]; ?>' />
          <?php endif; ?>
        </td>
        <td width='50'>&nbsp;</td>
        <td valign='middle'>
          <h4><a href='<?php print tapestry_buyURL($product); ?>'><?php print $product["name"]; ?></a></h4>
          <p><?php print $product["description"]; ?></p>
          <p>
          <span class='nobr'>
          <strong><?php print $config_currencyHTML.$product["price"]; ?></strong>
          from
          <a href='<?php print tapestry_buyURL($product); ?>'><?php print $product["merchant"]; ?></a>
          </p>
          </span>
        </td>
      </tr>
    <?php endforeach; ?>
  </table>
</div>

Submitted by support on Thu, 2009-02-26 14:33

Hello enriqe,

Can you email me your blurb.php with the code added, I can see what needs to be changed so I will put it in for you...

Cheers,
David.