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)
-   -   Free Sitemap addon, works with XC SEO (https://forum.x-cart.com/showthread.php?t=35373)

intel352 11-12-2007 04:59 PM

Free Sitemap addon, works with XC SEO
 
1 Attachment(s)
I've created a Sitemap addon that is free to use. This is not for generating XML sitemaps, just a visual sitemap for visitors (and search engines might find it useful, but no guarantee).

If you'd like to see the addon in use, you can view it in action here:

http://www.capefearstyles.com/sitemap.php << Sitemap using XC SEO

http://www.papertrails.com/store/sitemap.php << Modified version of sitemap using DSEFU (note: large number of categories/products, normally loads fine, but with DSEFU enabled loads noticeably slower, which is why DSEFU is not supported in the public release)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
For SEO:
This sitemap is great for site users, but for SEO purposes, it's recommended to only have 100 links per page or less, as Google recommends: http://www.google.com/support/webmasters/bin/answer.py?answer=35769

Currently the sitemap doesn't provide settings for picking & choosing what you want to display, but it's simple enough to edit the php or template code to reduce what is displayed.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Zip is attached below :-)

Just a note, this has been tested on 4.1, will likely work on 4.0, no clue about 3.x

!!! UPDATE !!! Jan 17, 2007

I have renamed the variables in use by the mod, so that there are no longer any conflicts with normal category variables (meaning, your categories no longer reorder randomly).
Other minor changes.
Version incremented to v1.3

94 downloads prior to updating the archive.

New zip file is attached.

Zaja 11-13-2007 02:10 AM

Re: Free Sitemap addon, works with XC SEO
 
Wow :D .... thank you Jon.

cflsystems 11-13-2007 04:24 AM

Re: Free Sitemap addon, works with XC SEO
 
Joh nice mod. Looks good too. By the way for some reason (maybe something I've changed before in other files) I had to put the 2 tpl files in skin1/customer and change the path in them to point to skin1/customer. Also when I first tried it I got a php error - "Invalid argument supplied for foreach()" for $pages. I do not have static pages defined on my site and the query for $pages returns empty string. This is a bug in php - look here http://pear.php.net/bugs/bug.php?id=1983 and here http://pear.php.net/bugs/bug.php?id=5216. I guess I'm missing some bug fixes but what I did to go around it is I changed the following code in sitemap.php and works fine.

this code
PHP Code:

if (!empty($active_modules["XC_SEO"])){
foreach(
$pages AS $k=>$page) {
$pages[$k]['seo_url'] = $seo->_pages_callback(array("pages.php?pageid=".$page['pageid'],false,'','pageid='.$page['pageid'],'',''), true$page['title']);
}



with this code
PHP Code:

if (!empty($pages)){
if (!empty(
$active_modules["XC_SEO"])){
foreach(
$pages AS $k=>$page) {
$pages[$k]['seo_url'] = $seo->_pages_callback(array("pages.php?pageid=".$page['pageid'],false,'','pageid='.$page['pageid'],'',''), true$page['title']);
}
}



Just thought maybe someone else had the same as me and this might help them. Thanks Jon.

intel352 11-13-2007 05:04 AM

Re: Free Sitemap addon, works with XC SEO
 
That's quite interesting you had to put the files in the skin1/customer folder, I've not seen that issue yet ;-)

Thanks for the catch on the empty pages var, I just added the XC SEO bit last night, I'll make that correction. Cheers :-)

UPDATE:
I updated the zip with changes that should correct similar errors for others, it's been updated in the first post
This isn't a major or required update, so the 8 people that downloaded this already, you'll likely be fine :-)

POSDepot 11-13-2007 07:34 AM

Re: Free Sitemap addon, works with XC SEO
 
Very interested in this but I am getting an error.

Page shows up with title and surrounding template but with this text in it:

"Page not found!
The requested page does not exist or you are not allowed to access it!"

I followed the directions but maybe I am missing something.

Using EWDhosting

Thanks

intel352 11-13-2007 07:46 AM

Re: Free Sitemap addon, works with XC SEO
 
I apologize everyone, I missed an edit required in skin1/customer/home_main.tpl (this is a mod that has evolved over a few weeks, so I forgot about an initial edit)

Open skin1/customer/home_main.tpl:

Find:
Code:

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


Add before:
Code:

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


POSDepot 11-13-2007 07:48 AM

Re: Free Sitemap addon, works with XC SEO
 
Perfect now .... thanks so much!!

cflsystems 11-13-2007 07:54 AM

Re: Free Sitemap addon, works with XC SEO
 
Now it makes sense why it didn't work for me when I put the files in root :-) I missed that one too. Thanks Jon great job

Dongan 11-13-2007 08:32 AM

Re: Free Sitemap addon, works with XC SEO
 
Nice mod.

Acquamarina 11-13-2007 08:40 AM

Re: Free Sitemap addon, works with XC SEO
 
Hi,
Does it work with DSEFU from SafetyNetWeb?

Thanks!

intel352 11-13-2007 09:27 AM

Re: Free Sitemap addon, works with XC SEO
 
hi acqua, the mod will generate normal php urls (if XC SEO isn't detected) which should work fine with DSEFU, as DSEFU will the rewrite the urls

for slightly better performance, if you have a large number of urls, it's best to have the mod coded to specifically support DSEFU. I have already modified it for DSEFU, but i'm not happy with the code, so I'm implementing DSEFU support in a future release (same for CDSEO)

Jon 11-13-2007 10:08 AM

Re: Free Sitemap addon, works with XC SEO
 
Quote:

Originally Posted by intel352
If you would like an XML Sitemap generator, I suggest signing up for WebsiteCM's eZine, as I know for a fact that WebsiteCM is working on an XML generator specifically for X-Cart :-)


We've had a lot of requests for an XML sitemap generator for google sitemap creation so we have one in the works.

It will allow you to specify score and optionally generate home/products/categories/manufacturers/static pages, and support default php links, cdseo, xc seo, dsefu and html catalogs (multi-language).

Jon

ProMuscles 11-13-2007 06:24 PM

Re: Free Sitemap addon, works with XC SEO
 
Thanks for your hard work. Were can we donate!

intel352 11-13-2007 07:07 PM

Re: Free Sitemap addon, works with XC SEO
 
haha, if you really want to donate anything, feel free to email me :-) ;-)

