Web4pro_Stockstatus - Version 1.0.1

Version Notes

Version number: 1.0.1

Download this release

Release Info

Developer Sergey Repin
Extension Web4pro_Stockstatus
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/community/Web4pro/Stockstatus/Helper/Data.php CHANGED
@@ -57,21 +57,17 @@ class Web4pro_Stockstatus_Helper_Data extends Mage_Core_Helper_Abstract
57
  */
58
  public function getNewStockStatus($product)
59
  {
60
- $newStockStatus = $this->getDefaultStockStatus($product);
61
  $customStockStatus = $this->getCustomStockStatus($product);
62
  if ($this->isShowStockLevel() && $product->getStockItem()->getQty()) {
63
- $newStockStatus = $this->__('%s in stock', (int)$product->getStockItem()->getQty());
64
- return $newStockStatus;
65
- }
66
- if (empty($customStockStatus)){
67
- return $newStockStatus;
68
  }
69
  if ($this->isDefaultStockStatusHidden($product)){
70
- $newStockStatus = $customStockStatus;
71
  } else {
72
- $newStockStatus = $newStockStatus . ' ' . $customStockStatus;
73
  }
74
- return $newStockStatus;
75
  }
76
 
77
 
57
  */
58
  public function getNewStockStatus($product)
59
  {
60
+ $defaultStockStatus = $this->getDefaultStockStatus($product);
61
  $customStockStatus = $this->getCustomStockStatus($product);
62
  if ($this->isShowStockLevel() && $product->getStockItem()->getQty()) {
63
+ $levelStockStatus = $this->__('%s in stock', (int)$product->getStockItem()->getQty());
64
+ return $levelStockStatus . ' ' . $customStockStatus;
 
 
 
65
  }
66
  if ($this->isDefaultStockStatusHidden($product)){
67
+ return $customStockStatus;
68
  } else {
69
+ return $defaultStockStatus . ' ' . $customStockStatus;
70
  }
 
71
  }
72
 
73
 
app/code/community/Web4pro/Stockstatus/Model/Observer.php CHANGED
@@ -71,6 +71,8 @@ class Web4pro_Stockstatus_Model_Observer
71
  break;
72
 
73
  case $block instanceof Mage_Catalog_Block_Product_List:
 
 
