2016-09-03 11 views

答えて

2
You can use catalog_product_collection_load_before event. 
And in the observer: 

public function modifyProductCollection(Varien_Event_Observer $observer) { 
    //catalog_product_collection_load_before 
    $collection = $observer->getCollection(); 

    $collection->getSelect()->joinLeft(
       array('_inventory_table' => $collection->getTable('cataloginventory/stock_item')), 
       "_inventory_table.product_id = e.entity_id", 
       array('is_in_stock') 
      ) 
      ->order('is_in_stock DESC') 
      ->order('created_at DESC'); 
} 
+0

ありがとうございました。 –

関連する問題