X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Top Ten List - a favorites or "fake" bestsellers list - everywhere! (https://forum.x-cart.com/showthread.php?t=24671)

carpeperdiem 09-06-2006 04:31 AM

Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
Here is a mod that was developed with the help of many forum members. The goal was a side menu box that contained the products of a single category, ranked in the orderby POS established for the category. This menu box appears throughout the store. It is NOT tied to featured poducts or bestsellers (these modules can be disabled if you like).

I can certify this works with 4.1.3 and 4.0.18; there is no reason it won't work with other versions...

1. Define a category, assign products to it. I called mine, "Top Ten List". I added 10 products (duh!).

2. make a file in the xcart_root directory, name it "toptenlist.php"
Code:

<?
$query = "SELECT $sql_tbl[products].productid, $sql_tbl[products].product FROM $sql_tbl[products],$sql_tbl[products_categories] WHERE $sql_tbl[products].forsale='Y' AND $sql_tbl[products].avail > 0 AND $sql_tbl[products].productid = $sql_tbl[products_categories].productid AND $sql_tbl[products_categories].categoryid = 10 ORDER BY $sql_tbl[products_categories].orderby ASC LIMIT 10" ;

$toptenlist = func_query($query);

$smarty->assign("toptenlist",$toptenlist);
?>
// Note: categoryid = 10 is the id for the category you want to query
// change this to the categoryid you are using

3. Open xcart_root/home.php

FIND:
Code:

if ($active_modules["Bestsellers"])
include $xcart_dir."/modules/Bestsellers/bestsellers.php";


ADD:
Code:

include "./toptenlist.php";
4. Create a file called skin1/customer/main/toptenlist.tpl with the following:

Code:

{* $Id: toptenlist.tpl,v 1.00.0.1 2006/09/06 18:08:01 *}

<div id="categories">
{capture name=menu}
{section name=num loop=$toptenlist}
<A href="product.php?productid={$toptenlist[num].productid}&cat=10" class=VertMenuItems><B>{math equation="value+1" value=$smarty.section.num.index}.</B> {$toptenlist[num].product}</A><br />
{/section}
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title="Top Ten List" menu_content=$smarty.capture.menu }
</div>

{* Again note the cat=10 in this file *}
{* Change menu_title="Top Ten List" to the desired menu title *}

5. in xcart_root/include/categories.php

Find:
Code:

$smarty->assign("cat", $cat);
Add the following underneath:
Code:

require $xcart_dir."/toptenlist.php";
6. in skin1/customer/home.tpl add this wherever you want the menu to display. For example, if you want it on the right menu, under the authentication box, you would put it here:

After these lines
Code:

{if $login eq "" }
{include file="auth.tpl" }
{else}
{include file="authbox.tpl" }
{/if}

...insert
Code:

{if $toptenlist}
<br />
{include file="customer/main/toptenlist.tpl" }
{/if}


DONE!

Thanks to the many forum members who contributed to this.

Jeremy

summitmn 11-21-2006 01:07 PM

Re: Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
Is there a way to organize this list by "best selling" rather than alaphabetical?

carpeperdiem 11-21-2006 01:12 PM

Re: Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
Whatever order your "POS" is in your category list.

/admin/category_products.php?cat=XXX

It's a fake bestsellers list -- so it's just like any category.

rayjohnson 05-03-2009 05:57 PM

Re: Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
I know this an old thread...but I liked the idea of making your own Top Ten List...

I followed the instructions here and I got it working...I show the Product Title and Thumbnail...but I cannot get the Our Price included like on the original bestseller.tpl

Here is my toptenlist.tpl
Quote:

{* $Id: toptenlist.tpl,v 1.00.0.1 2006/09/06 18:08:01 *}

<div id="categories">
{capture name=bestsellers}
{section name=num loop=$toptenlist}
<A href="product.php?productid={$toptenlist[num].productid}&cat=12" class=VertMenuItems><B>{math equation="value+1" value=$smarty.section.num.index}.</B> {$toptenlist[num].product}</A><br />
<TR>
<TD width="40">
{include file="product_thumbnail.tpl" productid=$toptenlist[num].productid image_x=50 product=toptenlist[num].product}
</TD>
{/section}
{/capture}
{include file="customer/menu_dialog.tpl" title="Top Ten List" content=$smarty.capture.bestsellers }
</div>

{* Again note the cat=10 in this file *}
{* Change menu_title="Top Ten List" to the desired menu title *}

carpeperdiem 05-03-2009 06:02 PM

Re: Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
yikes! this thread was created for version 4.0.x -- so html was not xhtml compliant. GET RID of the UPPERCASE html tags. For 4.2.x do not use the tables. I pulled this code from my store years ago... decided that there was too much clutter and a side box was not the place for this. Sorry I can't be of more help.

rayjohnson 05-03-2009 07:30 PM

Re: Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
Thanks for the reply...I guess I'll go back to the bestseller.....shucks...

Ray

Rob Barclay 02-09-2010 02:07 AM

Re: Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
just used principles of this on 4.3.1 without a problem, apart from having problems getting the ratings in it

vasilis 11-03-2011 02:35 AM

Re: Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
did you also get the 'Our Price' section correct? I am interested in implementing this in 4.4.x and I wonder what modifications to the mod code should be done.

JWait 11-03-2011 07:32 AM

Re: Top Ten List - a favorites or "fake" bestsellers list - everywhere!
 
Quote:

Originally Posted by carpeperdiem
yikes! this thread was created for version 4.0.x -- so html was not xhtml compliant. GET RID of the UPPERCASE html tags. For 4.2.x do not use the tables. I pulled this code from my store years ago... decided that there was too much clutter and a side box was not the place for this. Sorry I can't be of more help.


Just more proof that once something is on the internet it will be there forever. :lol:


All times are GMT -8. The time now is 06:29 AM.

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