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

Commit

Permalink
Merge branch 'release/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashley Wright committed Oct 1, 2015
2 parents a23037e + 3328c6a commit 99d90fc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getCategory() {
public function getProductCollection() {
$collection = $this->getData('product_collection');
if (is_null($collection)) {
$collection = Mage::getModel('catalog/product')->getCollection();
$collection = Mage::getResourceModel('catalog/product_collection');

$this->applyFilter($collection);

Expand All @@ -90,6 +90,9 @@ public function maintain($products = array()) {
return;
}

$originalStore = Mage::app()->getStore();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

$collection = clone $this->getProductCollection();

// Remove products not matching the filter anymore
Expand Down Expand Up @@ -122,6 +125,8 @@ public function maintain($products = array()) {
$insert = $select->insertIgnoreFromSelect($this->getCategoryProductTable(), array('category_id', 'product_id', 'position'));

$this->getConnection()->query($insert);

Mage::app()->setCurrentStore($originalStore);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Meanbee_AutoCategories>
<version>1.0.0</version>
<version>1.0.1</version>
</Meanbee_AutoCategories>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ protected function applyFilter($collection) {
$now = $this->getCurrentDate()->toString('YYYY-MM-dd HH:mm:ss');

$collection
->addAttributeToFilter("price", array("notnull" => true))
->addAttributeToFilter("special_price", array("notnull" => true))
->addAttributeToFilter("special_price", array("lt" => new Zend_Db_Expr("at_price.value")))
->addAttributeToFilter("special_from_date", array(
array("null" => true),
array("lteq" => $now)
Expand Down
2 changes: 1 addition & 1 deletion src/app/code/community/Meanbee/SaleCategory/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Meanbee_SaleCategory>
<version>1.0.0</version>
<version>1.0.1</version>
</Meanbee_SaleCategory>
</modules>
<global>
Expand Down

0 comments on commit 99d90fc

Please sign in to comment.