X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   How to Show All Categories on Home Page? (https://forum.x-cart.com/showthread.php?t=1996)

unioman 03-24-2003 07:45 PM

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!

funkydunk 03-24-2003 10:32 PM

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. :D

unioman 03-25-2003 06:38 AM

Thanks...
 
Thanks, that looks like it should help :-)


All times are GMT -8. The time now is 09:41 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.