|
Hi,
1- Generate sitemaps with admin URL
Configure:
System > Configuration > Google Sitemap
Create sitmap(s) in :
Catalog > Google Sitemap
To generate sitemap with id 1:
admin/sitemap/generate/sitemap_id/1
2- Add an actions dropdown list to backend
warning: it is not recommended to modify core files
In file app/code/core/Mage/Adminhtml/Block/Sitemap/Grid.php,just before :
return parent::_prepareColumns();
add:
#722z----------> # add action dropdown $this->addColumn('action', array( 'header' => Mage::helper('sitemap')->__('Action'), 'filter' => false, 'sortable' => false, 'width' => '100px', 'renderer' => 'adminhtml/sitemap_grid_renderer_action' )); #-------------->
Add this file app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * @category Mage * @package Mage_Adminhtml * @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */
/** * Adminhtml sitemap grid block action item renderer * * @category Mage * @package Mage_Adminhtml * @author 722z */
class Mage_Adminhtml_Block_Sitemap_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action { public function render(Varien_Object $row) { $actions = array();
$path = ltrim($row->getSitemapPath(), '/'); $path = rtrim($path, '/'); $link = Mage::getBaseUrl('web') . $path . '/' . $row->getSitemapFilename(); $actions[] = array( 'url' => $link, 'caption' => Mage::helper('sitemap')->__('Preview'), 'popup' => true );
$actions[] = array( 'url' => $this->getUrl('*/sitemap/generate',array('sitemap_id'=>$row->getSitemapId())), 'confirm' => Mage::helper('sitemap')->__('Do you really want to generate this sitemap?'), 'caption' => Mage::helper('sitemap')->__('Generate'), );
$this->getColumn()->setActions($actions); return parent::render($row); }
}
3- Automatize
Configure Magento crontab in:
System > Configuration > System > Crontab
Configure cron for Google Sitemap :
System > Configuration > Google Sitemap
Configure crontab on your server with something like this:
*/5 * * * * /absolute/path/to/php5 -f /absolute/path/to/magento/cron.php
dev722z
|