Version Notes
Delete Product Images Magento Community Module
Download this release
Release Info
Developer | StrApp |
Extension | delete_product_images |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Strapp/Deleteproductimages/Helper/Data.php +14 -0
- app/code/local/Strapp/Deleteproductimages/Helper/Data.php~ +14 -0
- app/code/local/Strapp/Deleteproductimages/Model/Observer.php +25 -0
- app/code/local/Strapp/Deleteproductimages/Model/Observer.php~ +25 -0
- app/code/local/Strapp/Deleteproductimages/etc/adminhtml.xml +25 -0
- app/code/local/Strapp/Deleteproductimages/etc/adminhtml.xml~ +25 -0
- app/code/local/Strapp/Deleteproductimages/etc/config.xml +53 -0
- app/code/local/Strapp/Deleteproductimages/etc/config.xml~ +53 -0
- app/code/local/Strapp/Deleteproductimages/etc/system.xml +42 -0
- app/code/local/Strapp/Deleteproductimages/etc/system.xml~ +42 -0
- app/etc/modules/Strapp_Deleteproductimages.xml +9 -0
- package.xml +18 -0
app/code/local/Strapp/Deleteproductimages/Helper/Data.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Strapp Deleteproductimages Module
|
4 |
+
*
|
5 |
+
* @category Strapp
|
6 |
+
* @package Strapp_Deleteproductimages
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
class Strapp_Deleteproductimages_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
|
13 |
+
}
|
14 |
+
?>
|
app/code/local/Strapp/Deleteproductimages/Helper/Data.php~
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Strapp Deleteproductimages Module
|
4 |
+
*
|
5 |
+
* @category Strapp
|
6 |
+
* @package Strapp_Deleteproductimages
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
class Strapp_Deleteproductimages_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
|
13 |
+
}
|
14 |
+
?>
|
app/code/local/Strapp/Deleteproductimages/Model/Observer.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @category Strapp
|
5 |
+
* @package Strapp_Deleteproductimages
|
6 |
+
*/
|
7 |
+
class Strapp_Deleteproductimages_Model_Observer
|
8 |
+
{
|
9 |
+
public function deleteProductImages($observer)
|
10 |
+
{
|
11 |
+
if(Mage::getStoreConfig('deleteproductimages/image/enable'))
|
12 |
+
{
|
13 |
+
$product = $observer->getEvent()->getProduct();
|
14 |
+
if ($product)
|
15 |
+
{
|
16 |
+
$gallery = $product->getData('media_gallery');
|
17 |
+
$images = $gallery['images'];
|
18 |
+
foreach ($images as $image)
|
19 |
+
{
|
20 |
+
unlink(Mage::getBaseDir('media') . '/catalog/product' . $image['file']);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
app/code/local/Strapp/Deleteproductimages/Model/Observer.php~
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @category Strapp
|
5 |
+
* @package Strapp_Deleteproductimages
|
6 |
+
*/
|
7 |
+
class Strapp_Deleteproductimages_Model_Observer
|
8 |
+
{
|
9 |
+
public function deleteProductImages($observer)
|
10 |
+
{
|
11 |
+
if(Mage::getStoreConfig('deleteproductimages/image/enable'))
|
12 |
+
{
|
13 |
+
$product = $observer->getEvent()->getProduct();
|
14 |
+
if ($product)
|
15 |
+
{
|
16 |
+
$gallery = $product->getData('media_gallery');
|
17 |
+
$images = $gallery['images'];
|
18 |
+
foreach ($images as $image)
|
19 |
+
{
|
20 |
+
unlink(Mage::getBaseDir('media') . '/catalog/product' . $image['file']);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
app/code/local/Strapp/Deleteproductimages/etc/adminhtml.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children> <deleteproductimages translate="title" module="strapp_deleteproductimages">
|
14 |
+
<title>Strapp Deleteproductimages</title>
|
15 |
+
<sort_order>1</sort_order>
|
16 |
+
</deleteproductimages>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</config>
|
app/code/local/Strapp/Deleteproductimages/etc/adminhtml.xml~
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children> <deleteproductimages translate="title" module="strapp_deleteproductimages">
|
14 |
+
<title>Strapp Deleteproductimages</title>
|
15 |
+
<sort_order>1</sort_order>
|
16 |
+
</deleteproductimages>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</config>
|
app/code/local/Strapp/Deleteproductimages/etc/config.xml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Strapp_Deleteproductimages>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Strapp_Deleteproductimages>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<deleteproductimages>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Strapp_Deleteproductimages</module>
|
14 |
+
<frontName>deleteproductimages</frontName>
|
15 |
+
</args>
|
16 |
+
</deleteproductimages>
|
17 |
+
</routers>
|
18 |
+
</frontend>
|
19 |
+
<global>
|
20 |
+
<models>
|
21 |
+
<strapp_deleteproductimages>
|
22 |
+
<class>Strapp_Deleteproductimages_Model</class>
|
23 |
+
</strapp_deleteproductimages>
|
24 |
+
</models>
|
25 |
+
<blocks>
|
26 |
+
<strapp_deleteproductimages>
|
27 |
+
<class>Strapp_Deleteproductimages_Block</class>
|
28 |
+
</strapp_deleteproductimages>
|
29 |
+
</blocks>
|
30 |
+
<helpers>
|
31 |
+
<strapp_deleteproductimages>
|
32 |
+
<class>Strapp_Deleteproductimages_Helper</class>
|
33 |
+
</strapp_deleteproductimages>
|
34 |
+
</helpers>
|
35 |
+
<events>
|
36 |
+
<catalog_product_delete_before>
|
37 |
+
<observers>
|
38 |
+
<strapp_deleteproductimages_model_observer>
|
39 |
+
<class>Strapp_Deleteproductimages_Model_Observer</class>
|
40 |
+
<method>deleteProductImages</method>
|
41 |
+
</strapp_deleteproductimages_model_observer>
|
42 |
+
</observers>
|
43 |
+
</catalog_product_delete_before>
|
44 |
+
</events>
|
45 |
+
</global>
|
46 |
+
<default>
|
47 |
+
<imageeraser>
|
48 |
+
<image>
|
49 |
+
<enable>0</enable>
|
50 |
+
</image>
|
51 |
+
</imageeraser>
|
52 |
+
</default>
|
53 |
+
</config>
|
app/code/local/Strapp/Deleteproductimages/etc/config.xml~
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Strapp_Deleteproductimages>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Strapp_Deleteproductimages>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<deleteproductimages>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Strapp_Deleteproductimages</module>
|
14 |
+
<frontName>imageeraser</frontName>
|
15 |
+
</args>
|
16 |
+
</imageeraser>
|
17 |
+
</routers>
|
18 |
+
</frontend>
|
19 |
+
<global>
|
20 |
+
<models>
|
21 |
+
<strapp_imageeraser>
|
22 |
+
<class>Strapp_Deleteproductimages_Model</class>
|
23 |
+
</strapp_imageeraser>
|
24 |
+
</models>
|
25 |
+
<blocks>
|
26 |
+
<strapp_imageeraser>
|
27 |
+
<class>Strapp_Deleteproductimages_Block</class>
|
28 |
+
</strapp_imageeraser>
|
29 |
+
</blocks>
|
30 |
+
<helpers>
|
31 |
+
<strapp_imageeraser>
|
32 |
+
<class>Strapp_Deleteproductimages_Helper</class>
|
33 |
+
</strapp_imageeraser>
|
34 |
+
</helpers>
|
35 |
+
<events>
|
36 |
+
<catalog_product_delete_before>
|
37 |
+
<observers>
|
38 |
+
<strapp_imageeraser_model_observer>
|
39 |
+
<class>Strapp_Deleteproductimages_Model_Observer</class>
|
40 |
+
<method>deleteProductImages</method>
|
41 |
+
</strapp_imageeraser_model_observer>
|
42 |
+
</observers>
|
43 |
+
</catalog_product_delete_before>
|
44 |
+
</events>
|
45 |
+
</global>
|
46 |
+
<default>
|
47 |
+
<imageeraser>
|
48 |
+
<image>
|
49 |
+
<enable>0</enable>
|
50 |
+
</image>
|
51 |
+
</imageeraser>
|
52 |
+
</default>
|
53 |
+
</config>
|
app/code/local/Strapp/Deleteproductimages/etc/system.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<strapp translate="label">
|
5 |
+
<label>Strapp Extensions</label>
|
6 |
+
<sort_order>151</sort_order>
|
7 |
+
</strapp>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<deleteproductimages translate="label">
|
11 |
+
<label>Delete Product Images</label>
|
12 |
+
<tab>strapp</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>201</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 |
+
<image>
|
20 |
+
<label>Delete Product Images</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</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 |
+
<enable translate="label">
|
28 |
+
<label>Enable/Disable</label>
|
29 |
+
<comment>If disabled, images are not deleting</comment>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
32 |
+
<sort_order>0</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 |
+
</enable>
|
37 |
+
</fields>
|
38 |
+
</image>
|
39 |
+
</groups>
|
40 |
+
</deleteproductimages>
|
41 |
+
</sections>
|
42 |
+
</config>
|
app/code/local/Strapp/Deleteproductimages/etc/system.xml~
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<strapp translate="label">
|
5 |
+
<label>Strapp Extensions</label>
|
6 |
+
<sort_order>151</sort_order>
|
7 |
+
</strapp>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<deleteproductimages translate="label">
|
11 |
+
<label>Delete Product Images</label>
|
12 |
+
<tab>strapp</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>201</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 |
+
<image>
|
20 |
+
<label>Delete Product Images</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</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 |
+
<enable translate="label">
|
28 |
+
<label>Enable/Disable</label>
|
29 |
+
<comment>If disabled, images are not deleting</comment>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
32 |
+
<sort_order>0</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 |
+
</enable>
|
37 |
+
</fields>
|
38 |
+
</image>
|
39 |
+
</groups>
|
40 |
+
</deleteproductimages>
|
41 |
+
</sections>
|
42 |
+
</config>
|
app/etc/modules/Strapp_Deleteproductimages.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Strapp_Deleteproductimages>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Strapp_Deleteproductimages>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>delete_product_images</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Delete Product Images Magento Community Module</summary>
|
10 |
+
<description>Magento doesn't provide for deleting images, when a product is being deleted by the admin. The Delete Product Images extension helps delete the product images - when a product is being deleted. This helps save enormous amount of memory space in the long run and keeping the server clean.</description>
|
11 |
+
<notes>Delete Product Images Magento Community Module</notes>
|
12 |
+
<authors><author><name>StrApp</name><user>strviv</user><email>strappvivek@gmail.com</email></author></authors>
|
13 |
+
<date>2014-03-11</date>
|
14 |
+
<time>05:12:25</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Strapp"><dir name="Deleteproductimages"><dir name="Helper"><file name="Data.php" hash="db843472b1661720c137c592edf02486"/><file name="Data.php~" hash="db843472b1661720c137c592edf02486"/></dir><dir name="Model"><file name="Observer.php" hash="9b77bba89236c8647f01a897ee7f5f3d"/><file name="Observer.php~" hash="9b77bba89236c8647f01a897ee7f5f3d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="23c015c5cf66b9a653c5d0ce723d2cfb"/><file name="adminhtml.xml~" hash="23c015c5cf66b9a653c5d0ce723d2cfb"/><file name="config.xml" hash="7821a4908d4d17e0481535e54c0ca270"/><file name="config.xml~" hash="077e4126b75b00d0e1934beca2824454"/><file name="system.xml" hash="bbba595505fdeb203e0750e0b0ce02f8"/><file name="system.xml~" hash="bbba595505fdeb203e0750e0b0ce02f8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Strapp_Deleteproductimages.xml" hash="b2bafdd24ce3fb6b569506aaec94461e"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>5.5.6</max></php></required></dependencies>
|
18 |
+
</package>
|