0

We had a lot of price changes recently, and I just changed the prices on our basic 1.9 magento store. Now I wish to be able to sort out products based on: latest price change/ latest changed by date/time. So I can go through the list and see if they were all changed correctly. How should I proceed?

  1. Captain Obvious: hire a programmer/web dev.
  2. I guess this is similar to this topic: Magento - Sort by Date Added, which based on the answers can be made without changing core files.

Yes you guessed correctly, I wish to use option 2. Now can this be done simply?

I'm not a coder or web dev, but I do have basic web knowledge and ftp access.

SharoFF
  • 1
  • 1

2 Answers2

0

In Your collection use sort by updated_at

Example

$collection = Mage::getResourceModel('catalog/product_collection');
$collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
$collection->addAttributeToSort('updated_at', 'desc');
0

As you only want to perform a verification, it can be done on the admin side.

You can display the Updated Time in the Catalog Product Grid.

In a custom module, let's set this in config.xml :

<config>
    <global>
        <blocks>
            <adminhtml>
               <rewrite>
                   <catalog_product_grid>Vendor_Module_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
               </rewrite>
           </adminhtml>
        </blocks>
    </global>
</config>

Then in app/code/local/<VENDOR>/<MODULE>/Block/Adminhtml/Catalog/Product/Grid.php :

<?php

class Vendor_Module_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
{

    public function setCollection($collection)
    {
        /* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
        // IF the attribute `updated_at` is already in the collection,
        // THEN you can remove this function,
        // ELSE uncomment this line :
        // $collection->addAttributeToSelect('updated_at');

        parent::setCollection($collection);
    }

    protected function _prepareColumns()
    {
        $store = $this->_getStore();
        // after column price :
        $this->addColumnAfter('updated_at',
            array(
                'header'=> Mage::helper('sales')->__('Updated At'),
                'header_css_class'  => 'a-center',
                'type'  => 'datetime',
                'index' => 'updated_at',
                'sortable'=>true,
            ),
            'price'
         );

        return parent::_prepareColumns();
    }
}

I haven't tested, but it should be working.

Then, you will be able to sort the grid on this new column.

DependencyHell
  • 1,027
  • 15
  • 22