<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Agence de Développement Informatique du Nord &#187; Override</title>
	<atom:link href="http://blog.adin.pro/tag/override/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.adin.pro</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 26 Dec 2019 08:54:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Magento &#8211; add a new action in grid</title>
		<link>http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/</link>
		<comments>http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/#comments</comments>
		<pubDate>Wed, 20 Aug 2014 08:27:13 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[Override]]></category>
		<category><![CDATA[_preparecolumns]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=398</guid>
		<description><![CDATA[<p>Here, how to add new action in grid like &#8216;Edit&#8217; link at admin grid. On this example, we will add a &#8220;schedule&#8221; action in product admin grid. We will overrite this class /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php. Declare the rewrite class on the /app/code/local/Adin/Catalog/etc/config.xml &#8230; <a href="http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/">Magento &#8211; add a new action in grid</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Here, how to add new action in grid like &#8216;Edit&#8217; link at admin grid.<br />
On this example, we will add a &#8220;schedule&#8221; action in product admin grid.</p>
<p>We will overrite this class /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php.</p>
<p>Declare the rewrite class on the /app/code/local/Adin/Catalog/etc/config.xml<br />
and add</p>
<pre class="brush: xml; title: ; notranslate">
&lt;global&gt;
      &lt;blocks&gt;
            &lt;adminhtml&gt;
                &lt;rewrite&gt;
                    &lt;catalog_product_grid&gt;Adin_Catalog_Block_Adminhtml_Catalog_Product_Grid&lt;/catalog_product_grid&gt;
                &lt;/rewrite&gt;
            &lt;/adminhtml&gt;
        &lt;/blocks&gt;
&lt;/global&gt;
</pre>
<p>Then create your rewritted class /app/code/local/Adin/Catalog/Block/Adminhtml/Catalog/Product/Grid.php.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
class Adin_Catalog_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid {
}
?&gt;
</pre>
<p>Now, rewrite the _prepareColumns() function, find the &#8216;action&#8217; column an add an entry in the actions array</p>
<pre class="brush: php; title: ; notranslate">
  $this-&gt;addColumn('action',
            array(
                'header'    =&gt; Mage::helper('catalog')-&gt;__('Action'),
                'width'     =&gt; '50px',
                'type'      =&gt; 'action',
                'getter'     =&gt; 'getId',
                'actions'   =&gt; array(
                    array(
                        'caption' =&gt; Mage::helper('catalog')-&gt;__('Edit'),
                        'url'     =&gt; array(
                            'base'=&gt;'*/*/edit',
                            'params'=&gt;array('store'=&gt;$this-&gt;getRequest()-&gt;getParam('store'))
                        ),
                        'field'   =&gt; 'id'
                    ),
                    array(
                        'caption' =&gt; Mage::helper('catalog')-&gt;__('Schedule'),
                        'url'     =&gt; array(
                            'base'=&gt;'*/*/schedule',
                            'params'=&gt;array('store'=&gt;$this-&gt;getRequest()-&gt;getParam('store'))
                        ),
                        'field'   =&gt; 'id'
                    ),
                ),
                'filter'    =&gt; false,
                'sortable'  =&gt; false,
                'index'     =&gt; 'stores',
            ));
</pre>
<p>In our example, we just add this part</p>
<pre class="brush: php; title: ; notranslate">
array(
                        'caption' =&gt; Mage::helper('catalog')-&gt;__('Schedule'),
                        'url'     =&gt; array(
                            'base'=&gt;'*/*/schedule',
                            'params'=&gt;array('store'=&gt;$this-&gt;getRequest()-&gt;getParam('store'))
                        ),
                        'field'   =&gt; 'id'
                    ),
</pre>
<p>One last thing, at the end of the _prepareColumns function, change</p>
<pre class="brush: php; title: ; notranslate">
return parent::_prepareColumns();
</pre>
<p>by</p>
<pre class="brush: php; title: ; notranslate">
return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/">Magento &#8211; add a new action in grid</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony2 sonata custom CRUD template</title>
		<link>http://blog.adin.pro/2013-10-07/symfony2-sonata-custom-crud-template/</link>
		<comments>http://blog.adin.pro/2013-10-07/symfony2-sonata-custom-crud-template/#comments</comments>
		<pubDate>Mon, 07 Oct 2013 14:10:57 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Sonata]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Twig]]></category>
		<category><![CDATA[Override]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony2]]></category>
		<category><![CDATA[twig]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=306</guid>
		<description><![CDATA[<p>It is possible to change templates use by default. First, override the controller action method, in your AdminBundle/Controller/SecteurAdminController.php file The import thing on previous code is the render() fonction, the first parameter is the template to use. In our example, &#8230; <a href="http://blog.adin.pro/2013-10-07/symfony2-sonata-custom-crud-template/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2013-10-07/symfony2-sonata-custom-crud-template/">Symfony2 sonata custom CRUD template</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>It is possible to change templates use by default.</p>
<p>First, override the controller action method, in your AdminBundle/Controller/SecteurAdminController.php file</p>
<pre class="brush: php; title: ; notranslate">
 /**
     * return the Response object associated to the list action
     *
     * @return Response
     */
    public function listAction()
    {
        if (false === $this-&gt;admin-&gt;isGranted('LIST')) {
            throw new AccessDeniedException();
        }

        $datagrid = $this-&gt;admin-&gt;getDatagrid();
        $formView = $datagrid-&gt;getForm()-&gt;createView();

        // set the theme for the current Admin Form
        $this-&gt;get('twig')-&gt;getExtension('form')-&gt;setTheme($formView, $this-&gt;admin-&gt;getFilterTheme());

        //custom code from here
        $total = 0;
        $enable = 0;
        $new = 0;
        $site = $this-&gt;admin-&gt;site;

        $repository = $this-&gt;getDoctrine()-&gt;getRepository('TripixAdminBundle:Annonce');
        $total = $repository-&gt;getNombreAnnonceTotal($site);
        $enable = $repository-&gt;getNombreAnnonceEnabled($site);
        $new = $repository-&gt;getNombreAnnonceNew($site);



        return $this-&gt;render('TripixAdminBundle:CRUD:list_secteur.html.twig', array(
            'action'   =&gt; 'list',
            'form'     =&gt; $formView,
            'datagrid' =&gt; $datagrid,
            'total'     =&gt; $total,
            'enable'    =&gt; $enable,
            'new'       =&gt; $new,
        ));
    }
</pre>
<p>The import thing on previous code is the render() fonction, the first parameter is the template to use.<br />
In our example, the template file will be /AdminBundle/Ressources/view/CRUD/list_secteur.html.twig</p>
<p>You can use the /AdminBundle/Ressources/view/CRUD/base_secteur.html.twig file as example for your custom template.</p>
<p>Parent function to override on the controller are here : /vendor/bundles/Sonata/AdminBundle/Controller/CRUDController.php</p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2013-10-07/symfony2-sonata-custom-crud-template/">Symfony2 sonata custom CRUD template</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2013-10-07/symfony2-sonata-custom-crud-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
