-1

Please can anyone help me with step to step on how to create an observer on this page: Hide completed orders from sales/orders I have created observer.xml in app/etc/modules/ with the code below:

<events>
    <sales_order_grid_collection_load_before>
        <observers>
            <vendor_module_salesgrid>
                <model>module/observer</model>
                <method>filterGrid</method>
            </vendor_module_salesgrid>
        </observers>
    </sales_order_grid_collection_load_before>
</events>

and also observer.php is created in app/etc/modules/model with the code below:

<?php
class Vendor_Module_Model_Observer 
{
    public function filterGrid(Varien_Event_Observer $observer)
    {
        $collection = $observer->getOrderGridCollection();
        $collection->addFieldToFilter('status',array('neq', 'complete'));
    }
}

but I couldn't get it to work Thank you.

Update:

For some reason it did not work. I did as you explained then created hide_complete.xml in the app/etc/modules

<?xml version="1.0"?>
<config>
    <modules>
        <Hide_Complete>
            <active>true</active>
            <codePool>local</codePool>
        </Hide_Complete>
    </modules>
</config>

Is there something that I am missing my folder path is: app/code/local/Hide/Complete Thank you

  • I have added the issue that I have with it. Thank you – Adeola Adeoti Aug 11 '17 at 0:13
  • Can you please post your complete code? – sv3n Aug 11 '17 at 0:15
  • Can you please addfull pathes to your files? Here was somthing like observer.xml??? – sv3n Aug 11 '17 at 0:25
  • Those are actually the paths I used, I am not sure if I am correct. Your help will highly be appreciated. – Adeola Adeoti Aug 11 '17 at 0:28
  • Let us continue this discussion in chat. – Adeola Adeoti Aug 11 '17 at 0:30
1

Your files are just in the wrong directories ... just create an extension and

  1. add your Your_Module.xml to app/etc/modules/
  2. your code from observer.xml belongs to app/code/POOL/Your/Module/etc/config.xml
  3. and Òbserver.php goes to app/code/POOL/Your/Module/Model/

Not the answer you're looking for? Browse other questions tagged or ask your own question.