Daffodil_Stock - Version 1.0.0.2

Version Notes

First Release

Download this release

Release Info

Developer Daffodil Software
Extension Daffodil_Stock
Version 1.0.0.2
Comparing to
See all releases


Code changes from version 1.0.0.1 to 1.0.0.2

app/code/local/Daffodil/Stock/Block/Stock.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Daffodil_Stock_Block_Stock extends Mage_Core_Block_Template {
4
+
5
+ public function getQuantity() {
6
+ $_product = Mage::registry('current_product');
7
+ $_invAmt = (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
8
+ return $_invAmt;
9
+ }
10
+
11
+ public function getStoreconfig(){
12
+ $mystock = Mage::getStoreConfig('stock/all_settings/stock_items');
13
+ $lowmessage = Mage::getStoreConfig('stock/all_settings/stock_msg');
14
+ $stockValues = array('mystock'=>$mystock, 'lowmessage'=>$lowmessage);
15
+ return $stockValues;
16
+ }
17
+
18
+ }
19
+
20
+ ?>
app/code/local/Daffodil/Stock/Block/Stock.php~ ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mymodule_Helloworld_Block_Myblock extends Mage_Core_Block_Template {
3
+
4
+ public function methodblock() {
5
+ return 'I am inside custom block !!';
6
+ }
7
+ public function getContent() {
8
+ $collection = Mage::getModel('helloworld/helloworld')->getCollection();
9
+ $test = array_keys($collection->getFirstItem()->getData());
10
+
11
+ foreach ($test as $key){ // loop through all the keys (fname, lname, email...
12
+ foreach ($collection as $obj){//loop throught each object
13
+ print_r($obj->getData($key));//get the value for a speficic key.
14
+ }
15
+ }
16
+ }
17
+
18
+ }
19
+
20
+ ?>
app/code/local/Daffodil/Stock/etc/config.xml CHANGED
@@ -1,10 +1,10 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <modules>
4
- <Daffodil_Stock>
5
- <version>0.1.0</version>
6
- </Daffodil_Stock>
7
- </modules>
8
  <frontend>
9
  <routers>
10
  <stock>
@@ -23,14 +23,19 @@
23
  </updates>
24
  </layout>
25
  </frontend>
26
- <global>
27
- <helpers>
28
- <stock>
29
- <class>Daffodil_Stock_Helper</class>
30
- </stock>
31
- </helpers>
32
- </global>
33
- <adminhtml>
 
 
 
 
 
34
  <acl>
35
  <resources>
36
  <admin>
@@ -51,13 +56,13 @@
51
  </resources>
52
  </acl>
53
  </adminhtml>
54
- <default>
55
- <stock>
56
- <all_settings>
57
- <enabled>1</enabled>
58
- <stock_msg>Please hurry only few products are left!!!</stock_msg>
59
- <stock_items>8</stock_items>
60
- </all_settings>
61
- </stock>
62
- </default>
63
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <modules>
4
+ <Daffodil_Stock>
5
+ <version>0.1.0</version>
6
+ </Daffodil_Stock>
7
+ </modules>
8
  <frontend>
9
  <routers>
10
  <stock>
23
  </updates>
24
  </layout>
25
  </frontend>
26
+ <global>
27
+ <helpers>
28
+ <stock>
29
+ <class>Daffodil_Stock_Helper</class>
30
+ </stock>
31
+ </helpers>
32
+ <blocks>
33
+ <stock>
34
+ <class>Daffodil_Stock_Block</class>
35
+ </stock>
36
+ </blocks>
37
+ </global>
38
+ <adminhtml>
39
  <acl>
40
  <resources>
41
  <admin>
56
  </resources>
57
  </acl>
58
  </adminhtml>
59
+ <default>
60
+ <stock>
61
+ <all_settings>
62
+ <enabled>1</enabled>
63
+ <stock_msg>Please hurry only few products are left!!!</stock_msg>
64
+ <stock_items>8</stock_items>
65
+ </all_settings>
66
+ </stock>
67
+ </default>
68
  </config>
app/code/local/Daffodil/Stock/etc/system.xml CHANGED
@@ -25,7 +25,7 @@
25
  <show_in_store>0</show_in_store>
26
  <fields>
27
  <enabled translate="label">
28
- <label>Enable Feature Product Extension</label>
29
  <frontend_type>select</frontend_type>
30
  <source_model>adminhtml/system_config_source_yesno</source_model>
31
  <sort_order>1</sort_order>
25
  <show_in_store>0</show_in_store>
26
  <fields>
27
  <enabled translate="label">
28
+ <label>Enable low product quantity message Extension</label>
29
  <frontend_type>select</frontend_type>
30
  <source_model>adminhtml/system_config_source_yesno</source_model>
31
  <sort_order>1</sort_order>
app/design/frontend/default/default/layout/stock.xml CHANGED
@@ -1,18 +1,24 @@
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
- <default>
4
- <reference name="head">
5
- <action method="addCss"><stylesheet>css/stock.css</stylesheet></action>
6
-
7
- </reference>
8
- </default>
9
- <catalog_product_view translate="label">
 
10
  <reference name="product.info.extrahint" >
11
  <block type="core/template" name="stock">
12
- <action method="setTemplate" ifconfig="stock/all_settings/enabled">
13
- <template>stock/stock.phtml</template>
14
- </action>
15
  </block>
16
- </reference>
17
- </catalog_product_view>
18
- </layout>
 
 
 
 
 
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss">
6
+ <stylesheet>css/stock.css</stylesheet>
7
+ </action>
8
+ </reference>
9
+ </default>
10
+ <catalog_product_view translate="label">
11
  <reference name="product.info.extrahint" >
12
  <block type="core/template" name="stock">
13
+ <action method="setTemplate" ifconfig="stock/all_settings/enabled">
14
+ <template>stock/stock.phtml</template>
15
+ </action>
16
  </block>
17
+ </reference>
18
+ </catalog_product_view>
19
+ <catalog_product_view>
20
+ <reference name="content">
21
+ <block type="stock/stock" name="stock" as="stock-item" template="stock/stock.phtml" />
22
+ </reference>
23
+ </catalog_product_view>
24
+ </layout>
app/design/frontend/default/default/template/stock/stock.phtml CHANGED
@@ -1,20 +1,17 @@
1
-
2
- <?php
3
- /*
4
- * Stock Management Extension Developed by Daffodil S/w Ltd.
5
- */
6
  ?>
7
- <?php
8
- $mystock=Mage::getStoreConfig('stock/all_settings/stock_items');
9
- $lowmessage=Mage::getStoreConfig('stock/all_settings/stock_msg');
10
- $_product = Mage::registry('current_product');
11
- $_product = Mage::registry('current_product');
12
- $__manStock = $_product->getStockItem()->getManageStock();
13
- $__invAmt = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
14
- if ($mystock >=$__invAmt)
15
- {
16
- echo '<div class="stockmsg" >'.$lowmessage.'</div>';
17
- }
18
  ?>
19
-
20
-
1
+ <?php
2
+ /*
3
+ * Stock Management Extension Developed by Daffodil S/w Ltd.
4
+ */
 
5
  ?>
6
+ <?php
7
+ $_item = $this->getStoreconfig();
8
+ $mystock = $_item['mystock'];
9
+ $lowmessage = $_item['lowmessage'];
10
+ $_invAmt = $this->getQuantity();
11
+ if ($mystock >= $_invAmt) {
12
+ ?>
13
+ <div class="stockmsg" >
14
+ <?php echo $lowmessage ?>
15
+ </div>
16
+ <?php }
17
  ?>
 
 
app/design/frontend/rwd/default/layout/stock.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss">
6
+ <stylesheet>css/stock.css</stylesheet>
7
+ </action>
8
+ </reference>
9
+ </default>
10
+ <catalog_product_view translate="label">
11
+ <reference name="product.info.extrahint" >
12
+ <block type="core/template" name="stock">
13
+ <action method="setTemplate" ifconfig="stock/all_settings/enabled">
14
+ <template>stock/stock.phtml</template>
15
+ </action>
16
+ </block>
17
+ </reference>
18
+ </catalog_product_view>
19
+ <catalog_product_view>
20
+ <reference name="content">
21
+ <block type="stock/stock" name="stock" as="stock-item" template="stock/stock.phtml" />
22
+ </reference>
23
+ </catalog_product_view>
24
+ </layout>
app/design/frontend/rwd/default/template/stock/stock.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Stock Management Extension Developed by Daffodil S/w Ltd.
4
+ */
5
+ ?>
6
+ <?php
7
+ $_item = $this->getStoreconfig();
8
+ $mystock = $_item['mystock'];
9
+ $lowmessage = $_item['lowmessage'];
10
+ $_invAmt = $this->getQuantity();
11
+ if ($mystock >= $_invAmt) {
12
+ ?>
13
+ <div class="stockmsg" >
14
+ <?php echo $lowmessage ?>
15
+ </div>
16
+ <?php }
17
+ ?>
package.xml CHANGED
@@ -1,20 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Daffodil_Stock</name>
4
- <version>1.0.0.1</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Show message if quantity of product is low.</summary>
10
- <description>This Extension provide us facility to show message if quantity of product is less than a certain amount.&#xD;
11
- For Example if quantity is less than 10 then it shows message like "Please hurry only few products are left."&#xD;
12
  We can set quantity of products from admin. If product quantity is equl or less than set quantity then it start showing message in product detail page.</description>
13
  <notes>First Release</notes>
14
  <authors><author><name>Daffodil Software</name><user>daffodilsw</user><email>ashish.mittal@daffodilsw.com</email></author></authors>
15
- <date>2012-12-28</date>
16
- <time>12:08:06</time>
17
- <contents><target name="magelocal"><dir name="Daffodil"><dir name="Stock"><dir name="Helper"><file name="Data.php" hash="aebfc2d3ea2566f6ffd6677eeb3c1286"/></dir><dir name="etc"><file name="config.xml" hash="6a480fa8c3b9b197c60e16fb18e043f2"/><file name="config.xml~" hash="0557195d1dd78f42345bd8c2f5b2880d"/><file name="system.xml" hash="fd6d96bbc3a7d8b5f5fe8f741b036794"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="stock.xml" hash="c8842ac5705097400625dae3eb71cefb"/></dir><dir name="template"><dir name="stock"><file name="stock.phtml" hash="a15cc194ec6f4893915ccbb89829ab13"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Daffodil_Stock.xml" hash="9a9fbf436a4bd167b79390a53aa8a927"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="stock.css" hash="24cd510cf49f058261f91b62653839a5"/></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.7</max></package></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Daffodil_Stock</name>
4
+ <version>1.0.0.2</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Show message if quantity of product is low.</summary>
10
+ <description>This Extension provide us facility to show message if quantity of product is less than a certain amount.&amp;#xD;&#xD;
11
+ For Example if quantity is less than 10 then it shows message like "Please hurry only few products are left."&amp;#xD;&#xD;
12
  We can set quantity of products from admin. If product quantity is equl or less than set quantity then it start showing message in product detail page.</description>
13
  <notes>First Release</notes>
14
  <authors><author><name>Daffodil Software</name><user>daffodilsw</user><email>ashish.mittal@daffodilsw.com</email></author></authors>
15
+ <date>2014-09-08</date>
16
+ <time>13:09:56</time>
17
+ <contents><target name="magelocal"><dir name="Daffodil"><dir name="Stock"><dir name="Block"><file name="Stock.php" hash="a667f413c6d2f4aca71cf851b25766fc"/><file name="Stock.php~" hash="d7b13023e008a0a0c22875c355a91270"/></dir><dir name="Helper"><file name="Data.php" hash="aebfc2d3ea2566f6ffd6677eeb3c1286"/></dir><dir name="etc"><file name="config.xml" hash="6868f640ed25bec95774830a8db53406"/><file name="config.xml~" hash="0557195d1dd78f42345bd8c2f5b2880d"/><file name="system.xml" hash="2ba0d5f64d1ebafb448c3e3865b9c157"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="stock.xml" hash="69e6da22b9295a644087813b5cd5ec8a"/></dir><dir name="template"><dir name="stock"><file name="stock.phtml" hash="7932e4defa3d7dbc7b25036d58d3ac93"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="stock.xml" hash="69e6da22b9295a644087813b5cd5ec8a"/></dir><dir name="template"><dir name="stock"><file name="stock.phtml" hash="7932e4defa3d7dbc7b25036d58d3ac93"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="stock.css" hash="24cd510cf49f058261f91b62653839a5"/></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="css"><file name="stock.css" hash="24cd510cf49f058261f91b62653839a5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Daffodil_Stock.xml" hash="9a9fbf436a4bd167b79390a53aa8a927"/></dir></target></contents>
18
  <compatible/>
19
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.9</max></package></required></dependencies>
20
  </package>
skin/frontend/rwd/default/css/stock.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ .stockmsg{
3
+ background: none repeat scroll 0 0 #808000;
4
+ border: 1px solid #CCCCCC;
5
+ border-radius: 15px 15px 15px 15px;
6
+ color: #FFFFFF;
7
+ font-size: 15px;
8
+ padding: 5px 2px 12px 12px;
9
+ }