Page 1 of 1

[MSU Sitemaps] Links

Posted: Wed Mar 26, 2008 3:30 pm
by capnhairdo
Sample code generated by MSU Sitemaps:

Code: Select all

<url>
  <loc>http://www.babybestbuy.com/index.php?main_page=index&cPath=7_21</loc>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
</url>
<url>
  <loc>http://www.babybestbuy.com/hot-deals-19/</loc>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
</url>
<url>
  <loc>http://www.babybestbuy.com/hot-deals-19/index-2.html</loc>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
</url>

Two questions:

In the first link, why is the old ZenCart style URL being used, rather than the MSEO version? In fact, why is this listing included at all? This is a category with no currently active products, so it therefore doesn't appear anywhere on our site (but we've retained it because we may reactive or add some new products at some point). If it doesn't appear on the site, I would think it shouldn't be included in the sitemap.

In the third link, why is "/index-2.html" appended to the address? There's a bunch like this, using index-2 or index-3.html.

Thanks.

Re: [MSU Sitemaps] Links

Posted: Wed Mar 26, 2008 4:31 pm
by inveo
capnhairdo wrote:In the first link, why is the old ZenCart style URL being used, rather than the MSEO version?


Old URIs are used when no cache data are available (they are created on first page visit).

capnhairdo wrote:In fact, why is this listing included at all? This is a category with no currently active products, so it therefore doesn't appear anywhere on our site (but we've retained it because we may reactive or add some new products at some point). If it doesn't appear on the site, I would think it shouldn't be included in the sitemap.


It is the best when Sitemaps contain all pages of your web even if they don't show any useful content yet.

capnhairdo wrote:In the third link, why is "/index-2.html" appended to the address? There's a bunch like this, using index-2 or index-3.html.


If pagenation does not correspond to the reality it is likely caused by some hard coding you have made to Zen Cart installation (it does affect MSU, only MSU Sitemaps).

Re: [MSU Sitemaps] Links

Posted: Wed Mar 26, 2008 9:50 pm
by capnhairdo
~J~ wrote:Old URIs are used when no cache data are available (they are created on first page visit).

Gotcha. This does in fact seem to be the case. Thanks for the tip. Seems to have only cropped up because disabled categories were being shown (for which no cache data had ever been created).

~J~ wrote:If pagenation does not correspond to the reality it is likely caused by some hard coding you have made to Zen Cart installation (it does affect MSU, only MSU Sitemaps).

I don't think so. After reviewing the code in sitemaps/categories.php, it seems the pagination count is being determined by retrieving the max number of results for search results pages (MAX_DISPLAY_SEARCH_RESULTS)...which is NOT (necessarily, though it could be coincidentally) the same as the max number of products on a category page (MAX_DISPLAY_PRODUCTS_LISTING). Thus the pagination breaks for category pages are being determined incorrectly by dividing by the wrong constant.

Additionally, retrieving the number of total products in a category is not the same as retrieving the number of ACTIVE products. This discrepancy could also affect pagination if disabled products exist. (Also, getting a product count would be more rigorous by doing a join back to the products table, rather than relying on the data in the TABLE_PRODUCTS_TO_CATEGORIES.)

~J~ wrote:It is the best when Sitemaps contain all pages of your web even if they don't show any useful content yet.

I disagree—it's illogical to tell a search engine to index pages that are intentionally disabled (and would be a waste of time for a visitor to follow these links from a search engine to a page that has products).

I was wrong in my previous post is assuming that the existence of (enabled) products in a category is what "enables" the category; ZenCart actually has an explicit field for this: categories_status. If set to 0, ZenCart never shows the category...but MSU Sitemaps does because it doesn't check this field, thus showing all categories, including explicitly disabled ones.

A final note: it seems like you could modify this loop:

Code: Select all

         do {
            $result2 = $db->Execute("SELECT categories_id, parent_id FROM ".TABLE_CATEGORIES." WHERE categories_id = '".$parentId."'");
            $cPath = $result2->fields['categories_id'].'_'.$cPath;
            $parentId = $result2->fields['parent_id'];
            if(empty($result2->fields['parent_id'])) break;
         } while(true);

to replace all the redundant queries to the database by instead just looping back through the original recordset and finding the parent ids from it, since you already have a full array of all category and parent ids there. (This is obviously a pretty minor performance gain since this page would only ever be hit periodically by search engines...but hey, every little bit helps.)

Applying all these changes to sitemaps/categories.php fixes the problems I mentioned:

Code: Select all

<?php

/**
  * MSU Sitemaps - Magic SEO URL URL for ZenCart
  * http://www.magic-seo-url.com/zencart/
  *
  * 2007, (c) Jiri Stavinoha
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
**/

if(!defined('SM_IN_SITEMAPS')) exit();

global $cache, $sm, $db;

