vjt_onsalehorzcarousel - Version 1.0.2

Version Notes

Initial release

Download this release

Release Info

Developer VJ Templates
Extension vjt_onsalehorzcarousel
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/VJTemplates/OnSaleHorzCarousel/Block/Product/OnSale.php CHANGED
@@ -14,8 +14,9 @@ class VJTemplates_OnSaleHorzCarousel_Block_Product_OnSale extends Mage_Catalog_B
14
  public function getOnSaleProduct(){
15
 
16
  $product = Mage::getModel('catalog/product');
17
-
18
  $collection = $product->getCollection()
 
19
  ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
20
  ->addMinimalPrice()
21
  ->addFinalPrice()
@@ -23,7 +24,8 @@ class VJTemplates_OnSaleHorzCarousel_Block_Product_OnSale extends Mage_Catalog_B
23
  ->addAttributeToSelect('name')
24
  ->addAttributeToSelect('price')
25
  ->addAttributeToSelect('small_image')
26
- ->addAttributeToSelect('status')
 
27
  ->addAttributeToFilter("special_from_date", array("date" => true, "to" => date("m/d/y")))
28
  ->addAttributeToFilter("special_to_date", array("or"=> array(
29
  0 => array("date" => true, "from" => mktime(0, 0, 0, date("m"), date("d")+1, date("y"))),
@@ -33,28 +35,19 @@ class VJTemplates_OnSaleHorzCarousel_Block_Product_OnSale extends Mage_Catalog_B
33
  if($this->getCategoryId()) {
34
  $CategoryIds = explode(',',$this->getCategoryId());
35
  foreach($CategoryIds as $CategoryId) {
36
- if ($CategoryId->hasChildren()) {
37
- $AllChildren = Mage::getModel('catalog/category')->load($CategoryId)->getAllChildren($asArray = true);
38
- foreach($AllChildren as $Child) {
39
- $category = Mage::getModel('catalog/category')->load($Child);
40
- $collection->addCategoryFilter($category);
41
- }
42
- } else {
43
  $category = Mage::getModel('catalog/category')->load($CategoryId);
 
44
  $collection->addCategoryFilter($category);
45
- }
46
  }
47
- }
48
 
49
- $collection ->addStoreFilter();
50
- $current_categoryId = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
51
- $current_category = Mage::getModel('catalog/category')->load($current_categoryId);
52
  $collection->addCategoryFilter($current_category);
53
 
54
- if($this->getOrderby())
55
- $collection->getSelect()->order($this->getOrderby());
56
- if($this->getNumProducts())
57
- $collection->getSelect()->limit($this->getNumProducts());
58
 
59
  return $collection;
60
 
14
  public function getOnSaleProduct(){
15
 
16
  $product = Mage::getModel('catalog/product');
17
+ $storeId = Mage::app()->getStore()->getId();
18
  $collection = $product->getCollection()
19
+ ->addStoreFilter($storeId)
20
  ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
21
  ->addMinimalPrice()
22
  ->addFinalPrice()
24
  ->addAttributeToSelect('name')
25
  ->addAttributeToSelect('price')
26
  ->addAttributeToSelect('small_image')
27
+ ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
28
+ ->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
29
  ->addAttributeToFilter("special_from_date", array("date" => true, "to" => date("m/d/y")))
30
  ->addAttributeToFilter("special_to_date", array("or"=> array(
31
  0 => array("date" => true, "from" => mktime(0, 0, 0, date("m"), date("d")+1, date("y"))),
35
  if($this->getCategoryId()) {
36
  $CategoryIds = explode(',',$this->getCategoryId());
37
  foreach($CategoryIds as $CategoryId) {
 
 
 
 
 
 
 
38
  $category = Mage::getModel('catalog/category')->load($CategoryId);
39
+ $category->setIsAnchor(1);
40
  $collection->addCategoryFilter($category);
 
41
  }
42
+ }
43
 
44
+ $currentCategory = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
45
+ $current_category = Mage::getModel('catalog/category')->load($currentCategory);
46
+ $current_category->setIsAnchor(1);
47
  $collection->addCategoryFilter($current_category);
48
 
49
+ if($this->getOrderby()) $collection->getSelect()->order($this->getOrderby());
50
+ if($this->getNumProducts()) $collection->getSelect()->limit($this->getNumProducts());
 
 
51
 
52
  return $collection;
53
 
app/code/community/VJTemplates/OnSaleHorzCarousel/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <VJTemplates_OnSaleHorzCarousel>
5
- <version>1.0.1</version>
6
  </VJTemplates_OnSaleHorzCarousel>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <VJTemplates_OnSaleHorzCarousel>
5
+ <version>1.0.2</version>
6
  </VJTemplates_OnSaleHorzCarousel>
7
  </modules>
8
  <frontend>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>vjt_onsalehorzcarousel</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Show On Sale or Special Price Products in Horizontal Carousel Style</description>
11
  <notes>Initial release</notes>
12
  <authors><author><name>VJ Templates</name><user>vjtemplates</user><email>vjt@vjtemplates.com</email></author></authors>
13
- <date>2012-09-14</date>
14
- <time>17:20:14</time>
15
- <contents><target name="magecommunity"><dir name="VJTemplates"><dir name="OnSaleHorzCarousel"><dir name="Block"><dir name="Category"><file name="View.php" hash="25fa66a6deed29ea7ec4a65822f12b81"/></dir><dir name="Product"><file name="OnSale.php" hash="d70392ff4341f55e2595efd4ee65f14b"/></dir></dir><dir name="etc"><file name="config.xml" hash="8817aabcc060957de1144620c336724f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="vjtemplates"><file name="onsalehorzcarousel.xml" hash="798961bfc36f34271b68d1785cf5d756"/></dir></dir><dir name="template"><dir name="vjtemplates"><dir name="catalog"><dir name="product"><file name="onsale-horz-carousel.phtml" hash="4a16aee4e184da2f05fb485c07663408"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VJTemplates_OnSaleHorzCarousel.xml" hash="0aaa9f76b77b4b72af280d598eb21955"/></dir></target><target name="mage"><dir name="js"><dir name="jquery"><file name="jquery-1.6.4.min.js" hash="0bd074f6e49da04536b3ce289e3f7448"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="vjtemplates"><dir name="css"><file name="onsale-horz-carousel.css" hash="42fa8ce56fe62e2bbf1050cf23d8c5ce"/></dir><dir name="images"><file name="next-horizontal.png" hash="fa5bfea6029803d4382e257f3e407269"/><file name="prev-horizontal.png" hash="e9e56e2851122f2c3322e3f36841a66b"/></dir><dir name="js"><file name="onsale-carousel.js" hash="678439bb3993ebf66629e23b59d8c811"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>vjt_onsalehorzcarousel</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
10
  <description>Show On Sale or Special Price Products in Horizontal Carousel Style</description>
11
  <notes>Initial release</notes>
12
  <authors><author><name>VJ Templates</name><user>vjtemplates</user><email>vjt@vjtemplates.com</email></author></authors>
13
+ <date>2012-09-26</date>
14
+ <time>15:52:58</time>
15
+ <contents><target name="magecommunity"><dir name="VJTemplates"><dir name="OnSaleHorzCarousel"><dir name="Block"><dir name="Category"><file name="View.php" hash="25fa66a6deed29ea7ec4a65822f12b81"/></dir><dir name="Product"><file name="OnSale.php" hash="4cda9649d0edc17c02c010c4997dbbef"/></dir></dir><dir name="etc"><file name="config.xml" hash="6844fa9532499fbd9fb38e6982d0db15"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="vjtemplates"><file name="onsalehorzcarousel.xml" hash="798961bfc36f34271b68d1785cf5d756"/></dir></dir><dir name="template"><dir name="vjtemplates"><dir name="catalog"><dir name="product"><file name="onsale-horz-carousel.phtml" hash="4a16aee4e184da2f05fb485c07663408"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VJTemplates_OnSaleHorzCarousel.xml" hash="0aaa9f76b77b4b72af280d598eb21955"/></dir></target><target name="mage"><dir name="js"><dir name="jquery"><file name="jquery-1.6.4.min.js" hash="0bd074f6e49da04536b3ce289e3f7448"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="vjtemplates"><dir name="css"><file name="onsale-horz-carousel.css" hash="42fa8ce56fe62e2bbf1050cf23d8c5ce"/></dir><dir name="images"><file name="next-horizontal.png" hash="fa5bfea6029803d4382e257f3e407269"/><file name="prev-horizontal.png" hash="e9e56e2851122f2c3322e3f36841a66b"/></dir><dir name="js"><file name="onsale-carousel.js" hash="678439bb3993ebf66629e23b59d8c811"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>