Version Notes
If customer added some product in cart and in few time product gone out of stock than magento only show error message on cart and disable proceed to checkout button. By using this module out of stock product deleted automatically from cart and show message on cart with product name but proceed to checkout still enable so customer can make order.
Download this release
Release Info
Developer | Emizen Tech Private Limited |
Extension | Emizen_Autodeleteoutofstock |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Emizen/Autodeleteoutofstock/.DS_Store +0 -0
- app/code/local/Emizen/Autodeleteoutofstock/Helper/Data.php +5 -0
- app/code/local/Emizen/Autodeleteoutofstock/Model/Observer.php +40 -0
- app/code/local/Emizen/Autodeleteoutofstock/etc/adminhtml.xml +23 -0
- app/code/local/Emizen/Autodeleteoutofstock/etc/config.xml +33 -0
- app/code/local/Emizen/Autodeleteoutofstock/etc/system.xml +41 -0
- app/etc/modules/Emizen_Autodeleteoutofstock.xml +10 -0
- package.xml +18 -0
app/code/local/Emizen/Autodeleteoutofstock/.DS_Store
ADDED
Binary file
|
app/code/local/Emizen/Autodeleteoutofstock/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Autodeleteoutofstock_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
5 |
+
|
app/code/local/Emizen/Autodeleteoutofstock/Model/Observer.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Emizen_Autodeleteoutofstock_Model_Observer
|
3 |
+
{
|
4 |
+
|
5 |
+
public function autodelete(Varien_Event_Observer $observer)
|
6 |
+
{
|
7 |
+
|
8 |
+
if(!Mage::getStoreConfig('emizen/emizen/general')) // if not enable extension return false
|
9 |
+
return;
|
10 |
+
|
11 |
+
|
12 |
+
$session = Mage::getSingleton("checkout/session");
|
13 |
+
$quote = $session->getQuote();
|
14 |
+
$cartItems = $quote->getAllItems();
|
15 |
+
foreach ($cartItems as $item)
|
16 |
+
{
|
17 |
+
//$productType = $item->getProduct()->getTypeId();
|
18 |
+
//if($productType!='configurable') {
|
19 |
+
$productId = $item->getProductId();
|
20 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
21 |
+
$stockItem = $product->getStockItem();
|
22 |
+
if(!$stockItem->getIsInStock())
|
23 |
+
{
|
24 |
+
|
25 |
+
//$produclink = ' <a href="'.$product->getProductUrl().'">'.$product->getName().'</a> is deleted.';
|
26 |
+
$produclink = Mage::helper('checkout')->__('unfortunately, <a href="%s"> %s</a> is not on stock anymore.',$product->getProductUrl(),$product->getName());
|
27 |
+
$session->addError($produclink);
|
28 |
+
Mage::helper('checkout/cart')->getCart()->removeItem($item->getId())->save();
|
29 |
+
$quote->setHasError(false);
|
30 |
+
|
31 |
+
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
|
32 |
+
}
|
33 |
+
//}
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
app/code/local/Emizen/Autodeleteoutofstock/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<emizen translate="title" module="autodeleteoutofstock">
|
12 |
+
<title>General Section</title>
|
13 |
+
<sort_order>0</sort_order>
|
14 |
+
</emizen>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/local/Emizen/Autodeleteoutofstock/etc/config.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Emizen_Autodeleteoutofstock>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Emizen_Autodeleteoutofstock>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<autodeleteoutofstock>
|
11 |
+
<class>Emizen_Autodeleteoutofstock_Helper</class>
|
12 |
+
</autodeleteoutofstock>
|
13 |
+
</helpers>
|
14 |
+
<models>
|
15 |
+
<autodeleteoutofstock>
|
16 |
+
<class>Emizen_Autodeleteoutofstock_Model</class>
|
17 |
+
<resourceModel>autodeleteoutofstock_mysql4</resourceModel>
|
18 |
+
</autodeleteoutofstock>
|
19 |
+
</models>
|
20 |
+
<events>
|
21 |
+
<controller_action_predispatch_checkout_cart_index> <!-- identifier of the event we want to catch -->
|
22 |
+
<observers>
|
23 |
+
<controller_action_predispatch_checkout_cart_index_handler> <!-- identifier of the event handler -->
|
24 |
+
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
25 |
+
<class>autodeleteoutofstock/observer</class> <!-- observers class alias -->
|
26 |
+
<method>autodelete</method> <!-- observer's method to be called -->
|
27 |
+
<args></args> <!-- additional arguments passed to observer -->
|
28 |
+
</controller_action_predispatch_checkout_cart_index_handler>
|
29 |
+
</observers>
|
30 |
+
</controller_action_predispatch_checkout_cart_index>
|
31 |
+
</events>
|
32 |
+
</global>
|
33 |
+
</config>
|
app/code/local/Emizen/Autodeleteoutofstock/etc/system.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<emizen translate="label" module="autodeleteoutofstock">
|
5 |
+
<label>Emizen</label>
|
6 |
+
<sort_order>0</sort_order>
|
7 |
+
</emizen>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<emizen translate="label" module="autodeleteoutofstock">
|
11 |
+
<label>Autodelete out of stock product from cart</label>
|
12 |
+
<tab>emizen</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>0</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 |
+
<emizen translate="label">
|
20 |
+
<label>Autodelete out of stock product from cart</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>0</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 |
+
<general translate="label">
|
28 |
+
<label>Enable</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>0</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</general>
|
36 |
+
</fields>
|
37 |
+
</emizen>
|
38 |
+
</groups>
|
39 |
+
</emizen>
|
40 |
+
</sections>
|
41 |
+
</config>
|
app/etc/modules/Emizen_Autodeleteoutofstock.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Emizen_Autodeleteoutofstock>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</Emizen_Autodeleteoutofstock>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Emizen_Autodeleteoutofstock</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This module will auto remove product from cart if that is out of stock.</summary>
|
10 |
+
<description>If customer added some product in cart and in few time product gone out of stock than magento only show error message on cart and disable proceed to checkout button. By using this module out of stock product deleted automatically from cart and show message on cart with product name but proceed to checkout still enable so customer can make order.</description>
|
11 |
+
<notes>If customer added some product in cart and in few time product gone out of stock than magento only show error message on cart and disable proceed to checkout button. By using this module out of stock product deleted automatically from cart and show message on cart with product name but proceed to checkout still enable so customer can make order.</notes>
|
12 |
+
<authors><author><name>Emizen Tech Private Limited</name><user>emizen</user><email>info@emizentech.com</email></author></authors>
|
13 |
+
<date>2015-06-26</date>
|
14 |
+
<time>12:12:34</time>
|
15 |
+
<contents><target name="magelocal"><dir><dir name="Emizen"><dir name="Autodeleteoutofstock"><dir><dir name="Helper"><file name="Data.php" hash="df2d755e5eff5ab4a0fd729db6a0af68"/></dir><dir name="Model"><file name="Observer.php" hash="5e0f812cb57ea8f862a98cf0af1b39de"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f2d852849b7447be4c9b5be3c4ee7b1e"/><file name="config.xml" hash="d21f72a19d817d45d0db47307771f028"/><file name="system.xml" hash="e9baee087e9b8ffffd1693372002f404"/></dir></dir><file name=".DS_Store" hash="b69317fdd8f3693c63d7238639cff67b"/></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Emizen_Autodeleteoutofstock.xml" hash="cfe8fed414aa2d1ada359c88304f5697"/></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>
|