You are here:  » Multiple Featured Products Sections

Active Forum Topics


Multiple Featured Products Sections

Submitted by support on Tue, 2015-08-11 13:16 in

Hi everyone,

This is a popular request so I thought I would document through the forum a simple way to implement segregated groups of featured products on the home page instead of simply displaying the configured Featured Products in a single area.

I have already introduced the concept of sections within the shortcodes supported by PriceTapestry.org for WordPress / Joomla, and the technique is straight forward to implement within standalone Price Tapestry.

To designate different groups of featured products, simply prefix the product names with a suitable section name (e.g. a category name for example, or simply section1, section2 etc. followed by a forward slash to separate the section name from the product name, e.g.

section1/Product 1
section1/Product 2
section2/Product 3
section2/Product 4

With the required products configured, download and extract featuredSection.php and upload to the top level folder of your Price Tapestry installation.

Finally, remove all Featured Products related code from index.php and replace with multiple instances of the following code as required:

  $featuredSection["section"] = "section1";
  require("featuredSection.php");

The above instance, with Featured Products configured as above would display on Product 1 and Product 2. Of course your output would ordinarily involve titles etc., so within an HTML section anywhere within your site, you could use something like:

<h1>Featured Blue Widgets</h1>
<?php
  $featuredSection["section"] = "blue";
  require("featuredSection.php");
?>
<h1>Featured Red Widgets</h1>
<?php
  $featuredSection["section"] = "red";
  require("featuredSection.php");
?>

Each section of Featured Products will be displayed with your template's html/featured.php HTML module.

Hope this helps!
Cheers,
David
--
PriceTapestry.com

Submitted by ItsDavid on Sun, 2017-10-08 14:40

Hi David,

Could you explain this in more detail how to use it? I am not really understanding what exactly needs to be done such as what to remove and replace and where.

Best Regards
David

Submitted by support on Mon, 2017-10-09 08:36

Hi David,

You can leave all the existing Featured Products code in index.php in place - it will always show the default Featured Products - that is, anything configured in the Featured Products box in /admin/ > Content Management that does not have a section/ prefix.

The only reason entries in your Featured Products box won't be displayed by the default code is because the section/ prefix would make the name invalid - so you actually don't need to change anything.

But then if you wanted to create a second section of featured products on your home page for example under a heading e.g. for a video game comparison site under "New Releases", you could configure the required products in Product Mapping using an appropriate prefix e.g. new/ for example:

new/Game 1
new/Game 2
new/Game 3

With that in place, download featuredExternal.php and upload it to the top level folder of your Price Tapestry installation, and then continuing this example, add to index.php:

<h1>New Releases</h1>
<?php
  $featuredSection["section"] = "blue";
  require("featuredSection.php");
?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com