vjt_onsalevertcarousel - Version 1.0.3

Version Notes

Initial Release

Download this release

Release Info

Developer VJ Templates
Extension vjt_onsalevertcarousel
Version 1.0.3
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.3

app/code/community/VJTemplates/OnSaleVertCarousel/Block/Product/OnSale.php CHANGED
@@ -9,53 +9,46 @@
9
  # Websites: http://www.vjtemplates.com
10
  #------------------------------------------------------------------------
11
  */
12
- class VJTemplates_OnSaleVertCarousel_Block_Product_OnSale extends Mage_Catalog_Block_Product_List
13
- {
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()
22
- ->addTaxPercents()
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"))),
30
- 1 => array("is" => new Zend_Db_Expr("null")))
31
- ), "left");
 
 
32
 
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
 
61
  }
9
  # Websites: http://www.vjtemplates.com
10
  #------------------------------------------------------------------------
11
  */
12
+ class VJTemplates_OnSaleVertCarousel_Block_Product_OnSale extends Mage_Catalog_Block_Product_List {
13
+
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()
23
+ ->addTaxPercents()
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"))),
32
+ 1 => array("is" => new Zend_Db_Expr("null")))
33
+ ), "left");
34
 
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
 
54
  }
app/code/community/VJTemplates/OnSaleVertCarousel/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <VJTemplates_OnSaleVertCarousel>
5
- <version>1.0.2</version>
6
  </VJTemplates_OnSaleVertCarousel>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <VJTemplates_OnSaleVertCarousel>
5
+ <version>1.0.3</version>
6
  </VJTemplates_OnSaleVertCarousel>
7
  </modules>
8
  <frontend>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>vjt_onsalevertcarousel</name>
4
- <version>1.0.2</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 Vertical 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:21:49</time>
15
- <contents><target name="magecommunity"><dir name="VJTemplates"><dir name="OnSaleVertCarousel"><dir name="Block"><dir name="Category"><file name="View.php" hash="85c92a409c24d6ae75a709b6ccedc188"/></dir><dir name="Product"><file name="OnSale.php" hash="bb38ae2bae1dffc406f7de797dd0fd66"/></dir></dir><dir name="etc"><file name="config.xml" hash="ba3db2eaec07fbad814338c4dc9fad1f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="vjtemplates"><file name="onsalevertcarousel.xml" hash="c78655c26a88cc8db7bceb5fc761929c"/></dir></dir><dir name="template"><dir name="vjtemplates"><dir name="catalog"><dir name="product"><file name="onsale-vert-carousel.phtml" hash="4da9ee56d7d3bf4b01046643673b7f1f"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VJTemplates_OnSaleVertCarousel.xml" hash="5c5835c90953dbe3288def3387ac67b1"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="vjtemplates"><dir name="css"><file name="onsale-vert-carousel.css" hash="3cf2277f0b68e9c0ddbe87c1909aa5df"/></dir><dir name="images"><file name="next-vertical.png" hash="212fd0ed9d02dd77508cbc398e6b36ea"/><file name="prev-vertical.png" hash="360f02103258cc26eea3683da5605e89"/></dir><dir name="js"><file name="onsale-carousel.js" hash="678439bb3993ebf66629e23b59d8c811"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="jquery"><file name="jquery-1.6.4.min.js" hash="0bd074f6e49da04536b3ce289e3f7448"/></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_onsalevertcarousel</name>
4
+ <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
10
  <description>Show On Sale or Special Price Products in Vertical 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:53:26</time>
15
+ <contents><target name="magecommunity"><dir name="VJTemplates"><dir name="OnSaleVertCarousel"><dir name="Block"><dir name="Category"><file name="View.php" hash="85c92a409c24d6ae75a709b6ccedc188"/></dir><dir name="Product"><file name="OnSale.php" hash="c28f3366033ae183a9ebcc88e13b1e74"/></dir></dir><dir name="etc"><file name="config.xml" hash="4fc57b68643f4d75baf0a864dd76b6d5"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="vjtemplates"><file name="onsalevertcarousel.xml" hash="c78655c26a88cc8db7bceb5fc761929c"/></dir></dir><dir name="template"><dir name="vjtemplates"><dir name="catalog"><dir name="product"><file name="onsale-vert-carousel.phtml" hash="4da9ee56d7d3bf4b01046643673b7f1f"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VJTemplates_OnSaleVertCarousel.xml" hash="5c5835c90953dbe3288def3387ac67b1"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="vjtemplates"><dir name="css"><file name="onsale-vert-carousel.css" hash="3cf2277f0b68e9c0ddbe87c1909aa5df"/></dir><dir name="images"><file name="next-vertical.png" hash="212fd0ed9d02dd77508cbc398e6b36ea"/><file name="prev-vertical.png" hash="360f02103258cc26eea3683da5605e89"/></dir><dir name="js"><file name="onsale-carousel.js" hash="678439bb3993ebf66629e23b59d8c811"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="jquery"><file name="jquery-1.6.4.min.js" hash="0bd074f6e49da04536b3ce289e3f7448"/></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>