Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

fix sort value resetting #2

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ public function updateQtyOrdered()
* - Avoids nulls being shown before all products when ordered ascendingly
*/
$productCollection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter(Meanbee_BestSellerSort_Helper_Data::ATTRIBUTE_NAME_QTY_ORDERED,
array('neq' => 0)
);
->addAttributeToSelect(array(Meanbee_BestSellerSort_Helper_Data::ATTRIBUTE_NAME_QTY_ORDERED));

foreach($productCollection as $product) {
foreach ($productCollection as $product)
{
$product->setData(Meanbee_BestSellerSort_Helper_Data::ATTRIBUTE_NAME_QTY_ORDERED, 0);
$resource->saveAttribute($product, Meanbee_BestSellerSort_Helper_Data::ATTRIBUTE_NAME_QTY_ORDERED);
}
Expand Down