Separate Category Tree and Product Listing Areas

Top  Previous  Next

 

The category tree and product listing area of the catalog may be inserted into PHP pages as separate components. An unlimited number of unique catalog pages with different file names may be created using this method.

 

Custom Catalog Page Layout

The category tree and product listing areas can be placed separately within each web page.

 

The product listing area can be included separately...

clip10038

...and the category tree can be included separately.

clip10039

 

 

PHP tags are used to include the product listing and/or category tree as separate components within local web pages. The includes will work in files ending with .php extension.

 

Include the Product Listings

 

Include the following PHP code in the source code for the body of the page where the product listings are to appear. Change the parameters as instructed.

 

<?php

$search = "find.html"; $categories = "off"; $catalog = "shop.html"; include "catalogue.php";

?>

 

The include catalogue.php"; parameter must point to the catalogue.php script, which is in the directory where AShop V is installed. If this new page is in the same directory as catalogue.php, set it as shown above. If catalogue.php is in a different directory, set the path accordingly. For example, "../catalogue.php" (to go up one directory) or "store/catalogue.php" (to go down to a specific directory).

 

Set the $catalog parameter to the same page (where this PHP include is located) or to a different page where catalogue.php is also included with this method.

 

Show or Hide Category Tree (Within Product Listing Area)

 

$categories = "on"; With categories set to on, the category tree appears within the product listing area, to the left of the product listings.

 

$categories = "off"; With categories set to off, the category tree does not appear within the product listing area. It may still be included separately in a different location within the page. see Include Category Tree below.

 

Search Box Options

 

$search = "off"; The search box does not appear in the page.

Example:

<?php

$search = "off"; $categories = "off"; $catalog = "shop.html"; include "catalogue.php";

?>

 

$search = "find.html"; The search box is activated and it appears above the product listings. Use this same include method to create a second page where the search results will appear. The search results page can be a copy of the catalog page with a different file name or it may be a different design, but it must exist and it must have this catalogue.php include in the page. In the example file that is included with the AShop V new installation file package, find.html is simply a copy of the shop.html page and the file name has been changed.

 

$search = "shop.html"; The search box is activated and it appears above the product listings. In this case, the search results page is same as the catalog= page so that the search results will appear in the same page. (Change the filename to match the actual file in your site.)

IMPORTANT! For search results to appear in the same catalog page, an if statement must be added in the php code.

 

<?php

$search="shop.html"; $categories = "off"; $catalog = "shop.html"; if (!$searchstring) include "catalogue.php"; else include "search.php";

?>

 

Include the Category Tree

 

Include Category Tree In Catalog Page

Include the category tree in the same page where catalogue.php is included by inserting this PHP tag into the page.

 

<?php

include "includes/categories.inc.php";

?>

 

Include Category Tree In Site Navigation

The category tree may be included in site navigation by adding a catalogue.php="shop.html" parameter. This parameter points to the page where the product listings are to appear. For example, when the category tree is in a page that does not have any way to show products and a category is selected, the product listings for that category need a place to appear in a page. In these examples the product listing page is shop.html. Change this to match the actual product listing page(s) in your site.

 

Insert the following php statement to include the category tree in a page where the catalogue.php include is NOT present in the same page. IMPORTANT! The $catalog variable must precede the categories.inc.php include in this php statement.

 

<?php $catalog = "shop.html"; include "includes/categories.inc.php"; ?>

 

This example will make all links in the category list open in the shop.html page. Change the $catalog= variable to match the actual page in the site. The page that the catalog= variable points to must either be catalogue.php or it must have the catalogue.php include in the page so that the product listings (for the selected category) will appear in the body of the page.

 

To include the category tree in a subdirectory below the directory where AShop is installed, add a chdir(""); parameter.

 

Example 1: Category include is in a page one directory below the AShop root.

 

<?php

chdir("../"); $catalog = "../shop.html"; include "../includes/categories.inc.php";

?>

 

Example 2: Category include is in a page above the "ashop" directory.

 

<?php

chdir("ashop"); $catalog = "ashop/shop.html"; include "ashop/includes/categories.inc.php";

?>

 

Web Sites That Use Frames

 

The separate category tree and product listing includes can be used in frames, but the Continue Shopping button and the Check out and View cart pages will NOT work when located in a different frame. Frames are not supported by our technical service.