For those asking for the mod to look integrated with x-cart look and feel, and sorted output, you can use the following code:
Replace SEO_listing.php with:
Code:
<?php
require "./auth.php";
require $xcart_dir."/include/categories.php";
$qry = "SELECT * FROM " . $sql_tbl["products"] . " where forsale='Y' order by product";
$result = db_query($qry);
$products = array();
while ($result_row = db_fetch_array($result)) {
$products[] = $result_row;
}
$smarty->assign("main","SEO_listing");
$smarty->assign("products",$products);
func_display("customer/home.tpl", $smarty);
?>
Open skin1/customer/home_main.tpl. Go to the very end and look for:
Code:
{else}
{include file="common_templates.tpl"}
{/if}
Before that, add:
Code:
{elseif $main eq "SEO_listing"}
{include file="SEO_listing.tpl"}
Lastly, replace skin1/SEO_listing.tpl with:
Code:
{* Smarty Template by Fernando Borcel. MascotasMexico.com 2004/10/31 *}
{capture name="productslist"}
Enter the store
{foreach from=$products item=v key=k}
{$products[$k].product}
{$products[$k].descr}</p>
{/foreach}
Enter the store
{/capture}
{include file="dialog.tpl" title="Products" content=$smarty.capture.productslist extra="width=100%"}
.htaccess should include the code: (remember to change /xcarthome with the web directory that
your store is at, e.g. /xcart.
Options -Indexes
Code:
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^(.*)-pid-([0-9]+)\.html$ /xcarthome/product.php?productid=$2 [L]
RewriteRule ^(.*)list.html$ /xcarthome/SEO_listing.php [L]
To invoke the script, call
http://your.store.com/xcarthome/list.html
I didn't get around printing the categories too. Maybe I'll hack my own
site map mod to handle some mod rewrite in the same manner as this products listing.