Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Générer les sitemaps Google
 
dev722z
Member
 
Total Posts:  50
Joined:  2008-04-09
 

Salut,

Voilà un petit topo pour utiliser les fonctionnalités de Google Sitemap:
- à la main en connaissant l’URL
- en touchant au code du core pour avoir une liste déroulante d’actions (voir/générer)

1- Générer les sitemaps

Configurez les paramètres dans:
System > Configuration > Google Sitemap

Créez le ou les sitemaps nécessaires dans :
Catalog > Google Sitemap

Pour générer le sitemap ayant l’id 1 utilisez l’URL suivante :
admin/sitemap/generate/sitemap_id/1

2- Ajout d’une liste déroulante pour générer les sitemaps

attention: modification de fichiers du core

Dans le fichier app/code/core/Mage/Adminhtml/Block/Sitemap/Grid.php,juste avant la ligne :

return parent::_prepareColumns();
ajouter:
#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'
        
));
#-------------->

Ajouter le fichier 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);
    
}

}

Videz le cache pour voir la liste déroulante permettant de voir ou de générer le fichier sitemap souhaité.

3- Automatiser

Configurer les pramètres généraux du cron pour Magento:
System > Configuration > System > Crontab

Configurer les pramètres généraux du cron pour Google Sitemap :
System > Configuration > Google Sitemap

Configurer crontab sur votre serveur avec quelquechose comme ça:

*/* * * * /absolute/path/to/php5 -/absolute/path/to/magento/cron.php

dev722z

 
Magento Community Magento Community
Magento Community
Magento Community
 
Otaugames
Sr. Member
 
Total Posts:  101
Joined:  2007-10-07
Troyes, France
 

Merci dev722z d’avoir partagé cette correction, ça fonctionne parfaitement de mon côté ! wink

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
53216 users|806 users currently online|107270 forum posts