kinex_maxquantityamount - Version 1.0.0

Version Notes

This is first version 1.0.0

Download this release

Release Info

Developer Sourav
Extension kinex_maxquantityamount
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Kinex/MaxQuantityAmount/Block/TestBlock.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ Magento Module Creator
4
+
5
+ Copyright (c) 2013 BryMayor.com
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
8
+ software and associated documentation files (the "Software"), to deal in the Software
9
+ without restriction, including without limitation the rights to use, copy, modify,
10
+ merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all copies
15
+ or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22
+ OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ @category Kinex
25
+ @package Kinex_MaxQuantityAmount
26
+ @license The MIT License (MIT)
27
+ @generator http://www.brymayor.com/magento/magento-module-creator/
28
+ */
29
+
30
+ class Kinex_MaxQuantityAmount_Block_TestBlock extends Mage_Core_Block_Template
31
+ {
32
+
33
+ }
app/code/local/Kinex/MaxQuantityAmount/Helper/Data.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Kinex_MaxQuantityAmount_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ const XML_PATH_ACTIVE = 'quantityoptionconfig/productquantity_group/productquantity_enable';
6
+ const XML_PATH_MAX_QUANTITY_MSG = 'quantityoptionconfig/productquantity_group/productquantity_limit_msg';
7
+
8
+
9
+
10
+ public function isModuleEnabled($moduleName = null)
11
+ {
12
+ if ((int)Mage::getStoreConfig(self::XML_PATH_ACTIVE, Mage::app()->getStore()) != 1) {
13
+ return false;
14
+ }
15
+ else{
16
+
17
+ return true;
18
+ }
19
+
20
+
21
+ }
22
+
23
+
24
+
25
+
26
+ public function getMaxQuantityMsg($moduleName = null)
27
+ {
28
+
29
+ return Mage::getStoreConfig(self::XML_PATH_MAX_QUANTITY_MSG, Mage::app()->getStore());
30
+
31
+
32
+
33
+ }
34
+
35
+
36
+
37
+ }
app/code/local/Kinex/MaxQuantityAmount/Model/Observer.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Kinex_MaxQuantityAmount_Model_Observer
3
+ {
4
+ private $_helper;
5
+
6
+ public function __construct()
7
+ {
8
+ $this->_helper = Mage::helper('kinex_maxquantityamount');
9
+ }
10
+
11
+
12
+ public function CheckQuantityAmount(Varien_Event_Observer $observer)
13
+ {
14
+
15
+ $configMsg=$this->_helper->getMaxQuantityMsg();
16
+
17
+ if (!$this->_helper->isModuleEnabled()) {
18
+ return;
19
+ }
20
+
21
+ $item = $observer->getItem();
22
+ $UserEnterQuantity=$item->getQty();
23
+
24
+
25
+ $productObj = Mage::getModel('catalog/product')->load($item->getProduct()->getId());
26
+
27
+
28
+ $productMaxQuantityEnable = $productObj->getAttributeText('maximum_quantity_enable');
29
+
30
+
31
+ $productMaxQuantity = (int)$productObj->getMaximumQuantity();
32
+ $productMaxQuantityMsg = $productObj->getMaximumQuantityMessage();
33
+ $Message=$productMaxQuantityMsg;
34
+
35
+ if(!$productMaxQuantityMsg){
36
+ $Message=$configMsg;
37
+
38
+ }
39
+
40
+ if($productMaxQuantityEnable=='No'){
41
+ return;
42
+
43
+ }
44
+
45
+
46
+ if($UserEnterQuantity > $productMaxQuantity){
47
+
48
+ Mage::getSingleton('checkout/session')->addError(
49
+ $this->_helper->__($Message));
50
+
51
+ Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
52
+ Mage::app()->getResponse()->sendResponse();
53
+ exit;
54
+
55
+
56
+ }
57
+
58
+
59
+
60
+ }
61
+
62
+ }
app/code/local/Kinex/MaxQuantityAmount/controllers/IndexController.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ Magento Module Creator
4
+
5
+ Copyright (c) 2013 BryMayor.com
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
8
+ software and associated documentation files (the "Software"), to deal in the Software
9
+ without restriction, including without limitation the rights to use, copy, modify,
10
+ merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all copies
15
+ or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22
+ OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ @category Kinex
25
+ @package Kinex_MaxQuantityAmount
26
+ @license The MIT License (MIT)
27
+ @generator http://www.brymayor.com/magento/magento-module-creator/
28
+ */
29
+
30
+ class Kinex_MaxQuantityAmount_IndexController extends Mage_Core_Controller_Front_Action
31
+ {
32
+ public function indexAction()
33
+ {
34
+ $this->loadLayout()->renderLayout();
35
+ }
36
+ }
app/code/local/Kinex/MaxQuantityAmount/etc/adminhtml.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+
8
+ <system>
9
+ <children>
10
+ <config>
11
+ <children>
12
+ <quantityoptionconfig translate="title" module="kinex_maxquantityamount">
13
+ <title>Maximum Quanitity Amount </title>
14
+ </quantityoptionconfig>
15
+
16
+
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+
22
+
23
+
24
+ </children>
25
+
26
+ </admin>
27
+ </resources>
28
+ </acl>
29
+ </config>
app/code/local/Kinex/MaxQuantityAmount/etc/config.xml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Kinex_MaxQuantityAmount>
5
+ <version>1.0.0</version>
6
+ </Kinex_MaxQuantityAmount>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <kinex_maxquantityamount>
11
+ <class>Kinex_MaxQuantityAmount_Block</class>
12
+ </kinex_maxquantityamount>
13
+ <kinex_maxquantityamount_adminhtml>
14
+ <class>Kinex_MaxQuantityAmount_Block_Adminhtml</class>
15
+ </kinex_maxquantityamount_adminhtml>
16
+ </blocks>
17
+ <models>
18
+ <kinex_maxquantityamount>
19
+ <class>Kinex_MaxQuantityAmount_Model</class>
20
+ </kinex_maxquantityamount>
21
+ </models>
22
+ <helpers>
23
+ <kinex_maxquantityamount>
24
+ <class>Kinex_MaxQuantityAmount_Helper</class>
25
+ </kinex_maxquantityamount>
26
+ </helpers>
27
+
28
+ <resources>
29
+ <kinex_maxquantityamount_setup>
30
+ <setup>
31
+ <module>Kinex_MaxQuantityAmount</module>
32
+ <class>Mage_Eav_Model_Entity_Setup</class>
33
+ </setup>
34
+ </kinex_maxquantityamount_setup>
35
+ </resources>
36
+
37
+ </global>
38
+ <frontend>
39
+ <!--
40
+ <routers>
41
+ <kinex_maxquantityamount>
42
+ <use>standard</use>
43
+ <args>
44
+ <module>Kinex_MaxQuantityAmount</module>
45
+ <frontName>test</frontName>
46
+ </args>
47
+ </kinex_maxquantityamount>
48
+ </routers>
49
+ -->
50
+
51
+ <events>
52
+ <sales_quote_item_qty_set_after>
53
+ <observers>
54
+ <kinex_maxquantityamount>
55
+ <class>kinex_maxquantityamount/observer</class>
56
+ <method>CheckQuantityAmount</method>
57
+ </kinex_maxquantityamount>
58
+ </observers>
59
+ </sales_quote_item_qty_set_after>
60
+ </events>
61
+ <layout>
62
+ <updates>
63
+ <kinex_maxquantityamount>
64
+ <file>kinex_maxquantityamount.xml</file>
65
+ </kinex_maxquantityamount>
66
+ </updates>
67
+ </layout>
68
+ </frontend>
69
+
70
+ <admin>
71
+ <routers>
72
+ <adminhtml>
73
+ <args>
74
+ <modules>
75
+ <Kinex_MaxQuantityAmount before="Mage_Adminhtml">Kinex_MaxQuantityAmount_Adminhtml</Kinex_MaxQuantityAmount>
76
+ </modules>
77
+ </args>
78
+ </adminhtml>
79
+ </routers>
80
+ </admin>
81
+
82
+
83
+ </config>
app/code/local/Kinex/MaxQuantityAmount/etc/system.xml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <simpleproduct translate="label" module="kinex_maxquantityamount">
5
+ <label>Maximum Product Quantity</label>
6
+ <sort_order>100</sort_order>
7
+ </simpleproduct>
8
+ </tabs>
9
+ <sections>
10
+ <quantityoptionconfig translate="label" module="kinex_maxquantityamount">
11
+ <label>Configuration</label>
12
+ <tab>simpleproduct</tab>
13
+ <class>separator-top</class>
14
+ <sort_order>10</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <productquantity_group translate="label">
20
+ <label>General Setting</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>100</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <productquantity_enable translate="label comment">
28
+ <label>Enabled</label>
29
+ <comment>To Enable Max Quantity Amount Select Yes from dropdown.</comment>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
+ <sort_order>6</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </productquantity_enable>
37
+ <productquantity_limit_msg>
38
+ <label>Maximum Quantity Amount Message</label>
39
+ <comment><![CDATA[Message to be displayed to customer when "Maximum Quantity Amount " condition limit is triggered.]]></comment>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>7</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </productquantity_limit_msg>
46
+
47
+
48
+ </fields>
49
+
50
+ </productquantity_group>
51
+ </groups>
52
+ </quantityoptionconfig>
53
+
54
+
55
+ </sections>
56
+
57
+
58
+ </config>
app/code/local/Kinex/MaxQuantityAmount/sql/kinex_maxquantityamount_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $enableOption=array(
8
+ 'group' => 'Maximum Quantity Amount',
9
+ 'type' => 'int',
10
+ 'label' => 'Enable Maximum Quantity Amount',
11
+ 'input' => 'boolean',
12
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
13
+ 'visible' => true,
14
+ 'source' => 'eav/entity_attribute_source_boolean',
15
+ 'required' => false,
16
+ 'searchable' => false,
17
+ 'filterable' => false,
18
+ 'comparable' => false,
19
+ 'visible_on_front' =>true,
20
+ 'unique' => false,
21
+ 'apply_to' => '',
22
+
23
+
24
+ );
25
+
26
+ $installer->addAttribute('catalog_product','maximum_quantity_enable',$enableOption);
27
+
28
+ $quantityOption=array(
29
+ 'group' => 'Maximum Quantity Amount',
30
+ 'type' => 'int',
31
+ 'label' => 'Enter Maximum Quantity',
32
+ 'input' => 'text',
33
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
34
+ 'visible' => true,
35
+ 'required' => false,
36
+ 'searchable' => false,
37
+ 'filterable' => false,
38
+ 'comparable' => false,
39
+ 'visible_on_front' =>true,
40
+ 'unique' => false,
41
+ 'apply_to' => '',
42
+
43
+
44
+ );
45
+
46
+ $installer->addAttribute('catalog_product','maximum_quantity',$quantityOption);
47
+
48
+
49
+
50
+
51
+
52
+ $messageOption=array(
53
+ 'group' => 'Maximum Quantity Amount',
54
+ 'type' => 'text',
55
+ 'label' => 'Message',
56
+ 'input' => 'text',
57
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
58
+ 'visible' => true,
59
+ 'required' => false,
60
+ 'searchable' => false,
61
+ 'filterable' => false,
62
+ 'comparable' => false,
63
+ 'visible_on_front' =>true,
64
+ 'unique' => false,
65
+ 'apply_to' => '',
66
+
67
+
68
+ );
69
+
70
+ $installer->addAttribute('catalog_product','maximum_quantity_message',$messageOption);
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ $installer->endSetup();
app/etc/modules/Kinex_MaxQuantityAmount.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Kinex_MaxQuantityAmount>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Kinex_MaxQuantityAmount>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>kinex_maxquantityamount</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Maximum Quantity Amount Extension For Products</summary>
10
+ <description>This extension allow the users to set the maximum quantity for individual products. Order will not place after maximum quantity limit exceed.This allow the users to set custom message for individual products.</description>
11
+ <notes>This is first version 1.0.0</notes>
12
+ <authors><author><name>Sourav </name><user>SouravKinex</user><email>sourav@kinexmedia.com</email></author></authors>
13
+ <date>2015-10-01</date>
14
+ <time>06:16:51</time>
15
+ <contents><target name="magelocal"><dir name="Kinex"><dir name="MaxQuantityAmount"><dir name="Block"><file name="TestBlock.php" hash="e6e9d10a6f6ac8bdc64d725f8f459847"/></dir><dir name="Helper"><file name="Data.php" hash="6ae4ad23fc024b1efb1e2058513d8dec"/></dir><dir name="Model"><file name="Observer.php" hash="ef21dbabb78bcb6c85e5bc1def9d8956"/></dir><dir name="controllers"><file name="IndexController.php" hash="73c2ac4b366059812fad66008f209d01"/></dir><dir name="etc"><file name="adminhtml.xml" hash="63749b0153706e5936ef7055a51c71f7"/><file name="config.xml" hash="49d2ecfd81878006099524af2da95b6c"/><file name="system.xml" hash="bbfa2511a43e26fc349d2b70861edc4e"/></dir><dir name="sql"><dir name="kinex_maxquantityamount_setup"><file name="mysql4-install-1.0.0.php" hash="7ddb4457fbd19153a2f5cf4dbf5ab733"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kinex_MaxQuantityAmount.xml" hash="c4f076e6c6a068b9d28dd0567f09b084"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>