and I'm glad you like the mod, cheers

cflsystems 11-16-2007 03:43 AM

Re: Free Sitemap addon, works with XC SEO
 
I don't know if it's me or this is really a bug in the code but when I go to the secure area of my site (hhtps) and click on the site map link I get this php error:

Fatal error: Call to a member function _category_callback() on a non-object in sitemap.php on line 49

This is hapenning only in the https not in http. Any thoughts? Anyone?

Also for some reason when I go to the site map it changes the order of the categories.

intel352 11-16-2007 04:15 AM

Re: Free Sitemap addon, works with XC SEO
 
hmm, i'll check into those issues, thanks cfl

cflsystems 11-25-2007 05:42 AM

Re: Free Sitemap addon, works with XC SEO
 
intel352, not to rush you or anything but did you find a solution for the php error?

montrex 12-06-2007 06:15 AM

Re: Free Sitemap addon, works with XC SEO
 
Hi Jon,

Thank you very much for your mod. It works well.
I have a bilingual site : English & French. The sitemap mod works well in English but when I swicht in French, it didn't work. What can I do to make it work in French ?
Thank you in advance for your help.

Sabrina

SystemSkins 12-08-2007 08:58 AM

Re: Free Sitemap addon, works with XC SEO
 
I installed this mod and everything seams to work fine but one thing..... When I'm viewing the page all my categories are all rearranged. They are all out of order, different from my home page. It changes the order of my categories in my menu bar on the left as well. It also causes the menu bar to not expand for those categories that are multi-level.

I notice it does this on capefearstyles.com and papertrails.com sites as well.

In regards to cflsystems post:
Works for me in both http:// and https://

SystemSkins 12-08-2007 10:39 AM

Re: Free Sitemap addon, works with XC SEO
 
I have removed the dotted lines on my site map and I want to replace the + with a plus and minus image for expanding and collapsing but I can't seam to figure it out. Anyone know how this can be done?

intel352 12-09-2007 03:15 PM

Re: Free Sitemap addon, works with XC SEO
 
montrex, modifications would have to be made to pull the multi-lingual translations for product titles and whatnot, this would likely require some modifications to the SQL queries that are being executed. I'll see if I can make modifications for a future release.

systemskins, this is likely a problem with how I named certain variables, I'll change this for the next release. Regarding the plus/minus, this is handled in the CSS I believe.

SystemSkins 12-09-2007 03:24 PM

Re: Free Sitemap addon, works with XC SEO
 
Quote:

Originally Posted by intel352
systemskins, this is likely a problem with how I named certain variables, I'll change this for the next release.


Will the next release still be free? Do you have any ETA on it?

Quote:

Regarding the plus/minus, this is handled in the CSS I believe.

I've looked, can't seam to find it. I did find the dotted line left border which I removed but not sure where to find the underlined +. I'm assuming its just a + with an underline since its not an image or maybe an acsii charachter/symbol? possible its inerted by the .js or .php ?

SystemSkins 12-09-2007 06:07 PM

Re: Free Sitemap addon, works with XC SEO
 
