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)
-   -   Completed simple site map mod (https://forum.x-cart.com/showthread.php?t=44064)

MACWIllo 12-04-2008 03:39 PM

Completed simple site map mod
 
Hi guys,

I spent a while browsing the forums to find a simple site map mod that anyone was giving away, in the end i just decided to build one myself. You can check it out here at http://mooo.com.au/sitemap.php

All it does is grab the active content of your speed bar, and all your active categories and products within them and display them as a list.

Code is below, I've also got CDSEO Pro installed so if you don't have that you'll need to omit those references (and also think about getting it cause its a musthave mod).

Create new file called sitemap.php:
Code:

<?php
/*****************************************************************************\

Mod by Pete Hare, Jairus P/L December 4 2008

\*****************************************************************************/


define('OFFERS_DONT_SHOW_NEW',1);
// WCM - CDSEO Pro Links
require "./auth.php";
include $xcart_dir."/modules/cdseolinks/cdseo_redirects.php";
// / WCM - CDSEO Pro Links

require $xcart_dir."/include/categories.php";

$categories_sm = $categories;

foreach ($categories_sm as $k => $c){

    #
    # Get products data for current category and store it into $products array
    #

    $old_search_data = $search_data["products"];
    $old_mode = $mode;

    $search_data["products"] = array();
    $search_data["products"]["categoryid"] = $c[categoryid];
    $search_data["products"]["search_in_subcategories"] = "";
    $search_data["products"]["category_main"] = "Y";
    $search_data["products"]["category_extra"] = "Y";
    $search_data["products"]["forsale"] = "Y";
    if(!isset($sort))
        $sort = $config["Appearance"]["products_order"];
    if(!isset($sort_direction))
        $sort_direction = 0;
   
    $mode = "search";
   
    include $xcart_dir."/include/search.php";
   
    $search_data["products"] = $old_search_data;
    $mode = $old_mode;

    $categories_sm[$c[categoryid]][products] = $products;

}

#
# Assign Smarty variables and show template
#

$smarty->assign("main","sitemap");
$smarty->assign("categories_sm",$categories_sm);

# Assign the current location line
$location = array();
$location[] = array("Home", "home.php");
$location[] = array("Site Map", "sitemap.php");
$smarty->assign("location", $location);


func_display("customer/home.tpl",$smarty);
?>


Create new file in skin1/modules/sitemap/sitemap.tpl:
Code:

<table cellpadding="0" cellpadding="0" width="100%">
<tr>
<td style="padding-top: 0px; padding-left: 10px; padding-right: 10px;"><p align="center" class="style2"><font class="CategoriesTitle">Sitemap</font></p>


{section name=sb loop=$speed_bar}
{if $speed_bar[sb].active eq "Y"}
<p><a onclick="{$speed_bar[sb].link}">{$speed_bar[sb].title}</a></p>
{/if}
{/section}


{foreach from=$categories_sm item=c key=catid name=fancycat}

  <p><a href="home.php?cat={$catid}">{$c.category|escape}</a></p>
{foreach from=$c.products item=p key=productid name=products}
<ul>
    <li><a href="product.php?productid={$p.productid}&amp;cat={$catid}&amp;page={$navigation_page}">{$p.product}</a></li>
</ul>
{/foreach}

{/foreach}

</tr>
</table>


In skin1/customer/home_main.tpl add into the if satements:
Code:

{elseif $main eq "sitemap"}
{include file="modules/sitemap/sitemap.tpl"}


The mods working fine for me, I have not tested it on any other versions of x-cart (this is 4.1.8)

Pete

stevep 07-18-2010 01:01 AM

Re: Completed simple site map mod
 
nice one works for me


All times are GMT -8. The time now is 09:53 AM.

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