Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

How to Show All Categories on Home Page?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-24-2003, 07:45 PM
 
unioman unioman is offline
 

Member
  
Join Date: Nov 2002
Location: VA, United States
Posts: 25
 

Default How to Show All Categories on Home Page?

My client has a very small store (11 items currently) with 4 main categories. He would like to show all items in their respective categories on the home page - not just having links to the categories on the left menu.

I could do this by adding them all to the Featured Products list, but that defeats the purpose of featured products and it doesn't display their associated categories.

What I would like to do is find some way to display the orange dialog box (that typically surrounds the products in a category) for each category and listing their products inside.

Example:

Orange Box with Category#1 as title
Contents displays 3 items

Orange Box with Category#2 as title
Contents displays 2 items

Orange Box with Category#3 as title
Contents displays 3 items

You get the picture.

Has anyone been able to do anything like this? Any help would be appreciated!
Reply With Quote
  #2  
Old 03-24-2003, 10:32 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Okay, here goes...

First create a new php script called cat1.php

Code:
<?php // Gets product data for category and stores it into $prodcat1 array $catshow = 1; // set this to the categoryid of the category to show $search_query = "($sql_tbl[products].categoryid='$catshow' or $sql_tbl[products].categoryid1='$catshow' or $sql_tbl[products].categoryid2='$catshow' or $sql_tbl[products].categoryid3='$cat'show) and $sql_tbl[products].forsale='Y'"; $products= func_search_products($search_query, $user_account['membership']); if (count($products) ==0) $products=""; // need to change this for each category script $smarty->assign("prodcat1",$products); ?>

Then copy this and amend the last assign statement for each category so create a copy called cat2.php and change the last bit to prodcat2 etc...

Then add the following into home.php for each of the scripts/categories.

Code:
require "./cat1.php";

Then in home_main.tpl replace:

Code:
{elseif $main eq "catalog" and $current_category.category eq ""} {include file="customer/main/welcome.tpl" f_products=$f_products}

with

Code:
{elseif $main eq "catalog" and $current_category.category eq ""} {include file="customer/main/welcome.tpl" prodcat1=prodcat1 prodcat2=prodcat2}

keep adding the prodcat's until all your categories are included.

Then in welcome.tpl replace:

Code:
{include file="customer/main/featured.tpl" f_products=$f_products}
with:
Code:
{include file="customer/main/products.tpl" products=$prodcat1}
Keep repeating this include statement for each category.

This should do it but will probably require some tweaking.
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 03-25-2003, 06:38 AM
 
unioman unioman is offline
 

Member
  
Join Date: Nov 2002
Location: VA, United States
Posts: 25
 

Default Thanks...

Thanks, that looks like it should help
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:37 AM.

   

 
X-Cart forums © 2001-2020