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)
-   -   Site map page (https://forum.x-cart.com/showthread.php?t=12393)

fernando 02-24-2005 09:06 AM

Site map page
 
Hello,

Just a modification from html_sucks' displaying categories tree. This MOD allows for a "site map" type page.

You can check it out at: http://mascotasmexico.com/tienda/sitemap.php (please consider that this is a live shop!)

Hope you'll find it useful :) !

1. Create file "sitemap.php" on your xcart root directory

Code:

<?php

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

$smarty->assign("main","sitemap");
func_display("customer/home.tpl", $smarty);

?>


2. Create template skin1/customer/sitemap.tpl

Code:

{* $Id: sitemap.tpl,v 1.00 2005/02/24 09:53:29 max Exp $ *}
{capture name=sitemap}
<ul> {*** start unordered list***}
{section name=l1_cat_num loop=$allcategories} {*** loop ALL categories ***}
  {if $allcategories[l1_cat_num].parentid eq 0} {*** loop root categories/parentid 0 - level 1***}[*]{$allcategories[l1_cat_num].category}

      {if $allcategories[l1_cat_num].subcategory_count gt 0} {*** check if root cat has child cats ***}
        <ul>
            {section name=l2_cat_num loop=$allcategories} {*** loop through sub cats with matching parent id ***}
              {if $allcategories[l2_cat_num].parentid eq $allcategories[l1_cat_num].categoryid}[*]{$allcategories[l2_cat_num].category}

              {if $allcategories[l2_cat_num].subcategory_count gt 0} {*** check if parent has child cats***}
                  <ul>
                    {section name=l3_cat_num loop=$allcategories}
                        {if $allcategories[l3_cat_num].parentid eq $allcategories[l2_cat_num].categoryid}[*]{$allcategories[l3_cat_num].category}

                        {if $allcategories[l3_cat_num].subcategory_count gt 0} {*** check if parent has child cats***}
                          <ul>
                              {section name=l4_cat_num loop=$allcategories}
                                {if $allcategories[l4_cat_num].parentid eq $allcategories[l3_cat_num].categoryid}[*]{$allcategories[l4_cat_num].category}

                        {/if}{/section}[/list]
            {/if}{/if}{/section}[/list]
      {/if}{/if}{/section}[/list]
  {/if}{/if}{/section}[/list]{/capture}

{include file="dialog.tpl" title="Site map" content=$smarty.capture.sitemap extra="width=100%"}


3. Add the following lines near the bottom of skin1/customer/home_main.tpl

Code:

{* Lines added for sitemap *}
{elseif $main eq "sitemap"}
{include file="customer/sitemap.tpl"}
{* End of added lines *}

{else}
{include file="common_templates.tpl"}
{/if}


Finally, add a call to sitemap.php somewhere. For example: to add it at the bottom of the categories menu, alter skin1/customer/categories.tpl near the bottom:

Code:

<FONT class="CategoriesList">Site map</FONT>
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }


Enjoy! :-({|=

Jerrad 02-24-2005 09:19 AM

Awesome, exactly what I was looking for!
I'll give it a try tonight.

Thanks alot fernando! :D :D

Jerrad 02-24-2005 11:46 AM

It works great fernando!
Any ideas how to include other (help)menu links and maybe
also products?

And thanks again for sharing this mod. :D

fernando 02-24-2005 11:53 AM

Quote:

Originally Posted by Jerrad
It works great fernando!
Any ideas how to include other (help)menu links and maybe
also products?


I'm glad you liked it! Including products would be a bit harder, both on the php side (retrieving the products lists for each category) and the tpl (displaying it nicely). I guess this would make sense for a store with very few products, but not so much for a store with many products as the results would be pretty ugly (not to mention the download times!)

What kind of help menu are you referring to?

fernando 02-24-2005 12:28 PM

No offense taken, on the contrary :) I too think it's great to see that, even though XC is a commercial software, people take advantage of the fact that is an OpenSource product and share their improvements on this product.

Jerrad 02-24-2005 01:21 PM

Thisone also looks great!
And for that 'price' I'm going to give it a try, markwoo :wink:

markwhoo 02-24-2005 01:28 PM

Quote:

Originally Posted by Jerrad
Thisone also looks great!
And for that 'price' I'm going to give it a try, markwoo :wink:


Well, just to state again, I have seen multiple "For Sale" mods for the site maps and I am sure there are multiple features that make them great, but since Fernando has added this FREE mod Kudos to him for this.

The site link I sent to you is from a site I have stumbled accross and it appears that you can add custom links and that was what I needed to do as well.

I am going to try to add this to the cart this weekend and give it a shot.

I think the biggest plus was they were also giving it away for a little info and that to me was cheap enough.


Again, Kudos out to Fernando for his contribution!

gm@osbcorp.com 03-03-2005 11:57 AM

That looks great Fernando! Is it compatable with 3.5.x? I've been looking for a simple site map mod, and this looks like it may be it! :D

fernando 03-03-2005 12:03 PM

I'm not sure if it will work with 3.5 as is, it just might... Since I entered X-Cart at 4.0x, didn't have the chance to test it against previous versions.

Please feel free to try it with 3.5 (I would strongly suggest you try it on a test server, even though this mod doesn't really have impact on existing code nor data, but better be on the ultra-safe side :) ) and do let me know if it worked for you.

sstillwell@aerostich.com 03-03-2005 12:35 PM

markwhoo,

Hmmm, looks like the link to your sitemap is broken.

Anyway, I'm going to try Fernando's site map, looks good.

gm@osbcorp.com 03-03-2005 12:39 PM

After a little trial and error I got it to work with v3.5.11. I had to change the line:

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

to:

$smarty->display("customer/home.tpl");

in the sitemap.php file.

It works great! Thanks again for the great mod Fernando! :D

fernando 03-03-2005 12:46 PM

You're more than welcome :)

x-online 03-07-2005 05:38 PM

Nice work, much appreciated!!!

markwhoo 03-07-2005 06:22 PM

Quote:

Originally Posted by sstillwell@aerostich.com
markwhoo,

Hmmm, looks like the link to your sitemap is broken.

Anyway, I'm going to try Fernando's site map, looks good.


Sorry I missed this post.

What we found was in another thread rrf came in and posted the fact that he had approached these people about code theft or something like that. Apparently these people work out of the country and had stolen parts of the xcart code and resold it or something to that matter.

So, between xcart knocking on their door raising hell and rrf erasing the links on other threads, these people finally removed ant and all references to this mod and another that actualy was quite nice.

Their installers were unbelievably simple and easy to intigrate into xcart. and the mod was/is great.

I am sure fernandos mod is fantastic, I just needed the ability to add other types of links etc and this mod allowed me to do so.


Kudos to fernando and his work! Cause this is the only site map out there for free right now besides the file I have on my pc from the other guys 8O

rrf 03-15-2005 08:24 AM

All X-Cart related services & mods provided by Cart-Services are illegal. I have a letter of warranty from Cart-Services that they have stopped selling X-Cart mods and services related to X-Cart. If you have any information that they have not stopped working - please e-mail me at feedback@x-cart.com or make a note in the support help desk with "Attn: anti-piracy dept".

PS: They are also located in country which is restricted to export X-Cart to. So, obviously, if you order any services from them and give access to your software code, this results in license agreement breach and will result in license annuled.

I am locking this thread.

rrf 03-15-2005 09:02 PM

According to the request of Fernando, who is the original author of the SiteMap module discussed in the thread and is not in related to Cart-Services in any way, this thread is unlocked. Had to delete all references to Cart-Services, though.

sstillwell@aerostich.com 03-16-2005 04:47 AM

Fernando,

This is a great mod. I put it on my site http://www.aerostich.com/sitemap.php. Is there an easy way to make it two column instead of just one? I see from the code you are doing several nested loops (section). I wonder if it could be smart enough to make it roughly two columns but only split it on a root category.

fernando 03-16-2005 09:31 AM

Well, I tried doing that but I failed miserably. Maybe it was because I was just trying to accomplish it by using stylesheets, instead of letting smarty handle the layout. Call me lazy :lol:

I did add something that I think will improve the readability, and that's styling the elements of the map (especially the level 1 and level 2 categories) to get something like:

http://borcel.com/archivos/varios/sitemap.gif

Interested?

You would need to add the following right at the end of skin1/skin1.css

Code:

li.sitemap-l1 {
        margin-bottom: 15px;
        list-style-type: none;
}

a.sitemap-l1 {
        font-weight: bold;
        font-size: 115%;
        border-bottom: 1px gray solid;
        width: 500px;
}

li.sitemap-l2 {
        list-style-type: none;
}

a.sitemap-l2 {
        font-size: 115%;
}


You'll also need to do very minor modifications to sitemap.tpl.

Look for the first[*] tag (around line 6 of sitemap.tpl). Replace the whole line with:

Code:

<li class="sitemap-l1">{$allcategories[l1_cat_num].category}

Now look for the second[*] tag, should be around line 12, and replace the whole line with:

Code:

<li class="sitemap-l2">{$allcategories[l2_cat_num].category}

I was pretty happy with the results of just formatting the first two levels. If you wish, you can format as many levels as you want, just have to add the style definitions on skin1.css (sitemap-l3, sitemap-l4...) and then add the class to the[*] and the <a> tags.

Also, you can change the style definitions for sitemap-l1 and sitemap-l2 to better suit your needs. A nifty trick is to use "list-style-image: url(image.jpg);". It will use "image.jpg" as a bullet, instead of a circle, square, etc.

I know is not a 2-column layout, but I think it looks much better.

Jon 03-16-2005 09:42 AM

To do a 2 column layout, you could first, in PHP get a count of how many lines will be displayed. Divide that by 2 being sure to use ceil (so that if there's an uneven amount, the extra line is shown in the first column).

Assign that variable to smarty: $halfway

Then, prior to the section start a table:

Code:

<table><tr><td>

During your section, increase a variable to check against $halfway. When it gets there, start a new column.

Code:

{if $count eq $halfway}</td><tr><td>

Then after your section, of course close the table.

Code:

</td></tr></table>
[/code]

fernando 03-17-2005 12:49 PM

I just saw this on a post that somebody else wrote for another MOD. If you want to show your site map using the same ORDERING that you set for your categories, you need to edit the script includes/categories.php:

Find:

Code:

usort($all_categories, "func_categories_sort");

Now comment it out!

Code:

// usort($all_categories, "func_categories_sort");

That's all! (Thank you gabriela).

eaglemobiles 03-27-2005 08:53 AM

This is great mod thanks for sharing with us. Is it possible to add other part of the website like help, login, news, special.

Thanks

fuzzy 03-31-2005 12:01 PM

One extra tweak here for those folks that want (or require) the crumb trail to show.

in sitemap.php, change to
Code:

<?php

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

$smarty->assign("main","sitemap");
$smarty->assign("location", $location);
func_display("customer/home.tpl",$smarty);

?>


Other than that it works GREAT in 4.0.12 :D

Speedmaster 04-01-2005 03:25 PM

Hmm...

I tried implementing this in 3.5.10. All I get is a complete listing of all of my categories like this

<ul> [*]Root Category/Subcat 1/Sub-Subcat 2 [*]Root Category/Subcat 1/Sub-Subcat 4 [*]Root Category/Subcat 3/Sub-Subcat 5 [/list]
Anybody with 3.5.X know what's going on?

Thanks

CopperB 04-14-2005 04:19 PM

Just wondering if anyone knows of a way to be able to use/view the sitemap when using the html catalog?

If I access the website via the html catalog and click on the sitemap link I get the error The requested URL /xcart/catalog/sitemap.php was not found on this server

Thanks

fuzzy 04-14-2005 04:37 PM

you need to make the link like so:
/xcart/sitemap.php

Adding /xcart/ will cause the browser to backup to the root dir and then drill
down to the sitemap.php.

Just make the change in the php version, then re-generate the html catalog and
all will be good to go.

CopperB 04-14-2005 04:57 PM

Thanks for the reply Fuzzy but I don't quite understand as right now xcart is the root.

PHP Version
http://www.copperboppers.com/xcart/sitemap.php

HTML Catalog
http://www.copperboppers.com/xcart/catalog/sitemap.php
(this is where I get the error)

fuzzy 04-14-2005 05:32 PM

Quote:

Originally Posted by CopperB
Thanks for the reply Fuzzy but I don't quite understand as right now xcart is the root.

PHP Version
http://www.copperboppers.com/xcart/sitemap.php

HTML Catalog
http://www.copperboppers.com/xcart/catalog/sitemap.php
(this is where I get the error)


Your current link (viewing the source) shows as sitemap.php
change it to /xcart/sitemap.php

copy & paste /xcart/sitemap.php into your menu.tpl or whatever the .tpl
file is, save it and generate the html catalog again. Done, prob solved. ;-)

root? (My Bad!) When I said root, I ment your web site root ie: www.copperboppers.com, not the xcart root ie: www.copperboppers.com/xcart

heres an example of how browser sees links, while in the xcart/catalog dir.
sitemap.php is seen as http://www.copperboppers.com/xcart/catalog/sitemap.php
/xcart/sitemap.php is seen as http://www.copperboppers.com/xcart/sitemap.php

Hope that makes sence! hehehe!

longhorn180 04-27-2005 04:44 AM

Quote:

Hmm...

I tried implementing this in 3.5.10. All I get is a complete listing of all of my categories like this

<ul> [*]Root Category/Subcat 1/Sub-Subcat 2 [*]Root Category/Subcat 1/Sub-Subcat 4 [*]Root Category/Subcat 3/Sub-Subcat 5 [/list]
Anybody with 3.5.X know what's going on?

Thanks


I'm having the same problem Speedmaster is having. What are we doing wrong? Here is a url to the site I use to for testing purposes:http://www.thecrackedbook.com/shop/xcart/customer/sitemap.php

PremiumPonyParts 04-27-2005 11:40 AM

Make sure that when you link to it in your files, your pointing it to the root, not just calling it by sitemap.php so do xcartdir/sitemap.php

otherwise, when the catalog calls it, its gonna do xcartdir/catalog/sitemap.php

Also, your sitemap won't link to the HTML pages you've made. But the Advanced Site Map that you can buy does, and works great.

offline 05-09-2005 10:01 AM

How do I set the <title> of the page, it doesn't seem to have on.

Great mod by the way, works perfect. Thanks!

taltos1 06-01-2005 07:46 AM

Thanks a lot for this Mod. I also would like to have the site map show not only my product categories, but also my help area and static pages, (it was mentioned earlier on in this thread) but I did not see a solution? Can anyone help me out?

Thanks

offline 06-01-2005 09:38 AM

I just edited the sitemap code by hand myself to add relavent links.

Bling 06-16-2005 08:35 AM

GREAT CODE...took a few tries but I figured it out. You actually made it very easy and I was trying to make it harder :)

I would love to get my static pages on there...which template do you mod and what would a link look like in that mod...thanks!

Bling

MythNReality 06-16-2005 03:04 PM

Re: Site map page
 
Quote:

Originally Posted by fernando

3. Add the following lines near the bottom of skin1/customer/home_main.tpl

Code:

{* Lines added for sitemap *}
{elseif $main eq "sitemap"}
{include file="customer/sitemap.tpl"}
{* End of added lines *}

{else}
{include file="common_templates.tpl"}
{/if}





Hi Fermando,

Would you please help me on this? After this step, there's smarty error...not sure if I have put the right code at the right file...
I had to delete the whole thing...


Thanks,

Bling 06-16-2005 03:28 PM

I got a smarty error as well...Im not sure if its the same thing but the last {else}
{include file="common_templates.tpl"}
{/if}

is actually already part of the template and not what you actually what you put in the template. The only part you actually paste in is the top 4 lines...the bottom is just used as reference.

Hopefully it helps...that was the biggest part I messed up on...or maybe I am just way too newbie...heh




{* Lines added for sitemap *}
{elseif $main eq "sitemap"}
{include file="customer/sitemap.tpl"}
{* End of added lines *}

{else}
{include file="common_templates.tpl"}
{/if}

extreme 06-20-2005 07:51 PM

Anyone got this working for 3.5.x yet??? :-s

I have the same issue as speedmaster & longhorn180.... would love to get it working properly!

rcci@mindspring.com 08-02-2005 07:45 AM

re:sitemap
 
Quote:

Originally Posted by offline
I just edited the sitemap code by hand myself to add relavent links.


Did you edit the sitemap.php or something else? I was looking at the code, and wasn't sure where to add....

Vicky Rowe

btomasie 08-07-2005 01:19 PM

Hi all,
I have added the sitemap to my store but there is one alteration I would like to do, and am stumped on how to achieve what I need. This is where I am looking for assistance if someone would be so kind.

The alteration I need to make to fernando's code, is in this piece:

Code:

{if $allcategories[l2_cat_num].subcategory_count gt 0} {*** check if parent has child cats***}
<ul>
{section name=l3_cat_num loop=$allcategories}
{if $allcategories[l3_cat_num].parentid eq $allcategories[l2_cat_num].categoryid}[*]{$allcategories[l3_cat_num].category}


I only want this piece of code to work for certain subcategories, not all of them. What I need is for the sitemap to dive in and display this level ONLY for:
http://storename.../xcart/home.php?cat=983
http://storename.../xcart/home.php?cat=1014
http://storename.../xcart/home.php?cat=1075
http://storename.../xcart/home.php?cat=1091

I can't figure it out though. Can anyone help me out? It would be GREATLY appreciated. I did PM fernando, but unfortunately he is extremely busy with projects.

If anyone could help me with it, it would be greatly appreciated!!

Thanks,
Brian

balinor 08-08-2005 08:56 AM

Brian...copied your post here and deleted the other one for simplicity sake. Thanks!

btomasie 08-12-2005 04:25 AM

Anyone?? (2 posts up)

It would be greatly appreciated, thanks!
Brian


All times are GMT -8. The time now is 02:46 PM.

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