ShortDescriptionGenerator - Version 1.0.0

Version Notes

Work fine

Download this release

Release Info

Developer Alin
Extension ShortDescriptionGenerator
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Alin/AutoShortDescription/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+
3
+ class Alin_AutoShortDescription_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {}
app/code/community/Alin/AutoShortDescription/Model/Observer.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Alin_AutoShortDescription_Model_Observer {
3
+ public function addMassaction($observer)
4
+ {
5
+ $block = $observer->getBlock();
6
+ if($block instanceof Mage_Adminhtml_Block_Catalog_Product_Grid){
7
+ $block->getMassactionBlock()->addItem('alin_autoshortdescription', array(
8
+ 'label'=> Mage::helper('catalog')->__('Generate short description'),
9
+ 'url' => $block->getUrl('*/*/autoshortdescription')
10
+ ));
11
+
12
+ }
13
+ }
14
+ }
app/code/community/Alin/AutoShortDescription/controllers/Adminhtml/Catalog/ProductController.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Alin_AutoShortDescription_Adminhtml_Catalog_ProductController extends Mage_Adminhtml_Controller_Action {
3
+ public function autoshortdescriptionAction() {
4
+ $pIds=$this->getRequest()->getParam('product');
5
+
6
+ foreach ($pIds as $pId) {
7
+ $obj = Mage::getModel('catalog/product');
8
+ $_product=$obj->load($pId);
9
+ $attribs=$_product->getAttributes();
10
+ $str='<div class="gen_short"><table border="0" cellpading="2" cellspacing="2" width="100%"><tbody>';
11
+ $i=0;
12
+ foreach ($attribs as $attrib) {
13
+
14
+ if ($attrib->getUsedInProductListing() && $attrib->getIsUserDefined()) {
15
+ $prodAttrVal='<b>'.$attrib->getStoreLabel().': </b>';
16
+ $pa=$_product->getAttributeText($attrib->getAttributeCode());
17
+ if ($pa==null) $pa='N/A';
18
+ $prodAttrVal.=$pa;
19
+ if ($i % 2==0) $str.='<tr><td>'.$prodAttrVal.'</td>';
20
+ else $str.='<td>'.$prodAttrVal.'</td></tr>';
21
+ $i++;
22
+ }
23
+
24
+ }
25
+ if ($i % 2!=0) $str.='</tr>';
26
+ $str.='</tbody></table></div>';
27
+ $_product->setShortDescription($str);
28
+ $obj->save();
29
+ }
30
+ Mage::dispatchEvent('catalog_product_massupdate_after', array('products'=>$pIds));
31
+ $this->_redirect('adminhtml/catalog_product/index/', array());
32
+ }
33
+ }
app/code/community/Alin/AutoShortDescription/etc/config.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Alin_AutoShortDescription>
5
+ <version>1.0.0</version>
6
+ </Alin_AutoShortDescription>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <alin_autoshortdescription>
11
+ <class>Alin_AutoShortDescription_Model</class>
12
+
13
+ </alin_autoshortdescription>
14
+
15
+ </models>
16
+
17
+ </global>
18
+ <adminhtml>
19
+ <events>
20
+ <adminhtml_block_html_before>
21
+ <observers>
22
+ <alin_autoshortdescription>
23
+ <type>singleton</type>
24
+ <class>alin_autoshortdescription/observer</class>
25
+ <method>addMassaction</method>
26
+ </alin_autoshortdescription>
27
+ </observers>
28
+ </adminhtml_block_html_before>
29
+ </events>
30
+ </adminhtml>
31
+
32
+ <admin>
33
+ <routers>
34
+ <adminhtml>
35
+ <args>
36
+ <modules>
37
+ <Alin_AutoShortDescription before="Mage_Adminhtml">Alin_AutoShortDescription_Adminhtml</Alin_AutoShortDescription>
38
+ </modules>
39
+ </args>
40
+ </adminhtml>
41
+ </routers>
42
+ </admin>
43
+
44
+ </config>
app/etc/modules/Alin_AutoShortDescription.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Alin_AutoShortDescription>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+
9
+ </depends>
10
+ </Alin_AutoShortDescription>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ShortDescriptionGenerator</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL-3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Generates the short description based on your attributes</summary>
10
+ <description>This extension generates the short description based on your attributes. You can choose what attributes to show in frontend based on attributes who are set to show in product listing (Use In Product Listing).&#xD;
11
+ </description>
12
+ <notes>Work fine</notes>
13
+ <authors><author><name>Alin M</name><user>alinx27</user><email>alinx27@yahoo.com</email></author></authors>
14
+ <date>2013-03-13</date>
15
+ <time>07:16:33</time>
16
+ <contents><target name="magecommunity"><dir name="Alin"><dir name="AutoShortDescription"><dir name="Helper"><file name="Data.php" hash="18a9798192071bc895f96964df9a1c68"/></dir><dir name="Model"><file name="Observer.php" hash="3f33e0c5bd1fc43c98fe65806d387338"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Catalog"><file name="ProductController.php" hash="76663f041ff42040671ac2dca3d182f9"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="925f1ccebf397637d997e2b23b0e9eba"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Alin_AutoShortDescription.xml" hash="242f33048b011ff1ec117d2f57aa33ea"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
19
+ </package>