title: Get last 7 days best selling items? Magento 1.9
body: <p>I'm trying to find a way how to display the bestsellers items in Magento 1.9.</p>
  
  <p>The widget is working correctly, but the issue is that it display's all time products.</p>
  
  <p>What I'm looking for is to get the data from the last 7 day's and display the best sellers from that period of time.</p>
  
  <p>Can someone help me with it? Or point me in the correct direction?</p>
  
  <p>Thank you!</p>
  
  <p><strong>Code update:</strong></p>
  
  <pre><code>    &lt;?php class Bigdrop_ProductSlider_Block_Bestsellers extends Bigdrop_ProductSlider_Block_Slider_Abstract {
      protected $_code = 'bestsellers';
  
      /**
       * Retrieves sort by param
       *
       * @return string
       */
      protected function _getSortByParam()
      {
          return 'ordered_qty';
      }
  
      /**
       * Preparing product collection of the current Slider
       *
       * @return Mage_Catalog_Model_Resource_Product_Collection|Mage_Reports_Model_Resource_Product_Collection
       */
      protected function _prepareSliderCollection()
      {
          $collection = Mage::getResourceModel('reports/product_collection')
              -&gt;addOrderedQty();
  
          if (Mage::helper('catalog/product_flat')-&gt;isEnabled()) {
              $collection-&gt;getSelect()
                  -&gt;joinInner(array(
                      'e2' =&gt; 'catalog_product_flat_' . Mage::app()-&gt;getStore()-&gt;getId()
                  ), 'e2.entity_id = e.entity_id');
          } else {
              $this-&gt;assignAttributes($collection);
          }
  
          $this-&gt;_applyStockVisibilityFilter($collection);
          $this-&gt;_setOrderToCollection($collection);
          $collection-&gt;getSelect()-&gt;limit($this-&gt;_getLimit());
  
          return $collection;
      }
  }
  </code></pre>