Version Notes
Testen in Version 1.5.1.0
Download this release
Release Info
Developer | Thomas von Gostomski |
Extension | Max_Sales_Qty_by_Stock |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/Tom/Modul/etc/config.xml +25 -0
- app/code/community/Tom/PercentStock/Helper/Data.php +4 -0
- app/code/community/Tom/PercentStock/Model/Item.php +33 -0
- app/code/community/Tom/PercentStock/Model/Values.php +20 -0
- app/code/community/Tom/PercentStock/etc/config.xml +36 -0
- app/code/community/Tom/PercentStock/etc/system.xml +34 -0
- app/locale/de_DE/Tom_PercentStock.csv +3 -0
- package.xml +18 -0
app/code/community/Tom/Modul/etc/config.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Tom_Module>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
</Tom_Module>
|
6 |
+
</modules>
|
7 |
+
<frontend>
|
8 |
+
<routers>
|
9 |
+
<module>
|
10 |
+
<use>standard</use>
|
11 |
+
<args>
|
12 |
+
<module>Tom_Module</module>
|
13 |
+
<frontname>module</frontname>
|
14 |
+
</args>
|
15 |
+
</module>
|
16 |
+
</routers>
|
17 |
+
</frontend>
|
18 |
+
<global>
|
19 |
+
<helpers>
|
20 |
+
<module>
|
21 |
+
<class>Tom_Module_Helper</class>
|
22 |
+
</module>
|
23 |
+
</helpers>
|
24 |
+
</global>
|
25 |
+
</config>
|
app/code/community/Tom/PercentStock/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Tom_PercentStock_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
}
|
app/code/community/Tom/PercentStock/Model/Item.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Catalog Inventory Stock Model
|
4 |
+
*
|
5 |
+
* @category Mage
|
6 |
+
* @package Mage_CatalogInventory
|
7 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
8 |
+
*/
|
9 |
+
class Tom_PercentStock_Model_Item extends Mage_CatalogInventory_Model_Stock_Item {
|
10 |
+
const XML_PATH_MAX_SALE_QTY = 'cataloginventory/item_options/max_sale_qty';
|
11 |
+
const XML_PATH_ENABLE_PERCENT = 'cataloginventory/item_options/enable_percent';
|
12 |
+
const XML_PATH_PERCENT_VALUE = 'cataloginventory/item_options/percent_value';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Retrieve Maximum Qty Allowed in Shopping Cart data wraper
|
16 |
+
*
|
17 |
+
* @return float
|
18 |
+
*/
|
19 |
+
public function getMaxSaleQty() {
|
20 |
+
if($this -> getUseConfigMaxSaleQty()) {
|
21 |
+
if(Mage::getStoreConfig(self::XML_PATH_ENABLE_PERCENT)) {
|
22 |
+
$teiler = $this -> getQty();
|
23 |
+
$wert = $teiler / 100;
|
24 |
+
$wert = $wert * Mage::getStoreConfig(self::XML_PATH_PERCENT_VALUE);
|
25 |
+
|
26 |
+
return (float) ceil($wert);
|
27 |
+
}
|
28 |
+
return (float)Mage::getStoreConfig(self::XML_PATH_MAX_SALE_QTY);
|
29 |
+
}
|
30 |
+
return (float)$this -> getData('max_sale_qty');
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/Tom/PercentStock/Model/Values.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tom_PercentStock_Model_Values
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=>10, 'label'=>'10%'),
|
8 |
+
array('value'=>20, 'label'=>'20%'),
|
9 |
+
array('value'=>30, 'label'=>'30%'),
|
10 |
+
array('value'=>40, 'label'=>'40%'),
|
11 |
+
array('value'=>50, 'label'=>'50%'),
|
12 |
+
array('value'=>60, 'label'=>'60%'),
|
13 |
+
array('value'=>70, 'label'=>'70%'),
|
14 |
+
array('value'=>80, 'label'=>'80%'),
|
15 |
+
array('value'=>90, 'label'=>'90%'),
|
16 |
+
array('value'=>100, 'label'=>'100%'),
|
17 |
+
);
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/community/Tom/PercentStock/etc/config.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Tom_PercentStock>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Tom_PercentStock>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<cataloginventory>
|
11 |
+
<rewrite>
|
12 |
+
<stock_item>Tom_PercentStock_Model_Item</stock_item>
|
13 |
+
</rewrite>
|
14 |
+
</cataloginventory>
|
15 |
+
<percentstock>
|
16 |
+
<class>Tom_PercentStock_Model</class>
|
17 |
+
</percentstock>
|
18 |
+
</models>
|
19 |
+
<helpers>
|
20 |
+
<percentstock>
|
21 |
+
<class>Tom_PercentStock_Helper</class>
|
22 |
+
</percentstock>
|
23 |
+
</helpers>
|
24 |
+
</global>
|
25 |
+
<adminhtml>
|
26 |
+
<translate>
|
27 |
+
<modules>
|
28 |
+
<Tom_PercentStock>
|
29 |
+
<files>
|
30 |
+
<default>Tom_PercentStock.csv</default>
|
31 |
+
</files>
|
32 |
+
</Tom_PercentStock>
|
33 |
+
</modules>
|
34 |
+
</translate>
|
35 |
+
</adminhtml>
|
36 |
+
</config>
|
app/code/community/Tom/PercentStock/etc/system.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<sections>
|
3 |
+
<cataloginventory>
|
4 |
+
<groups>
|
5 |
+
<item_options>
|
6 |
+
<fields>
|
7 |
+
<enable_percent translate="label comment" module="percentstock">
|
8 |
+
<label>Enable Percent Qty ordered</label>
|
9 |
+
<frontend_type>select</frontend_type>
|
10 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
11 |
+
<comment>This option allows you to change Maximum Qty ordered dynamically by percentage.</comment>
|
12 |
+
<sort_order>100</sort_order>
|
13 |
+
<show_in_default>1</show_in_default>
|
14 |
+
<show_in_website>0</show_in_website>
|
15 |
+
<show_in_store>0</show_in_store>
|
16 |
+
</enable_percent>
|
17 |
+
<percent_value translate="label" module="percentstock">
|
18 |
+
<label>Percent of Stock as Qty</label>
|
19 |
+
<frontend_type>select</frontend_type>
|
20 |
+
<source_model>percentstock/values</source_model>
|
21 |
+
<sort_order>101</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>0</show_in_website>
|
24 |
+
<show_in_store>0</show_in_store>
|
25 |
+
<depends>
|
26 |
+
<enable_percent>1</enable_percent>
|
27 |
+
</depends>
|
28 |
+
</percent_value>
|
29 |
+
</fields>
|
30 |
+
</item_options>
|
31 |
+
</groups>
|
32 |
+
</cataloginventory>
|
33 |
+
</sections>
|
34 |
+
</config>
|
app/locale/de_DE/Tom_PercentStock.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
"Enable Percent Qty ordered","Aktiviere prozentuale Höchstbestellmenge"
|
2 |
+
"Percent of Stock as Qty","Prozent vom Bestand als Höchstbestellmenge"
|
3 |
+
"This option allows you to change Maximum Qty ordered dynamically by percentage.","Diese Option erlaubt es die Höchstbestellmenge nach dem aktuellen Bestand zu richten."
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Max_Sales_Qty_by_Stock</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>-</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Allows you to change max Qtx on Cart by percent of Stock</summary>
|
10 |
+
<description>This Module dynamically sets maximum Qty of Products in Cart by percent of Stock</description>
|
11 |
+
<notes>Testen in Version 1.5.1.0</notes>
|
12 |
+
<authors><author><name>Thomas von Gostomski</name><user>tomtone</user><email>thomas.v.gostomski@gmx.de</email></author></authors>
|
13 |
+
<date>2011-09-01</date>
|
14 |
+
<time>19:42:58</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Tom"><dir name="Modul"><dir name="etc"><file name="config.xml" hash="35e989cef56a9917ca197d8763f233a7"/></dir></dir><dir name="PercentStock"><dir name="Helper"><file name="Data.php" hash="14e597732986ba12f8670c065558da41"/></dir><dir name="Model"><file name="Item.php" hash="7f1d47a8626d08315155334ee0f7d793"/><file name="Values.php" hash="d2733a70f64d8deb26757466aa5e378d"/></dir><dir name="etc"><file name="config.xml" hash="31fd22664c7687ef0e1e5abf471020b9"/><file name="system.xml" hash="d808dd246b4d191c9a458f5d7fa4172f"/></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Tom_PercentStock.csv" hash="c10d1e2617a214a17702bc7c9a575ff5"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|