$result = $db->Execute("SELECT configuration_value FROM ".TABLE_CONFIGURATION." WHERE configuration_key = 'MAX_DISPLAY_PRODUCTS_LISTING'");
$perPage = $result->fields['configuration_value'];
foreach($GLOBALS['smInstalledLang'] as $langId => $langCode) {
  $result = $db->Execute("SELECT c.categories_id, c.parent_id, COUNT(p.products_id) AS products_in_cat FROM ".TABLE_CATEGORIES." c LEFT JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." pc ON pc.categories_id = c.categories_id LEFT JOIN ".TABLE_PRODUCTS." p ON pc.products_id = p.products_id AND p.products_status = 1 WHERE c.categories_status = 1 GROUP BY c.categories_id, c.parent_id ORDER BY c.categories_id DESC");
  $r1 = 0;
  while ($r1 < $result->RecordCount()) {
    $result->Move($r1++);
    $categoryId = $result->fields['categories_id'];
    $cPath = $categoryId;
    $parentId = $result->fields['parent_id'];
    $products_in_cat = $result->fields['products_in_cat'];
    if(!empty($parentId)) {
      do {
        $r2 = 0;
        while ($r2 < $result->RecordCount() ) {
          $result->Move($r2++);
          if ($result->fields['categories_id'] == $parentId) {
            $cPath = $result->fields['categories_id'].'_'.$cPath;
            $parentId = $result->fields['parent_id'];
            if(empty($parentId)) break 2;
            else break 1;
          }
        }
      } while(true);
    }
    $url = '';
    $fail = false;
    if(strpos($cPath, '_') === false) {
        $niceData = $cache->read('categories-parents', $categoryId, $langId);
        if(!$niceData) {
          $fail = true;
        } else {
          $url = $niceData[1].'-'.$categoryId.'/';
        }
    } else {
      $cPathAr = explode('_', $cPath);
      if(count($cPathAr) > 3) {
        $fail = true;
      } else {
        foreach($cPathAr as $cPathId) {
          $niceData = $cache->read('categories', $cPathId, $langId);
            if(!$niceData) {
              $fail = true;
              break;
            } else {
              $url .= $niceData[1].'-'.$cPathId.'/';
            }
       
        }
      }
    }
 
    if($GLOBALS['smMultilang']) {
      $url = $langCode.'/'.$url;
    }
   
    if($fail) {
      $url = UN_ZENCART_MAINFILE.'?main_page='.FILENAME_DEFAULT.'&amp;cPath='.$cPath.(($GLOBALS['smMultilang']) ? '&amp;language='.$langCode : '');
      $pagination = '&amp;page=__PAGE__';
    } else {
      $pagination = 'index-__PAGE__.html';
    }
   
    $sm->addUrlToSiteMap($url, 'weekly', '0.8');

    $pages = ceil($products_in_cat / $perPage);
   
    for ($i = 2; $i <= $pages; $i++) {
      $sm->addUrlToSiteMap($url.str_replace('__PAGE__', $i, $pagination), 'weekly', '0.8');
    }
  }
}
?>

Re: [MSU Sitemaps] Links

Posted: Fri Apr 11, 2008 11:44 pm
by BlessIsaacola
J- can you please comment on the code changes suggested if it's necessary or useful to apply this code change? Thanks!

Re: [MSU Sitemaps] Links

Posted: Sat Apr 12, 2008 5:20 pm
by BlessIsaacola
Is anyone else having problem with Google sitemap? We've being receiving errors lately:

URL timeout: HTTP request timeout
We encountered an error while trying to access your Sitemap. Please ensure your Sitemap follows our guidelines and can be accessed at the location you provided and then resubmit.

I am not exactly sure why all of a sudden, google is getting this error. The only sitemap having problem is url/sitemaps.php?showMap=Products

Re: [MSU Sitemaps] Links

Posted: Tue Apr 15, 2008 9:06 am
by inveo
New version of MSU Sitemaps will be available soon (also MSU API which allows to add easily support to other feed generators is under development).

Re: [MSU Sitemaps] Links

Posted: Wed Apr 30, 2008 11:20 am
by BlessIsaacola
Any updates on the new MSU Sitemaps? Thanks!

Re: [MSU Sitemaps] Links

Posted: Wed Apr 30, 2008 12:14 pm
by inveo
Update still coming.

Re: [MSU Sitemaps] Links

Posted: Thu May 01, 2008 3:26 am
by inveo
Updated MSU Sitemaps are now available for osCommerce, CRE Loaded and Zen Cart.

http://www.magic-seo-url.com/sitemaps/

Cart  
(empty)

Cart Check out  »

Prices are tax inclusive.

The VAT rate for your country (US) * is 0,0 % because it is not a member of the European Union (EU).

* Please create an account if your country does not match.

Community feed
  • [Zen Cart] Can't execute Magic SEO URLs sitemaps
    I installed Magic SEO URLs Sitemaps Add-On for ZenCart MSU4.x/MSU5.x 2.0 on my server, when I try to generate sitemaps using: https://www.pechesudv155.owally.com/sitemaps.php I received :...
    by peter@pechesud.com
  • [phpBB3] Sharing users between phpBB / PrestaShop
    Hi i have 2 question 1- prestashop module support phpBB 3.3 ? 2- why we can not login in prestashop and phpbb with same user?
    by zohall
  • [phpBB3] AJAX Userinfo Extension
    Hi! I'm having trouble with this extension: https://www.phpbb.com/customise/db/exte ... _userinfo/ I tried asking support from the author but for no avail, since now. My request for support...
    by Lord Phobos
  • [phpBB3] Upgrade to phpBB 3.2.3
    Hello.. after Upgrade to phpBB 3.2.3 I am getting this message.. How can I solve this issue..? Thank you
    by ingbrzy
  • [phpBB3] URL path changed
    Hello.. I have changed my site path after moving to new hosting and now can not activate SEO module.. new path http://www.miuios.cz/domains/miuios.cz/ could you help me? thank you
    by ingbrzy2
Join our support forum » Pre-Sales Questions »
Featured Testimonials

Magic SEO URLs for ZenCart were an excellent investment for our medium-sized business, and the support team revised the software to get our non-standard Zen Cart working. It does everything we need it to, and overall I have been thrilled with Magic SEO URLs. I mean every word of that. Thanks again.

Dimitri, the owner of Headphones - Headsonic Australia

AWESOME! Worked like a charm. I now understand why you used the word Magic in its name. Quick, easy, painless, gets the job done, and beautiful. Thanks a Million for creating this fantastic tool and for the quick excellent support.

Mohammad, the owner of TradersCity

More Testimonials »