74
  if ($this->_helper->isCustomStockStatusOnProductListPage()){
75
  foreach ($block->getLoadedProductCollection() as $item){
76
  $stockstatuses[] = $this->_helper->getNewStockStatus($item);
71
  break;
72
 
73
  case $block instanceof Mage_Catalog_Block_Product_List:
74
+ $collection = $block->getLoadedProductCollection();
75
+ Mage::getSingleton('cataloginventory/stock')->addItemsToProducts($collection);
76
  if ($this->_helper->isCustomStockStatusOnProductListPage()){
77
  foreach ($block->getLoadedProductCollection() as $item){
78
  $stockstatuses[] = $this->_helper->getNewStockStatus($item);
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Web4pro_Stockstatus</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.web4pro.net/license.txt">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Replace default stock statuses with text or configure the number of products available in stock. </summary>
10
  <description>With this module you are able to set a custom "stock status" in the products edit page for each and every simple product.</description>
11
- <notes>Version number: 1.0.0</notes>
12
  <authors><author><name>Sergey Repin</name><user>srepin</user><email>srepin@corp.web4pro.com.ua</email></author></authors>
13
- <date>2015-04-06</date>
14
- <time>10:48:54</time>
15
- <contents><target name="magecommunity"><dir name="Web4pro"><dir name="Stockstatus"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="View"><dir name="Type"><dir name="Bundle"><dir name="Option"><file name="Checkbox.php" hash="c4099a200a945441d73bd05b6e2a380d"/><file name="Multi.php" hash="3833051ccc5e2fa8d0d889370c7e7e88"/><file name="Radio.php" hash="a84228b8ebcc1762c7ae5c10ffb2b7cb"/><file name="Select.php" hash="aa9ead2a4caca487e6a5ac8c057a2964"/></dir><file name="Option.php" hash="6f89953e7e34a048211d99b2fa935471"/></dir><file name="Configurable.php" hash="571a10f0b1daae80b058d0c187687bd9"/></dir></dir></dir></dir><file name="Stockstatus.php" hash="617ab7df4874c3e1c84bb7f7f4d40ab8"/></dir><dir name="Helper"><file name="Data.php" hash="62ecdd40d0987c06ef08d659fd58a3ba"/></dir><dir name="Model"><file name="Observer.php" hash="9637d236d35bc2e6880560077c2afa5b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4483da36b754d5ffd4bcef726bff7ef1"/><file name="config.xml" hash="d034c1a039e9ba089c268c65681a55ca"/><file name="system.xml" hash="cf601c69310e26834d58d48afadfcb9d"/></dir><dir name="sql"><dir name="web4pro_stockstatus_setup"><file name="install-1.0.0.php" hash="18a87188f782107b5d99a334444cbfbf"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="web4pro_stockstatus.xml" hash="73954398b61e7bb2fd93a998b43b5a77"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Web4pro_Stockstatus.xml" hash="c7a0ae32162bb27eed946ae5e00f6b4d"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Web4pro_Stockstatus.csv" hash="ef575ef3b7764b8e9d4ef163b248e9b5"/></dir></target><target name="mage"><dir name="js"><dir name="web4pro"><dir name="stockstatus"><file name="stockstatus.js" hash="45816dd271c1bf2fdb4ac9159062c645"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.3.0</min><max>5.5.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Web4pro_Stockstatus</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.web4pro.net/license.txt">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Replace default stock statuses with text or configure the number of products available in stock. </summary>
10
  <description>With this module you are able to set a custom "stock status" in the products edit page for each and every simple product.</description>
11
+ <notes>Version number: 1.0.1</notes>
12
  <authors><author><name>Sergey Repin</name><user>srepin</user><email>srepin@corp.web4pro.com.ua</email></author></authors>
13
+ <date>2015-04-08</date>
14
+ <time>13:42:03</time>
15
+ <contents><target name="magecommunity"><dir name="Web4pro"><dir name="Stockstatus"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="View"><dir name="Type"><dir name="Bundle"><dir name="Option"><file name="Checkbox.php" hash="c4099a200a945441d73bd05b6e2a380d"/><file name="Multi.php" hash="3833051ccc5e2fa8d0d889370c7e7e88"/><file name="Radio.php" hash="a84228b8ebcc1762c7ae5c10ffb2b7cb"/><file name="Select.php" hash="aa9ead2a4caca487e6a5ac8c057a2964"/></dir><file name="Option.php" hash="6f89953e7e34a048211d99b2fa935471"/></dir><file name="Configurable.php" hash="571a10f0b1daae80b058d0c187687bd9"/></dir></dir></dir></dir><file name="Stockstatus.php" hash="617ab7df4874c3e1c84bb7f7f4d40ab8"/></dir><dir name="Helper"><file name="Data.php" hash="94d3a5028f64be9f5f4f4a50aafb9711"/></dir><dir name="Model"><file name="Observer.php" hash="d6307b6e09b2c1624880eae27d193ca9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4483da36b754d5ffd4bcef726bff7ef1"/><file name="config.xml" hash="d034c1a039e9ba089c268c65681a55ca"/><file name="system.xml" hash="cf601c69310e26834d58d48afadfcb9d"/></dir><dir name="sql"><dir name="web4pro_stockstatus_setup"><file name="install-1.0.0.php" hash="18a87188f782107b5d99a334444cbfbf"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="web4pro_stockstatus.xml" hash="73954398b61e7bb2fd93a998b43b5a77"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Web4pro_Stockstatus.xml" hash="c7a0ae32162bb27eed946ae5e00f6b4d"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Web4pro_Stockstatus.csv" hash="ef575ef3b7764b8e9d4ef163b248e9b5"/></dir></target><target name="mage"><dir name="js"><dir name="web4pro"><dir name="stockstatus"><file name="stockstatus.js" hash="45816dd271c1bf2fdb4ac9159062c645"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>5.6.7</max></php></required></dependencies>
18
  </package>