Overriding Magento Sitemap Model Class
I try to override Mage_Sitemap_Model_Resource_Catalog_Product
class. Here is my files:
File magentoappetcmodulesOwn_Sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
File magentoappcodelocalOwnSitemapetcconfig.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
File magentoappcodelocalOwnSitemapModelResourceCatalogProduct.php
class Own_Sitemap_Model_Resource_Catalog_Product extends Mage_Sitemap_Model_Resource_Catalog_Product
{
/**
* Get product collection array
*
* @param int $storeId
* @return array
*/
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(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->join(
array('w' => $this->getTable('catalog/product_website')),
'main_table.entity_id = w.product_id',
array()
)
->where('w.website_id=?', $store->getWebsiteId());
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Product_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getProductUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
$this->_addFilter($storeId, 'visibility',
Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds(), 'in'
);
$this->_addFilter($storeId, 'status',
Mage::getSingleton('catalog/product_status')->getVisibleStatusIds(), 'in'
);
$entries = $this->_loadEntities();
$this->_addFilter($storeId, 'inchoo_meta_robots', array(200, 201), 'in');
$noindex = $this->_loadEntities();
foreach ($entries as $k => $v){
if (array_key_exists($k, $noindex)) {
unset($entries[$k]);
}
}
return $entries;
}
}
When I try to generate new sitemap, application stiil use Mage class. I tried to remove the cache, but it did not help. What am I doing wrong?
overrides sitemaps
bumped to the homepage by Community♦ 7 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I try to override Mage_Sitemap_Model_Resource_Catalog_Product
class. Here is my files:
File magentoappetcmodulesOwn_Sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
File magentoappcodelocalOwnSitemapetcconfig.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
File magentoappcodelocalOwnSitemapModelResourceCatalogProduct.php
class Own_Sitemap_Model_Resource_Catalog_Product extends Mage_Sitemap_Model_Resource_Catalog_Product
{
/**
* Get product collection array
*
* @param int $storeId
* @return array
*/
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(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->join(
array('w' => $this->getTable('catalog/product_website')),
'main_table.entity_id = w.product_id',
array()
)
->where('w.website_id=?', $store->getWebsiteId());
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Product_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getProductUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
$this->_addFilter($storeId, 'visibility',
Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds(), 'in'
);
$this->_addFilter($storeId, 'status',
Mage::getSingleton('catalog/product_status')->getVisibleStatusIds(), 'in'
);
$entries = $this->_loadEntities();
$this->_addFilter($storeId, 'inchoo_meta_robots', array(200, 201), 'in');
$noindex = $this->_loadEntities();
foreach ($entries as $k => $v){
if (array_key_exists($k, $noindex)) {
unset($entries[$k]);
}
}
return $entries;
}
}
When I try to generate new sitemap, application stiil use Mage class. I tried to remove the cache, but it did not help. What am I doing wrong?
overrides sitemaps
bumped to the homepage by Community♦ 7 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Are you sure no other modules has rewritten that class?
– Sander Mangel♦
Aug 18 '15 at 9:14
add a comment |
I try to override Mage_Sitemap_Model_Resource_Catalog_Product
class. Here is my files:
File magentoappetcmodulesOwn_Sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
File magentoappcodelocalOwnSitemapetcconfig.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
File magentoappcodelocalOwnSitemapModelResourceCatalogProduct.php
class Own_Sitemap_Model_Resource_Catalog_Product extends Mage_Sitemap_Model_Resource_Catalog_Product
{
/**
* Get product collection array
*
* @param int $storeId
* @return array
*/
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(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->join(
array('w' => $this->getTable('catalog/product_website')),
'main_table.entity_id = w.product_id',
array()
)
->where('w.website_id=?', $store->getWebsiteId());
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Product_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getProductUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
$this->_addFilter($storeId, 'visibility',
Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds(), 'in'
);
$this->_addFilter($storeId, 'status',
Mage::getSingleton('catalog/product_status')->getVisibleStatusIds(), 'in'
);
$entries = $this->_loadEntities();
$this->_addFilter($storeId, 'inchoo_meta_robots', array(200, 201), 'in');
$noindex = $this->_loadEntities();
foreach ($entries as $k => $v){
if (array_key_exists($k, $noindex)) {
unset($entries[$k]);
}
}
return $entries;
}
}
When I try to generate new sitemap, application stiil use Mage class. I tried to remove the cache, but it did not help. What am I doing wrong?
overrides sitemaps
I try to override Mage_Sitemap_Model_Resource_Catalog_Product
class. Here is my files:
File magentoappetcmodulesOwn_Sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
File magentoappcodelocalOwnSitemapetcconfig.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
File magentoappcodelocalOwnSitemapModelResourceCatalogProduct.php
class Own_Sitemap_Model_Resource_Catalog_Product extends Mage_Sitemap_Model_Resource_Catalog_Product
{
/**
* Get product collection array
*
* @param int $storeId
* @return array
*/
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(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
->join(
array('w' => $this->getTable('catalog/product_website')),
'main_table.entity_id = w.product_id',
array()
)
->where('w.website_id=?', $store->getWebsiteId());
$storeId = (int)$store->getId();
/** @var $urlRewrite Mage_Catalog_Helper_Product_Url_Rewrite_Interface */
$urlRewrite = $this->_factory->getProductUrlRewriteHelper();
$urlRewrite->joinTableToSelect($this->_select, $storeId);
$this->_addFilter($storeId, 'visibility',
Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds(), 'in'
);
$this->_addFilter($storeId, 'status',
Mage::getSingleton('catalog/product_status')->getVisibleStatusIds(), 'in'
);
$entries = $this->_loadEntities();
$this->_addFilter($storeId, 'inchoo_meta_robots', array(200, 201), 'in');
$noindex = $this->_loadEntities();
foreach ($entries as $k => $v){
if (array_key_exists($k, $noindex)) {
unset($entries[$k]);
}
}
return $entries;
}
}
When I try to generate new sitemap, application stiil use Mage class. I tried to remove the cache, but it did not help. What am I doing wrong?
overrides sitemaps
overrides sitemaps
edited Aug 17 '15 at 21:02
Anna Völkl
15.5k347133
15.5k347133
asked Aug 14 '15 at 11:55
Vitalii ProdanVitalii Prodan
313
313
bumped to the homepage by Community♦ 7 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 7 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Are you sure no other modules has rewritten that class?
– Sander Mangel♦
Aug 18 '15 at 9:14
add a comment |
Are you sure no other modules has rewritten that class?
– Sander Mangel♦
Aug 18 '15 at 9:14
Are you sure no other modules has rewritten that class?
– Sander Mangel♦
Aug 18 '15 at 9:14
Are you sure no other modules has rewritten that class?
– Sander Mangel♦
Aug 18 '15 at 9:14
add a comment |
2 Answers
2
active
oldest
votes
Use below config instead of above to rewrite model
#File magentoappcodelocalOwnSitemapetccongif.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<rewrite>
<resource_catalog_product>Own_Sitemap_Model_Resource_Catalog_Product</resource_catalog_product>
</rewrite>
</sitemap>
</models>
</global>
</config>
Problem still not solved.
– Vitalii Prodan
Aug 14 '15 at 12:13
I modified above code, try this
– amit_game
Aug 14 '15 at 12:22
Does not work. Thank you for trying
– Vitalii Prodan
Aug 14 '15 at 12:32
I have gone through the above code and tested it on the same module to rewrite and its working perfectly, any thing else which you want to tell, me any error, some what else
– amit_game
Aug 14 '15 at 13:16
I set xdebug breakpoints and I see that magento still use core class. In Configuration > Advanced > Advanced this block is enabled i.imgur.com/UYvPUWa.png
– Vitalii Prodan
Aug 14 '15 at 13:37
|
show 2 more comments
Replace your code in File magentoappetcmodulesOwn_Sitemap.xml
From
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codePool>local</codePool>
</Own_Sitemap>
</modules>
</config>
Note: Magento will first take the node value (watch the upper case P in the node name).Then it is must be codePool
Replace your code in File magentoappcodelocalOwnSitemapetcconfig.xml
From
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</sitemap_resource>
</models>
</global>
</config>
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f78732%2foverriding-magento-sitemap-model-class%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use below config instead of above to rewrite model
#File magentoappcodelocalOwnSitemapetccongif.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<rewrite>
<resource_catalog_product>Own_Sitemap_Model_Resource_Catalog_Product</resource_catalog_product>
</rewrite>
</sitemap>
</models>
</global>
</config>
Problem still not solved.
– Vitalii Prodan
Aug 14 '15 at 12:13
I modified above code, try this
– amit_game
Aug 14 '15 at 12:22
Does not work. Thank you for trying
– Vitalii Prodan
Aug 14 '15 at 12:32
I have gone through the above code and tested it on the same module to rewrite and its working perfectly, any thing else which you want to tell, me any error, some what else
– amit_game
Aug 14 '15 at 13:16
I set xdebug breakpoints and I see that magento still use core class. In Configuration > Advanced > Advanced this block is enabled i.imgur.com/UYvPUWa.png
– Vitalii Prodan
Aug 14 '15 at 13:37
|
show 2 more comments
Use below config instead of above to rewrite model
#File magentoappcodelocalOwnSitemapetccongif.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<rewrite>
<resource_catalog_product>Own_Sitemap_Model_Resource_Catalog_Product</resource_catalog_product>
</rewrite>
</sitemap>
</models>
</global>
</config>
Problem still not solved.
– Vitalii Prodan
Aug 14 '15 at 12:13
I modified above code, try this
– amit_game
Aug 14 '15 at 12:22
Does not work. Thank you for trying
– Vitalii Prodan
Aug 14 '15 at 12:32
I have gone through the above code and tested it on the same module to rewrite and its working perfectly, any thing else which you want to tell, me any error, some what else
– amit_game
Aug 14 '15 at 13:16
I set xdebug breakpoints and I see that magento still use core class. In Configuration > Advanced > Advanced this block is enabled i.imgur.com/UYvPUWa.png
– Vitalii Prodan
Aug 14 '15 at 13:37
|
show 2 more comments
Use below config instead of above to rewrite model
#File magentoappcodelocalOwnSitemapetccongif.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<rewrite>
<resource_catalog_product>Own_Sitemap_Model_Resource_Catalog_Product</resource_catalog_product>
</rewrite>
</sitemap>
</models>
</global>
</config>
Use below config instead of above to rewrite model
#File magentoappcodelocalOwnSitemapetccongif.xml
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<rewrite>
<resource_catalog_product>Own_Sitemap_Model_Resource_Catalog_Product</resource_catalog_product>
</rewrite>
</sitemap>
</models>
</global>
</config>
edited Aug 14 '15 at 13:15
answered Aug 14 '15 at 12:08
amit_gameamit_game
8821227
8821227
Problem still not solved.
– Vitalii Prodan
Aug 14 '15 at 12:13
I modified above code, try this
– amit_game
Aug 14 '15 at 12:22
Does not work. Thank you for trying
– Vitalii Prodan
Aug 14 '15 at 12:32
I have gone through the above code and tested it on the same module to rewrite and its working perfectly, any thing else which you want to tell, me any error, some what else
– amit_game
Aug 14 '15 at 13:16
I set xdebug breakpoints and I see that magento still use core class. In Configuration > Advanced > Advanced this block is enabled i.imgur.com/UYvPUWa.png
– Vitalii Prodan
Aug 14 '15 at 13:37
|
show 2 more comments
Problem still not solved.
– Vitalii Prodan
Aug 14 '15 at 12:13
I modified above code, try this
– amit_game
Aug 14 '15 at 12:22
Does not work. Thank you for trying
– Vitalii Prodan
Aug 14 '15 at 12:32
I have gone through the above code and tested it on the same module to rewrite and its working perfectly, any thing else which you want to tell, me any error, some what else
– amit_game
Aug 14 '15 at 13:16
I set xdebug breakpoints and I see that magento still use core class. In Configuration > Advanced > Advanced this block is enabled i.imgur.com/UYvPUWa.png
– Vitalii Prodan
Aug 14 '15 at 13:37
Problem still not solved.
– Vitalii Prodan
Aug 14 '15 at 12:13
Problem still not solved.
– Vitalii Prodan
Aug 14 '15 at 12:13
I modified above code, try this
– amit_game
Aug 14 '15 at 12:22
I modified above code, try this
– amit_game
Aug 14 '15 at 12:22
Does not work. Thank you for trying
– Vitalii Prodan
Aug 14 '15 at 12:32
Does not work. Thank you for trying
– Vitalii Prodan
Aug 14 '15 at 12:32
I have gone through the above code and tested it on the same module to rewrite and its working perfectly, any thing else which you want to tell, me any error, some what else
– amit_game
Aug 14 '15 at 13:16
I have gone through the above code and tested it on the same module to rewrite and its working perfectly, any thing else which you want to tell, me any error, some what else
– amit_game
Aug 14 '15 at 13:16
I set xdebug breakpoints and I see that magento still use core class. In Configuration > Advanced > Advanced this block is enabled i.imgur.com/UYvPUWa.png
– Vitalii Prodan
Aug 14 '15 at 13:37
I set xdebug breakpoints and I see that magento still use core class. In Configuration > Advanced > Advanced this block is enabled i.imgur.com/UYvPUWa.png
– Vitalii Prodan
Aug 14 '15 at 13:37
|
show 2 more comments
Replace your code in File magentoappetcmodulesOwn_Sitemap.xml
From
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codePool>local</codePool>
</Own_Sitemap>
</modules>
</config>
Note: Magento will first take the node value (watch the upper case P in the node name).Then it is must be codePool
Replace your code in File magentoappcodelocalOwnSitemapetcconfig.xml
From
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</sitemap_resource>
</models>
</global>
</config>
add a comment |
Replace your code in File magentoappetcmodulesOwn_Sitemap.xml
From
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codePool>local</codePool>
</Own_Sitemap>
</modules>
</config>
Note: Magento will first take the node value (watch the upper case P in the node name).Then it is must be codePool
Replace your code in File magentoappcodelocalOwnSitemapetcconfig.xml
From
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</sitemap_resource>
</models>
</global>
</config>
add a comment |
Replace your code in File magentoappetcmodulesOwn_Sitemap.xml
From
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codePool>local</codePool>
</Own_Sitemap>
</modules>
</config>
Note: Magento will first take the node value (watch the upper case P in the node name).Then it is must be codePool
Replace your code in File magentoappcodelocalOwnSitemapetcconfig.xml
From
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</sitemap_resource>
</models>
</global>
</config>
Replace your code in File magentoappetcmodulesOwn_Sitemap.xml
From
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codepool>local</codepool>
</Own_Sitemap>
</modules>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<active>true</active>
<codePool>local</codePool>
</Own_Sitemap>
</modules>
</config>
Note: Magento will first take the node value (watch the upper case P in the node name).Then it is must be codePool
Replace your code in File magentoappcodelocalOwnSitemapetcconfig.xml
From
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap>
<catalog_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</catalog_resource>
</sitemap>
</models>
</global>
</config>
To
<?xml version="1.0"?>
<config>
<modules>
<Own_Sitemap>
<version>0.1</version>
</Own_Sitemap>
</modules>
<global>
<models>
<sitemap_resource>
<rewrite>
<product>Own_Sitemap_Model_Resource_Catalog_Product</product>
</rewrite>
</sitemap_resource>
</models>
</global>
</config>
edited Jan 8 '16 at 4:42
answered Jan 8 '16 at 4:32
AbdulAbdul
8,05511135
8,05511135
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f78732%2foverriding-magento-sitemap-model-class%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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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
Are you sure no other modules has rewritten that class?
– Sander Mangel♦
Aug 18 '15 at 9:14