Ok, I figured it out.

The + symbol is a unicode character called &plusmn; found in sitemap.tpl at the very bottom:
Code:

{literal}
<script type="text/javascript" language="javascript1.2"><!--
compactMenu('category_sitemap',true,'&plusmn', true);
//--></script>{/literal}


I replaced it with:
Code:

{literal}
<script type="text/javascript" language="javascript1.2"><!--
compactMenu('category_sitemap',true,'{/literal}<img src="{$ImagesDir}/sitemap+.gif" alt="" />{literal}', true);
//--></script>
{/literal}


You can see it here: http://www.systemskins.com/sitemap.html


As far as the image changing upon collapsing and expanding. It can not be done with this nested <ul> <li> script. You need to use a different script and it's done with CSS using display properties.

The nested script you produced for this site map I found here: http://www.howtocreate.co.uk/tutorials/jsexamples/listCollapseExample.html

A collapsable script that is more versitile is found here: http://www.howtocreate.co.uk/tutorials/jsexamples/collapseList.html


Now if I can only figure out how to make it so the sitemap doesn't reorder my categories and doesn't break the expanded menu bar on the left i'll be done with this project.

intel352 12-09-2007 07:02 PM

Re: Free Sitemap addon, works with XC SEO
 
I made a conscious choice to use this list method, so that it would be more SEO friendly, as search engines usually aren't to bright regarding URLs that have been generated by javascript.

To correct the category ordering issue, it would be good to find all
Code:

$smarty->assign
instances in the PHP code. Any variables that are being created (the first item in the parentheses), prefix with list_

Then, go through the TPL file, find any variables in that files, prefix each one with list_ (after the $ symbol, if it exists).

That should likely take care of the issue for you.


Simple updates to this project will remain free, I do intend a Pro version as a commercial release ;-)

SystemSkins 12-09-2007 08:35 PM

Re: Free Sitemap addon, works with XC SEO
 
hrmmm gonna give that a try. I think I know what your talking about. We'll see :)

so change $smarty->assign("main",$main); to $smarty->assign("list_main",$main);

or change both like this: $smarty->assign("list_main",$list_main);

intel352 12-09-2007 08:43 PM

Re: Free Sitemap addon, works with XC SEO
 
Quote:

so change $smarty->assign("main",$main); to $smarty->assign("list_main",$main);

that's correct :-)

and do the same changes in the tpl files. at a minimum, add the prefix into the variables that were defined in the php file. at the maximum, add the prefix to all of the variables (as some variables are dynamically assigned in the tpl files sometimes, so might need prefixing as well)

SystemSkins 12-09-2007 08:58 PM

Re: Free Sitemap addon, works with XC SEO
 
Sigh... I'm so lost, I can't seam to know what I should change and what I shouldn't

If I post my code could you do it for me?

I changed all the $smarty->assign and now I'm getting a page not found

$smarty->assign("list_main",$main);
$smarty->assign("list_location", $location);
$smarty->assign('list_products_per_page', $config["Appearance"]["products_per_page"]);
$smarty->assign('list_categories', $categories);
$smarty->assign('list_pages', $pages);

I don't think I need to change the main, and location, and since I'm not using the pages, I don't need to change that one either. I changed those back to default and I get my sitemap back. But its still in the incorrect order and now the categories in my left menu are gone. But then again I could be wrong and they do need to be changed and something else needs to be changed ???

SystemSkins 12-09-2007 09:31 PM

Re: Free Sitemap addon, works with XC SEO
 
sitemap.tpl is easy theres only one place to edit:
Code:

{include file='sitemap_recursion.tpl' categories=$list_categories loopname='top'}
I have the page {foreach item='page' from=$pages} commented out because I don't use it.

But then there is the hard part, sitemap_recursion.tpl
Code:

{foreach item='category' key='cat' from=$categories name=$loopname}
<li{if ($smarty.foreach.$loopname.last && $last) || $smarty.foreach.top.last} class="last"{/if}>
&nbsp;<strong>
<a href="{if $category.seo_url ne ''}{$category.seo_url}{else}home.php?cat={$cat}{/if}" title="{$category.category}">{$category.category}</a>
</strong>
{if $category.products|@count > 0 || $category.subcategories|@count > 0}
    <ul>
    {if $category.products|@count > 0}
        {assign var='catlast' value='false'}
    {else}
        {assign var='catlast' value='true'}
    {/if}
    {if $category.subcategories|@count > 0}
        {include file='sitemap_recursion.tpl' categories=$category.subcategories loopname="loop_`$cat`" last=$catlast}
    {/if}
    {if $category.products|@count > 0}
    {assign var='prod_loop' value="`$loopname`_products"}
    {foreach item='product' from=$category.products name=$prod_loop}
        <li{if $smarty.foreach.$prod_loop.last && $catlast eq 'false'} class="last"{/if}>
        <a href="{if $product.seo_url ne ''}{$product.seo_url}{else}product.php?productid={$product.productid}{/if}" title="{$product.product}">{$product.product}</a>
        </li>
    {/foreach}
    {/if}
    </ul>
{/if}
</li>
{/foreach}


