Unable to generate the sitemapProduct Attributes could not be reindexedSQLSTATE[42S02]: Base table or view not found: 1146 Table 'core_store' doesn't existCron jobs not being called, getting email notification errorsShows “SQLSTATE[42S02]: Base table or view not found----” when I try to access the customer details in admin panelMagento 1.9.1.1 : Create Store View : Cardinality violation: 1241 Operand should contain 1 column(s)Error in admin panel: MySQL server has gone awayThere has been an error processing your request magento 1.9.0.1SQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in MagentoCan't run CRON PDOException Magento 1.9.3.8Magento 1.9 - There has been an error processing your request
Using Past-Perfect interchangeably with the Past Continuous
What favor did Moody owe Dumbledore?
Writing in a Christian voice
Why didn't Héctor fade away after this character died in the movie Coco?
Relation between independence and correlation of uniform random variables
If "dar" means "to give", what does "daros" mean?
Geography in 3D perspective
Maths symbols and unicode-math input inside siunitx commands
Why are there no stars visible in cislunar space?
Have the tides ever turned twice on any open problem?
Should I use acronyms in dialogues before telling the readers what it stands for in fiction?
gerund and noun applications
Is it true that good novels will automatically sell themselves on Amazon (and so on) and there is no need for one to waste time promoting?
Are dual Irish/British citizens bound by the 90/180 day rule when travelling in the EU after Brexit?
What (if any) is the reason to buy in small local stores?
HP P840 HDD RAID 5 many strange drive failures
Turning a hard to access nut?
Should I be concerned about student access to a test bank?
Do native speakers use "ultima" and "proxima" frequently in spoken English?
Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?
Describing a chess game in a novel
Synchronized implementation of a bank account in Java
How to terminate ping <dest> &
Existence of a celestial body big enough for early civilization to be thought of as a second moon
Unable to generate the sitemap
Product Attributes could not be reindexedSQLSTATE[42S02]: Base table or view not found: 1146 Table 'core_store' doesn't existCron jobs not being called, getting email notification errorsShows “SQLSTATE[42S02]: Base table or view not found----” when I try to access the customer details in admin panelMagento 1.9.1.1 : Create Store View : Cardinality violation: 1241 Operand should contain 1 column(s)Error in admin panel: MySQL server has gone awayThere has been an error processing your request magento 1.9.0.1SQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in MagentoCan't run CRON PDOException Magento 1.9.3.8Magento 1.9 - There has been an error processing your request
Magento fails to generate the sitemap.xml. I get Unable to generate the sitemap.
.
I get this exception:
2019-02-25T15:00:59+00:00 DEBUG (7): Exception message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULLurl_rewrite.id_path LIKE 'category/%'
INNER JOIN `magecatalog_category_enti' at line 2, query was: SELECT `main_table`.`entity_id`, `url_rewrite`.`request_path` FROM `magecatalog_category_entity` AS `main_table`
LEFT JOIN `magecore_url_rewrite` AS `url_rewrite` ON url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND url_rewrite.store_id = 1 AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
INNER JOIN `magecatalog_category_entity_int` AS `t1_is_active` ON main_table.entity_id=t1_is_active.entity_id AND t1_is_active.store_id=0
LEFT JOIN `magecatalog_category_entity_int` AS `t2_is_active` ON t1_is_active.entity_id = t2_is_active.entity_id AND t1_is_active.attribute_id = t2_is_active.attribute_id AND t2_is_active.store_id = 1 WHERE (main_table.path LIKE '1/2/%') AND (t1_is_active.attribute_id='42') AND ((IF(t2_is_active.value_id > 0, t2_is_active.value, t1_is_active.value))=1)
Trace: #0 /home/company/live/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/company/live/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/company/live/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/company/live/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 /home/company/live/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5 /home/company/live/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Abstract.php(164): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select))
#6 /home/company/live/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Category.php(80): Mage_Sitemap_Model_Resource_Catalog_Abstract->_loadEntities()
#7 /home/company/live/app/code/core/Mage/Sitemap/Model/Sitemap.php(154): Mage_Sitemap_Model_Resource_Catalog_Category->getCollection('1')
#8 /home/company/live/app/code/core/Mage/Adminhtml/controllers/SitemapController.php(255): Mage_Sitemap_Model_Sitemap->generateXml()
#9 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_SitemapController->generateAction()
#10 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('generate')
#11 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /home/company/live/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#13 /home/company/live/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /home/company/live/index.php(70): Mage::run('', 'store')
#15 main
The error only appears in our live shop, in the test shop it works fine, even if I checkout the live shop branch in git and the staging area is clean
The permission of the sitemap.xml is set to -rw-rw-rw
in both shops.
magento-1.9 sitemaps google
add a comment |
Magento fails to generate the sitemap.xml. I get Unable to generate the sitemap.
.
I get this exception:
2019-02-25T15:00:59+00:00 DEBUG (7): Exception message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULLurl_rewrite.id_path LIKE 'category/%'
INNER JOIN `magecatalog_category_enti' at line 2, query was: SELECT `main_table`.`entity_id`, `url_rewrite`.`request_path` FROM `magecatalog_category_entity` AS `main_table`
LEFT JOIN `magecore_url_rewrite` AS `url_rewrite` ON url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND url_rewrite.store_id = 1 AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
INNER JOIN `magecatalog_category_entity_int` AS `t1_is_active` ON main_table.entity_id=t1_is_active.entity_id AND t1_is_active.store_id=0
LEFT JOIN `magecatalog_category_entity_int` AS `t2_is_active` ON t1_is_active.entity_id = t2_is_active.entity_id AND t1_is_active.attribute_id = t2_is_active.attribute_id AND t2_is_active.store_id = 1 WHERE (main_table.path LIKE '1/2/%') AND (t1_is_active.attribute_id='42') AND ((IF(t2_is_active.value_id > 0, t2_is_active.value, t1_is_active.value))=1)
Trace: #0 /home/company/live/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/company/live/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/company/live/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/company/live/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 /home/company/live/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5 /home/company/live/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Abstract.php(164): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select))
#6 /home/company/live/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Category.php(80): Mage_Sitemap_Model_Resource_Catalog_Abstract->_loadEntities()
#7 /home/company/live/app/code/core/Mage/Sitemap/Model/Sitemap.php(154): Mage_Sitemap_Model_Resource_Catalog_Category->getCollection('1')
#8 /home/company/live/app/code/core/Mage/Adminhtml/controllers/SitemapController.php(255): Mage_Sitemap_Model_Sitemap->generateXml()
#9 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_SitemapController->generateAction()
#10 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('generate')
#11 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /home/company/live/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#13 /home/company/live/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /home/company/live/index.php(70): Mage::run('', 'store')
#15 main
The error only appears in our live shop, in the test shop it works fine, even if I checkout the live shop branch in git and the staging area is clean
The permission of the sitemap.xml is set to -rw-rw-rw
in both shops.
magento-1.9 sitemaps google
add a comment |
Magento fails to generate the sitemap.xml. I get Unable to generate the sitemap.
.
I get this exception:
2019-02-25T15:00:59+00:00 DEBUG (7): Exception message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULLurl_rewrite.id_path LIKE 'category/%'
INNER JOIN `magecatalog_category_enti' at line 2, query was: SELECT `main_table`.`entity_id`, `url_rewrite`.`request_path` FROM `magecatalog_category_entity` AS `main_table`
LEFT JOIN `magecore_url_rewrite` AS `url_rewrite` ON url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND url_rewrite.store_id = 1 AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
INNER JOIN `magecatalog_category_entity_int` AS `t1_is_active` ON main_table.entity_id=t1_is_active.entity_id AND t1_is_active.store_id=0
LEFT JOIN `magecatalog_category_entity_int` AS `t2_is_active` ON t1_is_active.entity_id = t2_is_active.entity_id AND t1_is_active.attribute_id = t2_is_active.attribute_id AND t2_is_active.store_id = 1 WHERE (main_table.path LIKE '1/2/%') AND (t1_is_active.attribute_id='42') AND ((IF(t2_is_active.value_id > 0, t2_is_active.value, t1_is_active.value))=1)
Trace: #0 /home/company/live/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/company/live/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/company/live/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/company/live/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 /home/company/live/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5 /home/company/live/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Abstract.php(164): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select))
#6 /home/company/live/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Category.php(80): Mage_Sitemap_Model_Resource_Catalog_Abstract->_loadEntities()
#7 /home/company/live/app/code/core/Mage/Sitemap/Model/Sitemap.php(154): Mage_Sitemap_Model_Resource_Catalog_Category->getCollection('1')
#8 /home/company/live/app/code/core/Mage/Adminhtml/controllers/SitemapController.php(255): Mage_Sitemap_Model_Sitemap->generateXml()
#9 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_SitemapController->generateAction()
#10 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('generate')
#11 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /home/company/live/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#13 /home/company/live/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /home/company/live/index.php(70): Mage::run('', 'store')
#15 main
The error only appears in our live shop, in the test shop it works fine, even if I checkout the live shop branch in git and the staging area is clean
The permission of the sitemap.xml is set to -rw-rw-rw
in both shops.
magento-1.9 sitemaps google
Magento fails to generate the sitemap.xml. I get Unable to generate the sitemap.
.
I get this exception:
2019-02-25T15:00:59+00:00 DEBUG (7): Exception message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULLurl_rewrite.id_path LIKE 'category/%'
INNER JOIN `magecatalog_category_enti' at line 2, query was: SELECT `main_table`.`entity_id`, `url_rewrite`.`request_path` FROM `magecatalog_category_entity` AS `main_table`
LEFT JOIN `magecore_url_rewrite` AS `url_rewrite` ON url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND url_rewrite.store_id = 1 AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
INNER JOIN `magecatalog_category_entity_int` AS `t1_is_active` ON main_table.entity_id=t1_is_active.entity_id AND t1_is_active.store_id=0
LEFT JOIN `magecatalog_category_entity_int` AS `t2_is_active` ON t1_is_active.entity_id = t2_is_active.entity_id AND t1_is_active.attribute_id = t2_is_active.attribute_id AND t2_is_active.store_id = 1 WHERE (main_table.path LIKE '1/2/%') AND (t1_is_active.attribute_id='42') AND ((IF(t2_is_active.value_id > 0, t2_is_active.value, t1_is_active.value))=1)
Trace: #0 /home/company/live/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/company/live/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/company/live/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/company/live/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 /home/company/live/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5 /home/company/live/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Abstract.php(164): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select))
#6 /home/company/live/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Category.php(80): Mage_Sitemap_Model_Resource_Catalog_Abstract->_loadEntities()
#7 /home/company/live/app/code/core/Mage/Sitemap/Model/Sitemap.php(154): Mage_Sitemap_Model_Resource_Catalog_Category->getCollection('1')
#8 /home/company/live/app/code/core/Mage/Adminhtml/controllers/SitemapController.php(255): Mage_Sitemap_Model_Sitemap->generateXml()
#9 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_SitemapController->generateAction()
#10 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('generate')
#11 /home/company/live/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /home/company/live/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#13 /home/company/live/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /home/company/live/index.php(70): Mage::run('', 'store')
#15 main
The error only appears in our live shop, in the test shop it works fine, even if I checkout the live shop branch in git and the staging area is clean
The permission of the sitemap.xml is set to -rw-rw-rw
in both shops.
magento-1.9 sitemaps google
magento-1.9 sitemaps google
edited Mar 7 at 14:03
Black
asked Feb 25 at 15:00
BlackBlack
386320
386320
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
There was an error in your SQL:
AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
should looks like:
AND url_rewrite.category_id IS NOT NULL AND url_rewrite.id_path LIKE 'category/%'
Possible there was some kind of modifications made by some third-party observer. Take a look at modules installed in your system and check all its observers.
Another modifications could exists inside the app/code/local
directory (using replace of the core class). Check it too.
If it is really because of code problem, then why does it work on my dev where the same branch is checked out? The staging areas are clean and nothing is there
– Black
Mar 1 at 20:33
1
My thougths ... this schould not happen with unmodified code.
– sv3n
Mar 1 at 23:39
add a comment |
I tracked down the exact problem code line.
It is inside the function getCollection()
from the class Mage_Sitemap_Model_Resource_Catalog_Category
:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId); // <-- Problem is here
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I workaround it by overriding the method in my own extension and changing the function to this:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
// Workaround to fix "Unable to generate sitemap" error only happening on live store
$this->_select = str_replace("IS NOT NULLurl_rewrite.id_path", "IS NOT NULL AND url_rewrite.id_path", $this->_select);
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I am still confused why this only happens in my live store even though the code on my dev store is 1:1 the same.
I've checked in magento 1.9.3.2 and 1.9.4 - in the sql query for category URLs generation the condition "category_id IS NOT NULL" does not exist. Check your Mage_Catalog_Helper_Category_Url_Rewrite::joinTableToSelect() method. If this class doesn't used then something replaced this rewrite helper class using config - see Mage_Catalog_Model_Factory::getCategoryUrlRewriteHelper().
– sergei.sss
Mar 2 at 8:29
The config partially forms using the database - with the identical code we can have different behaviour between the live and dev sites.
– sergei.sss
Mar 2 at 8:36
Case 2: It is possible to change magento config using files from app/etc directory - we can add this code to app/etc/local.xml inside the <config> : <global> <catalog> <category> <url_rewrite> <helper>catalog/category_url_rewrite_my_class</helper> </url_rewrite> </category> </catalog> </global> and rewrite model will be replaced to own class. Very often the developers adds these configuration files to .gitignore and these files drop out of comparison.
– sergei.sss
Mar 2 at 9:18
@sergei.sss, I know, I checked the gitignore but nothing relevant is getting ignored. The app/etc/local.xml does not contain such code
– Black
Mar 2 at 9:31
add a comment |
Try below to see what is actually causing the error before applying the above solution!;
Open the file;
app/code/core/Mage/Adminhtml/controllers/SitemapController.php
Find the line:
$this->_getSession()->addException($e,
Mage::helper('sitemap')->__('Unable to generate the sitemap.'));
And replace it with:
$this->_getSession()->addException($e,
$e->getMessage());
and try to see if you can run the sitemap again. hope this should be able to help better!
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f263330%2funable-to-generate-the-sitemap%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
There was an error in your SQL:
AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
should looks like:
AND url_rewrite.category_id IS NOT NULL AND url_rewrite.id_path LIKE 'category/%'
Possible there was some kind of modifications made by some third-party observer. Take a look at modules installed in your system and check all its observers.
Another modifications could exists inside the app/code/local
directory (using replace of the core class). Check it too.
If it is really because of code problem, then why does it work on my dev where the same branch is checked out? The staging areas are clean and nothing is there
– Black
Mar 1 at 20:33
1
My thougths ... this schould not happen with unmodified code.
– sv3n
Mar 1 at 23:39
add a comment |
There was an error in your SQL:
AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
should looks like:
AND url_rewrite.category_id IS NOT NULL AND url_rewrite.id_path LIKE 'category/%'
Possible there was some kind of modifications made by some third-party observer. Take a look at modules installed in your system and check all its observers.
Another modifications could exists inside the app/code/local
directory (using replace of the core class). Check it too.
If it is really because of code problem, then why does it work on my dev where the same branch is checked out? The staging areas are clean and nothing is there
– Black
Mar 1 at 20:33
1
My thougths ... this schould not happen with unmodified code.
– sv3n
Mar 1 at 23:39
add a comment |
There was an error in your SQL:
AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
should looks like:
AND url_rewrite.category_id IS NOT NULL AND url_rewrite.id_path LIKE 'category/%'
Possible there was some kind of modifications made by some third-party observer. Take a look at modules installed in your system and check all its observers.
Another modifications could exists inside the app/code/local
directory (using replace of the core class). Check it too.
There was an error in your SQL:
AND url_rewrite.category_id IS NOT NULLurl_rewrite.id_path LIKE 'category/%'
should looks like:
AND url_rewrite.category_id IS NOT NULL AND url_rewrite.id_path LIKE 'category/%'
Possible there was some kind of modifications made by some third-party observer. Take a look at modules installed in your system and check all its observers.
Another modifications could exists inside the app/code/local
directory (using replace of the core class). Check it too.
edited Mar 1 at 14:30
answered Mar 1 at 14:16
Siarhey UchukhlebauSiarhey Uchukhlebau
9,91193058
9,91193058
If it is really because of code problem, then why does it work on my dev where the same branch is checked out? The staging areas are clean and nothing is there
– Black
Mar 1 at 20:33
1
My thougths ... this schould not happen with unmodified code.
– sv3n
Mar 1 at 23:39
add a comment |
If it is really because of code problem, then why does it work on my dev where the same branch is checked out? The staging areas are clean and nothing is there
– Black
Mar 1 at 20:33
1
My thougths ... this schould not happen with unmodified code.
– sv3n
Mar 1 at 23:39
If it is really because of code problem, then why does it work on my dev where the same branch is checked out? The staging areas are clean and nothing is there
– Black
Mar 1 at 20:33
If it is really because of code problem, then why does it work on my dev where the same branch is checked out? The staging areas are clean and nothing is there
– Black
Mar 1 at 20:33
1
1
My thougths ... this schould not happen with unmodified code.
– sv3n
Mar 1 at 23:39
My thougths ... this schould not happen with unmodified code.
– sv3n
Mar 1 at 23:39
add a comment |
I tracked down the exact problem code line.
It is inside the function getCollection()
from the class Mage_Sitemap_Model_Resource_Catalog_Category
:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId); // <-- Problem is here
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I workaround it by overriding the method in my own extension and changing the function to this:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
// Workaround to fix "Unable to generate sitemap" error only happening on live store
$this->_select = str_replace("IS NOT NULLurl_rewrite.id_path", "IS NOT NULL AND url_rewrite.id_path", $this->_select);
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I am still confused why this only happens in my live store even though the code on my dev store is 1:1 the same.
I've checked in magento 1.9.3.2 and 1.9.4 - in the sql query for category URLs generation the condition "category_id IS NOT NULL" does not exist. Check your Mage_Catalog_Helper_Category_Url_Rewrite::joinTableToSelect() method. If this class doesn't used then something replaced this rewrite helper class using config - see Mage_Catalog_Model_Factory::getCategoryUrlRewriteHelper().
– sergei.sss
Mar 2 at 8:29
The config partially forms using the database - with the identical code we can have different behaviour between the live and dev sites.
– sergei.sss
Mar 2 at 8:36
Case 2: It is possible to change magento config using files from app/etc directory - we can add this code to app/etc/local.xml inside the <config> : <global> <catalog> <category> <url_rewrite> <helper>catalog/category_url_rewrite_my_class</helper> </url_rewrite> </category> </catalog> </global> and rewrite model will be replaced to own class. Very often the developers adds these configuration files to .gitignore and these files drop out of comparison.
– sergei.sss
Mar 2 at 9:18
@sergei.sss, I know, I checked the gitignore but nothing relevant is getting ignored. The app/etc/local.xml does not contain such code
– Black
Mar 2 at 9:31
add a comment |
I tracked down the exact problem code line.
It is inside the function getCollection()
from the class Mage_Sitemap_Model_Resource_Catalog_Category
:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId); // <-- Problem is here
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I workaround it by overriding the method in my own extension and changing the function to this:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
// Workaround to fix "Unable to generate sitemap" error only happening on live store
$this->_select = str_replace("IS NOT NULLurl_rewrite.id_path", "IS NOT NULL AND url_rewrite.id_path", $this->_select);
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I am still confused why this only happens in my live store even though the code on my dev store is 1:1 the same.
I've checked in magento 1.9.3.2 and 1.9.4 - in the sql query for category URLs generation the condition "category_id IS NOT NULL" does not exist. Check your Mage_Catalog_Helper_Category_Url_Rewrite::joinTableToSelect() method. If this class doesn't used then something replaced this rewrite helper class using config - see Mage_Catalog_Model_Factory::getCategoryUrlRewriteHelper().
– sergei.sss
Mar 2 at 8:29
The config partially forms using the database - with the identical code we can have different behaviour between the live and dev sites.
– sergei.sss
Mar 2 at 8:36
Case 2: It is possible to change magento config using files from app/etc directory - we can add this code to app/etc/local.xml inside the <config> : <global> <catalog> <category> <url_rewrite> <helper>catalog/category_url_rewrite_my_class</helper> </url_rewrite> </category> </catalog> </global> and rewrite model will be replaced to own class. Very often the developers adds these configuration files to .gitignore and these files drop out of comparison.
– sergei.sss
Mar 2 at 9:18
@sergei.sss, I know, I checked the gitignore but nothing relevant is getting ignored. The app/etc/local.xml does not contain such code
– Black
Mar 2 at 9:31
add a comment |
I tracked down the exact problem code line.
It is inside the function getCollection()
from the class Mage_Sitemap_Model_Resource_Catalog_Category
:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId); // <-- Problem is here
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I workaround it by overriding the method in my own extension and changing the function to this:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
// Workaround to fix "Unable to generate sitemap" error only happening on live store
$this->_select = str_replace("IS NOT NULLurl_rewrite.id_path", "IS NOT NULL AND url_rewrite.id_path", $this->_select);
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I am still confused why this only happens in my live store even though the code on my dev store is 1:1 the same.
I tracked down the exact problem code line.
It is inside the function getCollection()
from the class Mage_Sitemap_Model_Resource_Catalog_Category
:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId); // <-- Problem is here
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I workaround it by overriding the method in my own extension and changing the function to this:
public function getCollection($storeId)
/* @var $store Mage_Core_Model_Store */
$store = Mage::app()->getStore($storeId);
if (!$store)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from($this->getMainTable())
->where($this->getIdFieldName() . '=?', $store->getRootCategoryId());
$categoryRow = $this->_getWriteAdapter()->fetchRow($this->_select);
if (!$categoryRow)
return false;
$this->_select = $this->_getWriteAdapter()->select()
->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->where('main_table.path LIKE ?', $categoryRow['path'] . '/%');
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Category_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getCategoryUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
// Workaround to fix "Unable to generate sitemap" error only happening on live store
$this->_select = str_replace("IS NOT NULLurl_rewrite.id_path", "IS NOT NULL AND url_rewrite.id_path", $this->_select);
$this->_addFilter($storeId, 'is_active', 1);
return $this->_loadEntities();
I am still confused why this only happens in my live store even though the code on my dev store is 1:1 the same.
answered Mar 1 at 22:28
BlackBlack
386320
386320
I've checked in magento 1.9.3.2 and 1.9.4 - in the sql query for category URLs generation the condition "category_id IS NOT NULL" does not exist. Check your Mage_Catalog_Helper_Category_Url_Rewrite::joinTableToSelect() method. If this class doesn't used then something replaced this rewrite helper class using config - see Mage_Catalog_Model_Factory::getCategoryUrlRewriteHelper().
– sergei.sss
Mar 2 at 8:29
The config partially forms using the database - with the identical code we can have different behaviour between the live and dev sites.
– sergei.sss
Mar 2 at 8:36
Case 2: It is possible to change magento config using files from app/etc directory - we can add this code to app/etc/local.xml inside the <config> : <global> <catalog> <category> <url_rewrite> <helper>catalog/category_url_rewrite_my_class</helper> </url_rewrite> </category> </catalog> </global> and rewrite model will be replaced to own class. Very often the developers adds these configuration files to .gitignore and these files drop out of comparison.
– sergei.sss
Mar 2 at 9:18
@sergei.sss, I know, I checked the gitignore but nothing relevant is getting ignored. The app/etc/local.xml does not contain such code
– Black
Mar 2 at 9:31
add a comment |
I've checked in magento 1.9.3.2 and 1.9.4 - in the sql query for category URLs generation the condition "category_id IS NOT NULL" does not exist. Check your Mage_Catalog_Helper_Category_Url_Rewrite::joinTableToSelect() method. If this class doesn't used then something replaced this rewrite helper class using config - see Mage_Catalog_Model_Factory::getCategoryUrlRewriteHelper().
– sergei.sss
Mar 2 at 8:29
The config partially forms using the database - with the identical code we can have different behaviour between the live and dev sites.
– sergei.sss
Mar 2 at 8:36
Case 2: It is possible to change magento config using files from app/etc directory - we can add this code to app/etc/local.xml inside the <config> : <global> <catalog> <category> <url_rewrite> <helper>catalog/category_url_rewrite_my_class</helper> </url_rewrite> </category> </catalog> </global> and rewrite model will be replaced to own class. Very often the developers adds these configuration files to .gitignore and these files drop out of comparison.
– sergei.sss
Mar 2 at 9:18
@sergei.sss, I know, I checked the gitignore but nothing relevant is getting ignored. The app/etc/local.xml does not contain such code
– Black
Mar 2 at 9:31
I've checked in magento 1.9.3.2 and 1.9.4 - in the sql query for category URLs generation the condition "category_id IS NOT NULL" does not exist. Check your Mage_Catalog_Helper_Category_Url_Rewrite::joinTableToSelect() method. If this class doesn't used then something replaced this rewrite helper class using config - see Mage_Catalog_Model_Factory::getCategoryUrlRewriteHelper().
– sergei.sss
Mar 2 at 8:29
I've checked in magento 1.9.3.2 and 1.9.4 - in the sql query for category URLs generation the condition "category_id IS NOT NULL" does not exist. Check your Mage_Catalog_Helper_Category_Url_Rewrite::joinTableToSelect() method. If this class doesn't used then something replaced this rewrite helper class using config - see Mage_Catalog_Model_Factory::getCategoryUrlRewriteHelper().
– sergei.sss
Mar 2 at 8:29
The config partially forms using the database - with the identical code we can have different behaviour between the live and dev sites.
– sergei.sss
Mar 2 at 8:36
The config partially forms using the database - with the identical code we can have different behaviour between the live and dev sites.
– sergei.sss
Mar 2 at 8:36
Case 2: It is possible to change magento config using files from app/etc directory - we can add this code to app/etc/local.xml inside the <config> : <global> <catalog> <category> <url_rewrite> <helper>catalog/category_url_rewrite_my_class</helper> </url_rewrite> </category> </catalog> </global> and rewrite model will be replaced to own class. Very often the developers adds these configuration files to .gitignore and these files drop out of comparison.
– sergei.sss
Mar 2 at 9:18
Case 2: It is possible to change magento config using files from app/etc directory - we can add this code to app/etc/local.xml inside the <config> : <global> <catalog> <category> <url_rewrite> <helper>catalog/category_url_rewrite_my_class</helper> </url_rewrite> </category> </catalog> </global> and rewrite model will be replaced to own class. Very often the developers adds these configuration files to .gitignore and these files drop out of comparison.
– sergei.sss
Mar 2 at 9:18
@sergei.sss, I know, I checked the gitignore but nothing relevant is getting ignored. The app/etc/local.xml does not contain such code
– Black
Mar 2 at 9:31
@sergei.sss, I know, I checked the gitignore but nothing relevant is getting ignored. The app/etc/local.xml does not contain such code
– Black
Mar 2 at 9:31
add a comment |
Try below to see what is actually causing the error before applying the above solution!;
Open the file;
app/code/core/Mage/Adminhtml/controllers/SitemapController.php
Find the line:
$this->_getSession()->addException($e,
Mage::helper('sitemap')->__('Unable to generate the sitemap.'));
And replace it with:
$this->_getSession()->addException($e,
$e->getMessage());
and try to see if you can run the sitemap again. hope this should be able to help better!
add a comment |
Try below to see what is actually causing the error before applying the above solution!;
Open the file;
app/code/core/Mage/Adminhtml/controllers/SitemapController.php
Find the line:
$this->_getSession()->addException($e,
Mage::helper('sitemap')->__('Unable to generate the sitemap.'));
And replace it with:
$this->_getSession()->addException($e,
$e->getMessage());
and try to see if you can run the sitemap again. hope this should be able to help better!
add a comment |
Try below to see what is actually causing the error before applying the above solution!;
Open the file;
app/code/core/Mage/Adminhtml/controllers/SitemapController.php
Find the line:
$this->_getSession()->addException($e,
Mage::helper('sitemap')->__('Unable to generate the sitemap.'));
And replace it with:
$this->_getSession()->addException($e,
$e->getMessage());
and try to see if you can run the sitemap again. hope this should be able to help better!
Try below to see what is actually causing the error before applying the above solution!;
Open the file;
app/code/core/Mage/Adminhtml/controllers/SitemapController.php
Find the line:
$this->_getSession()->addException($e,
Mage::helper('sitemap')->__('Unable to generate the sitemap.'));
And replace it with:
$this->_getSession()->addException($e,
$e->getMessage());
and try to see if you can run the sitemap again. hope this should be able to help better!
answered 47 mins ago
rightnowtodayrightnowtoday
314
314
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f263330%2funable-to-generate-the-sitemap%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown