home.php
Previous Topic  Next Topic 

Home.php resides in the same folder as store.php, which is usually your web root. It's contents are displayed in the main content section of your storefront, only when someone has visited your storefront without clicking any links. For example, if your storefront URL is http://www.YourSite.com/store.php, and your customer goes to that URL, the contents of home.php will appear within store.php, right in the middle of the page. If the customer then clicks any link on the page, the contents of home.php will not be displayed. This page is a good place to include content that you only want to appear on entry to your store, such as a welcome message.

 

Customizing

 

Customizing the home.php file requires that you have working knowledge of HTML. We will go through each line of PHP code in the home.php file below, and explain exactly what it does. In the examples below, the HTML is depicted in gray, and the PHP code is depicted in green. The explanations are in red, and apply to the PHP code displayed in green directly below. We will not discuss the HTML tags. If you are unfamiliar with them, we suggest you purchase a good reference book on HTML.

 

Overview of PHP code in home.php file

 

<table width="100%">
   <tr>
      <td class="content">

 

The PHP code section below displays your best selling item. This is explained in the "Managing Your Store : Products : Best Sellers" topic in this documentation.

         <?
            // Best Seller (Single Item) section
            // code below will display your top selling item
            show_best_sellers(1, $SESSION['templates']['best_seller_single']);
         ?>

 
      </td>
   </tr>
</table>
<table width="100%">
   <tr>
      <td class="content">

 

The PHP code section below displays a subset of your newest items. The number of items displayed in this section is controlled in your store settings by the field "New Products per Preview". 

         <?
            // New Product Preview section
            // code below will display a preview of new products in your catalog
            new_product_preview();
          ?>

 
      </td>
   </tr>
</table>
<table width="100%">
   <tr>
      <td class="content">

 

The PHP code section below will display your categories, with their descriptions. 

         <?
            // Category Detail section
            // code below will show all categories in cart for browsing
            show_categories_detail();
         ?>

 
      </td>
   </tr>
</table>
 

Removing PHP Code

 

You can cause a section of code to no longer display by adding a PHP remark // in front of every line between the PHP tags <? ?>. For example, if you did not want the new product preview section to appear, you could hide it by changing the code to look like this:

 

         <?
            // New Product Preview section
            // code below will display a preview of new products in your catalog
            // new_product_preview();
          ?>

 

Moving PHP code

 

If you like, you can move the PHP code sections around within this page to suit your design needs. They will work fine provided you do not alter any of the PHP code, between the <? ?> tags.