Random Products - 2 Products Per Row - In Place of Featured
I was wondering if anybody had ever replaced the featured products on the home page with a random list of 6-8 products, two per row? My thinking is it would make the site look less static. Anyone know how to achieve this?
|
I don't have a solution, but you're right. Random products would be a great feature. :)
|
The code must be in there already as it uses it for the recommended products.
|
I'm not a programmer by any means, or I'd be happy to dig in and find it. I was just hoping somebody had already done this, or would find it an interesting challenge and share the code with all of us. :)
|
Code:
$f_products = func_query("select $sql_tbl[products].*, min($sql_tbl[pricing].price) as price from $sql_tbl[products], $sql_tbl[featured_products], $sql_tbl[pricing], $sql_tbl[categories] where $sql_tbl[products].productid=$sql_tbl[featured_products].productid and $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[products].categoryid=$sql_tbl[categories].categoryid AND ($sql_tbl[categories].membership='$membership' OR $sql_tbl[categories].membership='') and $sql_tbl[products].forsale='Y' and $sql_tbl[products].avail>0 and $sql_tbl[featured_products].avail='Y' and $sql_tbl[pricing].quantity=1 AND $sql_tbl[featured_products].categoryid='$f_cat' and ($sql_tbl[pricing].membership='$membership' or $sql_tbl[pricing].membership='') group by $sql_tbl[products].productid order by $sql_tbl[featured_products].product_order"); Whew what a SQL query :? http://www.php.net/manual/en/printwn/function.rand.php Little mix of rand(); and some modified or added SQL queries and its possible. :wink: |
Boomer,
Wow! Now I see why I'm not a programmer. :) Is your code snippit what we need to accomplish this, and if so, where would we paste this in at?? |
this is the current sql not the new stuff. the new stuff will be more complex than this. :wink:
need to add this into customer/home.php Code:
include "./random.php"; This will bring in a list of random products. Then we need to create this random.php in customer/ and is based on reccomends.php Code:
<? You will then need to include this in the home page by modifying the appropriate templates. |
funkydunk,
Thanks a million for the code. I made the change to my customer/home.php and created the customer/random.php, but nothing changed. I still have the same 'Featured Products' showing up as they always have. I see where you said to 'include this in the home page by modifying the appropriate templates'. Would you please explain this in more detail (i.e. which templates and what exactly to add), as not only am I not a programmer, I am VERY new to X-Cart as well. :) Looking forward to hearing from you. |
PLEASE BACKUP ALL FILES BEFOREHAND JUST IN CASE!!
I haven't tested this but I would change skin1/customer/home_main.tpl as follows: from: {elseif $main eq "catalog" and $current_category.category eq ""} {include file="customer/main/welcome.tpl" f_products=$f_products} to: Code:
{elseif $main eq "catalog" and $current_category.category eq ""} Then amend customer/main/welcome.tpl to: Code:
{* $Id: welcome.tpl,v 1.21 2002/09/10 12:36:34 zorg Exp $ *} then creat a new template customer/main/randoms.tpl Code:
{* $Id: randoms.tpl,v 1.13 2002/05/20 06:55:20 lucky Exp $ *} then creat a new lbl in the languages area named lbl_random_products with the value that y9ou want to have shown in the top of the box. |
funkydunk,
Wow, you're good....you're FUNKY good! :wink: The only problem is that my random products have "Enter your price !" instead of "Our price: $". This kind of needs addressed as we don't want the customer thinking they can pick their own price. :) Any ideas on what the last tweak to the puzzle might be? |
All times are GMT -8. The time now is 07:28 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.