discxpress Posted December 1, 2014 Share Posted December 1, 2014 Thank you. That worked. Bootstrap seems more flexible. Link to comment Share on other sites More sharing options...
frankl Posted December 8, 2014 Share Posted December 8, 2014 In the attached .zip you'll find a new system for creating XML sitemaps. These 4 files create an up to date XML sitemap on every visit to them, on the fly. This is different from the other XML sitemap addons I have seen as all these require a cron job or manual update. Please feel free to download and test by uploading to your shop. Any feedback you can provide will be useful. XML sitemaps.zip Downloaded and "installed". Working fine, accepted by Google Webmaster Tools without a problem. I've commented out the lastmod, changefreq and priority fields as they are optional and I don't feel they add any value. I doubt Googlebot places any weight on them, especially if they are generic and auto generated. No reflection on your code though Gary - excellent and elegant work as usual. osCommerce user since 2003! Link to comment Share on other sites More sharing options...
frankl Posted December 9, 2014 Share Posted December 9, 2014 sorry to come back to this, but I'm staring again at this webmaster tools page about multi-lingual setup. https://support.google.com/webmasters/answer/189077 has anything been done with link rel="alternate" for multi-lingual sites ? I'm sure someone can come up with a far more elegant example (as I have hardcoded domains in mine) but this works for a hreflang header tag (see http://goo.gl/o1BrTq) A couple of caveats - this code will work if A ) One site is en-us and the other is en-gb languages (although you can easily change that in the code) B ) Both sites have identical structure, except for the domain name C ) You only want these tags on product info, index page, category pages and manufacturer pages (but you can add more pages to the code if you like) catalog/includes/modules/header_tags/ht_hreflang.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2013 osCommerce Released under the GNU General Public License */ class ht_hreflang { var $code = 'ht_hreflang'; var $group = 'header_tags'; var $title; var $description; var $sort_order; var $enabled = false; function ht_hreflang() { $this->title = MODULE_HEADER_TAGS_HREFLANG_TITLE; $this->description = MODULE_HEADER_TAGS_HREFLANG_DESCRIPTION; if ( defined('MODULE_HEADER_TAGS_HREFLANG_STATUS') ) { $this->sort_order = MODULE_HEADER_TAGS_HREFLANG_SORT_ORDER; $this->enabled = (MODULE_HEADER_TAGS_HREFLANG_STATUS == 'True'); } } function execute() { global $PHP_SELF, $HTTP_GET_VARS, $cPath, $oscTemplate; if (basename($PHP_SELF) == FILENAME_PRODUCT_INFO) { $oscTemplate->addBlock('<link rel="alternate" hreflang="en-us" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$HTTP_GET_VARS['products_id'], 'NONSSL', false) . '" />' . "\n" . '<link rel="alternate" hreflang="en-gb" href="' . str_replace('example.com', 'example.co.uk', tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$HTTP_GET_VARS['products_id'], 'NONSSL', false)) . '" />' . "\n", $this->group); } elseif (basename($PHP_SELF) == FILENAME_DEFAULT) { if (isset($cPath) && tep_not_null($cPath)) { $oscTemplate->addBlock('<link rel="alternate" hreflang="en-us" href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath, 'NONSSL', false) . '" />' . "\n" . '<link rel="alternate" hreflang="en-gb" href="' . str_replace('example.com', 'example.co.uk', tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath, 'NONSSL', false)) . '" />' . "\n", $this->group); } elseif (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) { $oscTemplate->addBlock('<link rel="alternate" hreflang="en-us" href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . (int)$HTTP_GET_VARS['manufacturers_id'], 'NONSSL', false) . '" />' . "\n" . '<link rel="alternate" hreflang="en-gb" href="' . str_replace('example.com', 'example.co.uk', tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . (int)$HTTP_GET_VARS['manufacturers_id'], 'NONSSL', false)) . '" />' . "\n", $this->group); } else { $oscTemplate->addBlock('<link rel="alternate" hreflang="en-us" href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false) . '" />' . "\n" . '<link rel="alternate" hreflang="en-gb" href="' . str_replace('example.com', 'example.co.uk', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false)) . '" />' . "\n", $this->group); } } } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_HEADER_TAGS_HREFLANG_STATUS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable hreflang Module', 'MODULE_HEADER_TAGS_HREFLANG_STATUS', 'True', 'Do you want to enable the hreflang module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_HREFLANG_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_HEADER_TAGS_HREFLANG_STATUS', 'MODULE_HEADER_TAGS_HREFLANG_SORT_ORDER'); } } ?> catalog/includes/languages/english/modules/header_tags/ht_hreflang.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2012 osCommerce Released under the GNU General Public License */ define('MODULE_HEADER_TAGS_HREFLANG_TITLE', 'hreflang Header Links'); define('MODULE_HEADER_TAGS_HREFLANG_DESCRIPTION', 'Add header hreflang links index, category, manufacturer and product pages'); ?> osCommerce user since 2003! Link to comment Share on other sites More sharing options...
burt Posted December 10, 2014 Author Share Posted December 10, 2014 @@frankl - thanks for the feeback on those XML scripts. I had plans to create a little interface for each product where the shopowner could update those changefreq etc - but then decided that not many shopowners need that fine level of tuning, at least I don't think so. I do have plans to pull SEO into the core code at some point, but that's a while off yet. Link to comment Share on other sites More sharing options...
frankl Posted December 10, 2014 Share Posted December 10, 2014 @@frankl - thanks for the feeback on those XML scripts. I had plans to create a little interface for each product where the shopowner could update those changefreq etc - but then decided that not many shopowners need that fine level of tuning, at least I don't think so. I do have plans to pull SEO into the core code at some point, but that's a while off yet. From what I know of Google, it is the algorithm which decides how important a page is (on your site and on the net as a whole), how often the site and pages should be crawled, and whether a page has been updated or not - so no need to even have those in your sitemap. It's OK to keep lastmod, changefreq and priority in your code for those webmasters who think it's important, the rest of us can just comment it out :-) osCommerce user since 2003! Link to comment Share on other sites More sharing options...
burt Posted December 10, 2014 Author Share Posted December 10, 2014 Remember that SEO is not just Google, even though Google is the 1200 pound Gorilla. Link to comment Share on other sites More sharing options...
♥altoid Posted March 16, 2015 Share Posted March 16, 2015 @@altoid I use this solution at this moment https://github.com/Gergely/oscommerce2-1/commit/8206e3997762eacb4434d968383dfa6c9124104b @@Gergely I just moved a shop from 2.3.4 to 2.3.4BS. Is the Github commit....Validate cPath in URL fix still valid as your post above from 2013? I also see a different cPath fix in this commit. https://github.com/tgely/oscommerce2-1/commit/d81cd276c658c39816464dbdf000d04e12a01d20 Google is again indexing more than it should. Should I apply the above to help this situation out? Thanks I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
tgely Posted March 17, 2015 Share Posted March 17, 2015 @@altoid The last commit only deleted unnecessary code which never worked in a real shop. I have upgraded commit here https://github.com/Gergely/oscommerce2-addons/compare/cPath_validation osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store. Link to comment Share on other sites More sharing options...
♥altoid Posted March 17, 2015 Share Posted March 17, 2015 @@altoid The last commit only deleted unnecessary code which never worked in a real shop. I have upgraded commit here https://github.com/Gergely/oscommerce2-addons/compare/cPath_validation Thank you, I will be installing that. I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
Hotclutch Posted April 6, 2015 Share Posted April 6, 2015 1) osCommerce logo - The logo links to domain/index.php by default when most store owners probably want to have domain/ indexed by search engines. Htacces code to redirect is available here on the forum, but index.php still remains in the source code for search engines to see. 2) Pagination - On pages with pagination eg. products_new.php?page=2; the previous button links to products_new.php?page=1, which is duplicate content for the page products_new.php. You can attempt to correct this with the canonical tag, but it is not always ideal to have the page parameter excluded with the canonical tag. Link to comment Share on other sites More sharing options...
concorde44 Posted February 25, 2016 Share Posted February 25, 2016 @@Gergely Gergely, after I installed this the duplicate title tags that google wasn't happy about have been reducing dramatically. I removed all 301 redirects I had set up in my .htaccess file and have been relying on your code exclusively. I have been testing the remaining duplicates that webmaster tools is still showing. The duplicates are being handled correctly now thanks to the code. Those dups should disappear in the next cycle or so I'd think. Should your modification be included in the core package somewhere along the way? For situations like I ran into it would save a lot of grief in dealing with duplicate content errors. Thanks Hi altoid and Gergely, I can't find this code on Github and I have duplicate categories. Can you drop me a new link to use this code on my old 2.2 oscommerce ? btw I have USU5 fwr's media Seo code installed already. thanks for your help. Seb Osc 2.2 MS2 Link to comment Share on other sites More sharing options...
concorde44 Posted February 25, 2016 Share Posted February 25, 2016 Hi, I just found the old code ! here : https://github.com/tgely/oscommerce2-1/commit/8206e3997762eacb4434d968383dfa6c9124104b Applied it and it works fine. I didn't check the headers yet, but the redirection works fine :thumbsup: Thanks Gerely. Osc 2.2 MS2 Link to comment Share on other sites More sharing options...
freyed Posted March 17, 2016 Share Posted March 17, 2016 Remember that SEO is not just Google, even though Google is the 1200 pound Gorilla. Agree on that. To put this another way, for every four (ok, just over) searches using Google, there is another search done in Bing. For every five searches using Google, there is another one done using Yahoo. Link to comment Share on other sites More sharing options...
freyed Posted March 17, 2016 Share Posted March 17, 2016 So you need to consider if you are focusing too hard on Google to the detriment of other search engines. Link to comment Share on other sites More sharing options...
♥kymation Posted March 17, 2016 Share Posted March 17, 2016 I believe that it helps to have the reviews on the product page and not a separate page. Google (at least) seems to like reviews. Search rankings are by page, so having reviews on a separate page does nothing for your product page. Microdata helps, but a good "meta" title is also important, and a description may help. Keywords are worthless unless you're targeting Baidu. Yahoo does use the results from Bing, but sometimes reorders the results a bit. If you concentrate on getting a good rank in Bing, your Yahoo results should be similar. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Dan Cole Posted March 17, 2016 Share Posted March 17, 2016 In addition to the Microdata tags for the product pages I've been using the SEO Header Tags - RELOADED category descriptions feature to add content to my product categories. That seems to help a lot so don't overlook that either. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
burt Posted March 17, 2016 Author Share Posted March 17, 2016 Core:Meta Keywords for Pages, Categories, ManufacturersMeta Description for Pages, Categories, ManufacturersCategory DescriptionManufacturer DescriptionOpengraphDirect Connect Microdata Breadcrumb Microdata Product Page Microdata Reviews To Do: Meta Keywords for Products Meta Description for Products Keywords Search Engine Testimonials Page Progress is at https://github.com/gburton/Responsive-osCommerce/issues/241 Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted August 17, 2016 Share Posted August 17, 2016 I've added alternate language urls to the products xml that @@burt provided Background info https://support.google.com/webmasters/answer/2620865?ref_topic=2370587 As I use a derivative of chemo SEO url class, I instantiated the class for the different languages and called the hreflink directly. This sitemap validates, but I couldn't get it to work with the xmlns:xhtml declared just in the root urlset element, so now it is repeated for each alternate link element. <?php $xml = new SimpleXMLElement("<?xml version='1.0' encoding='UTF-8' ?>\n".'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'); include ('includes/application_top.php'); $product_array = array(); //normally set in application_top if (!isset($lng) || (isset($lng) && !is_object($lng))) { include(DIR_WS_CLASSES . 'language.php'); $lng = new language; } reset($lng->catalog_languages); while (list($key, $value) = each($lng->catalog_languages)) { if ($value['id'] <> $languages_id) { $other_languages[$key] = $value; $other_seo[$key] = new SEO_URL($value['id']); } else { $this_hreflang = $key;} } // products $products_query = tep_db_query("select products_id, coalesce(NULLIF(products_last_modified, ''), products_date_added) as last_modified from products where products_status = 1 order by last_modified DESC"); while ($products = tep_db_fetch_array($products_query)) { $product_array[$products['products_id']]['loc'] = tep_href_link('product_info.php', 'products_id=' . (int)$products['products_id'], 'NONSSL', false); $product_array[$products['products_id']]['lastmod'] = $products['last_modified']; foreach ($other_languages as $key => $value) { $product_array[$products['products_id']]['alternate'][$key] = $other_seo[$key]->href_link('product_info.php', 'products_id=' . (int)$products['products_id'], 'NONSSL', false); } } foreach ($product_array as $k => $v) { $url = $xml->addChild('url'); $url->addChild('loc', $v['loc']); $url->addChild('lastmod', date("Y-m-d", strtotime($v['lastmod']))); // $url->addChild('changefreq', 'weekly'); // $url->addChild('priority', '0.5'); foreach ($v['alternate'] as $hreflang=>$href) { $other_link = $url->addChild('xhtml:link',null,'http://www.w3.org/1999/xhtml'); $other_link->addAttribute('rel','alternate'); $other_link->addAttribute('hreflang',$hreflang); $other_link->addAttribute('href',$href); } $this_link = $url->addChild('xhtml:link',null,'http://www.w3.org/1999/xhtml'); $this_link->addAttribute('rel','alternate'); $this_link->addAttribute('hreflang', $this_hreflang); $this_link->addAttribute('href',$v['loc']); } header('Content-type: text/xml'); echo $xml->asXML(); KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted August 17, 2016 Share Posted August 17, 2016 This is the code for the SiteMapCategories.php <?php $xml = new SimpleXMLElement("<?xml version='1.0' encoding='UTF-8' ?>\n".'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'); include ('includes/application_top.php'); $category_array = array(); //normally set in application_top if (!isset($lng) || (isset($lng) && !is_object($lng))) { include(DIR_WS_CLASSES . 'language.php'); $lng = new language; } reset($lng->catalog_languages); while (list($key, $value) = each($lng->catalog_languages)) { if ($value['id'] <> $languages_id) { $other_languages[$key] = $value; $other_seo[$key] = new SEO_URL($value['id']); } else { $this_hreflang = $key;} } // categories $categories_query = tep_db_query("select categories_id, coalesce(NULLIF(last_modified, ''), date_added) as last_modified from categories group by categories_id order by last_modified DESC"); while ($categories = tep_db_fetch_array($categories_query)) { $category_array[$categories['categories_id']]['loc'] = tep_href_link('index.php', 'cPath=' . (int)$categories['categories_id']); $category_array[$categories['categories_id']]['lastmod'] = $categories['last_modified']; foreach ($other_languages as $key => $value) { $category_array[$categories['categories_id']]['alternate'][$key] = $other_seo[$key]->href_link('index.php', 'cPath=' . (int)$categories['categories_id']); } } foreach ($category_array as $k => $v) { $url = $xml->addChild('url'); $url->addChild('loc', $v['loc']); $url->addChild('lastmod', date("Y-m-d", strtotime($v['lastmod']))); // $url->addChild('changefreq', 'weekly'); // $url->addChild('priority', '0.5'); foreach ($v['alternate'] as $hreflang=>$href) { $other_link = $url->addChild('xhtml:link',null,'http://www.w3.org/1999/xhtml'); $other_link->addAttribute('rel','alternate'); $other_link->addAttribute('hreflang',$hreflang); $other_link->addAttribute('href',$href); } $this_link = $url->addChild('xhtml:link',null,'http://www.w3.org/1999/xhtml'); $this_link->addAttribute('rel','alternate'); $this_link->addAttribute('hreflang', $this_hreflang); $this_link->addAttribute('href',$v['loc']); } header('Content-type: text/xml'); echo $xml->asXML(); and the SiteMapManufacturers.php <?php $xml = new SimpleXMLElement("<?xml version='1.0' encoding='UTF-8' ?>\n".'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'); include ('includes/application_top.php'); $manufacturer_array = array(); //normally set in application_top if (!isset($lng) || (isset($lng) && !is_object($lng))) { include(DIR_WS_CLASSES . 'language.php'); $lng = new language; } reset($lng->catalog_languages); while (list($key, $value) = each($lng->catalog_languages)) { if ($value['id'] <> $languages_id) { $other_languages[$key] = $value; $other_seo[$key] = new SEO_URL($value['id']); } else { $this_hreflang = $key;} } // products $manufacturers_query = tep_db_query("select manufacturers_id, coalesce(NULLIF(last_modified, ''), date_added) as last_modified from manufacturers order by last_modified DESC"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturer_array[$manufacturers['manufacturers_id']]['loc'] = tep_href_link('index.php', 'manufacturers_id=' . $manufacturers['manufacturers_id']); $manufacturer_array[$manufacturers['manufacturers_id']]['lastmod'] = $manufacturers['last_modified']; foreach ($other_languages as $key => $value) { $manufacturer_array[$manufacturers['manufacturers_id']]['alternate'][$key] = $other_seo[$key]->href_link('index.php', 'manufacturers_id=' . $manufacturers['manufacturers_id']); } } foreach ($manufacturer_array as $k => $v) { $url = $xml->addChild('url'); $url->addChild('loc', $v['loc']); $url->addChild('lastmod', date("Y-m-d", strtotime($v['lastmod']))); // $url->addChild('changefreq', 'weekly'); // $url->addChild('priority', '0.5'); foreach ($v['alternate'] as $hreflang=>$href) { $other_link = $url->addChild('xhtml:link',null,'http://www.w3.org/1999/xhtml'); $other_link->addAttribute('rel','alternate'); $other_link->addAttribute('hreflang',$hreflang); $other_link->addAttribute('href',$href); } $this_link = $url->addChild('xhtml:link',null,'http://www.w3.org/1999/xhtml'); $this_link->addAttribute('rel','alternate'); $this_link->addAttribute('hreflang', $this_hreflang); $this_link->addAttribute('href',$v['loc']); } header('Content-type: text/xml'); echo $xml->asXML(); KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.