I haven't the slightest clue what to change and what to leave.

intel352 12-09-2007 10:06 PM

Re: Free Sitemap addon, works with XC SEO
 
change all instances of categories to list_categories (in both files). don't do a mass find/replace tho, so that you don't affect the subcategories variables. just do single Find/Replace, one at a time.

SystemSkins 12-09-2007 10:21 PM

Re: Free Sitemap addon, works with XC SEO
 
I guess what I don't understand is. Why all the recoding/renaming? Why can't it just reference the existing category.php file (or what ever it is) and order the categories in the sitemap like it does in the left menu bar? like it is in order number in the admin area?


And I went through the sitemap_recursion and found 5 "categories" and 3 of them were subcategories. So I only changed 2 and when I uploaded and viewed the sitemap was missing and my categories in the menu bar were still out of order.

Have you been able to correct this on your end?

intel352 12-10-2007 12:49 AM

Re: Free Sitemap addon, works with XC SEO
 
in the code, i'm pulling the category structure from scratch, disregarding the existing array(s) of data that x-cart has already pulled, as I pull a different set of data.

something suggests that variables are being overwritten by my code though, as otherwise the side category nav wouldn't lose it's ordering.

i haven't looked into this yet, it's not high on my priority list, but soon

SystemSkins 12-10-2007 12:56 AM

Re: Free Sitemap addon, works with XC SEO
 
Ok no problem, it's not high on my priority list either, after all it is just the order of which my sitemap is displayed. I have given up on trying to figure it out. It is beyond my knowledge but would definately love to see it fixed.

I even tried adding some sniplets of code from the categories.php file like the whole ---Customised Categories Start--- area that includes "func_sort_by_pos". I thought that might help but because you coded it from scratch that explains why it didn't work either.

Thanks !!

candleshopcreations 12-16-2007 11:33 PM

Re: Free Sitemap addon, works with XC SEO
 
Quote:

Originally Posted by cflsystems
I don't know if it's me or this is really a bug in the code but when I go to the secure area of my site (hhtps) and click on the site map link I get this php error:

Fatal error: Call to a member function _category_callback() on a non-object in sitemap.php on line 49

This is happening only in the https not in http. Any thoughts? Anyone?

Also for some reason when I go to the site map it changes the order of the categories.


Hello, did anyone have a chance to resolve this? I get the same error except on mine its line 44 and happens with both http and https. i installed this on my new 4.1.9 store.

Thanks,
Andrea

Jon 12-18-2007 12:31 PM

Re: Free Sitemap addon, works with XC SEO
 
FYI, in addition to not being multi-lingual the code does not take membership levels into account.

sales@webosusa.com 01-03-2008 06:59 PM

Re: Free Sitemap addon, works with XC SEO
 
I use different languages on my website.... but this MOD looks to work showing only the main language. Any other way to show with the right language chose by the user?
Like... if i choose English will show the site map for the English categories.... if i choose French will show the categories in French as well and so on?

sambamu 01-10-2008 06:51 PM

Re: Free Sitemap addon, works with XC SEO
 
I love your modification. Thanks a lot.

xcarter 01-11-2008 08:25 PM

Re: Free Sitemap addon, works with XC SEO
 
My categories don't list when in site map.
You can see what happens at http://www.justbedding.com.au/sitemap.php

Can someone please help?

This is such a great mod! Thanks Jon.

sales@webosusa.com 01-14-2008 10:43 AM

Re: Free Sitemap addon, works with XC SEO
 
Any one know why this happen: "Fatal error: Call to a member function on a non-object in .../pathfrommywebsite/pathfrommywebsite/pathfrommywebsite/pathfrommywebsite/bra/sitemap.php on line 44"
Allways when XC SEO ins active.

Any ideas?

Thanks!

intel352 01-16-2008 11:25 PM

Re: Free Sitemap addon, works with XC SEO
 
I've updated the archive in the first post, please follow the instructions provided in the archive, and upload the updated files. If this does not correct whatever errors any of you may be experiencing, feel free to contact me directly via email (in my signature).

Cheers!

-Jon

sales@webosusa.com 01-17-2008 05:04 AM

Re: Free Sitemap addon, works with XC SEO
 
Thanks!.


All times are GMT -8. The time now is 05:55 PM.

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