NewsModules_RichSnippet - Version 0.1.2

Version Notes

Added uninstall script

Download this release

Release Info

Developer Alessandro Lioce
Extension NewsModules_RichSnippet
Version 0.1.2
Comparing to
See all releases


Code changes from version 0.1.1 to 0.1.2

app/code/community/NewsModules/RichSnippet/controllers/UninstallController.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class NewsModules_RichSnippet_UninstallController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $enabled = Mage::getStoreConfig('catalog/newsmodules_richsnippet/enable_uninstall') == 1;
7
+ $attribute_id = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_category', 'richsnippet_category');
8
+ $attribute_exists = (boolean) $attribute_id;
9
+ $display_form = $enabled && $attribute_exists;
10
+
11
+ if (!$attribute_exists) Mage::getSingleton('core/session')->addSuccess('The database has been modified. Now you can uninstall the module via Magento Connect.');
12
+ else if (!$enabled) Mage::getSingleton('core/session')->addError('You need to enable the page in System > Configuration > Catalog > Rich Snippet > Enable Uninstall Page');
13
+
14
+ $this->loadLayout();
15
+ $this->_initLayoutMessages('customer/session');
16
+
17
+ $this->getLayout()->getBlock('form')
18
+ ->assign('display_form', $display_form)
19
+ ;
20
+
21
+ $this->renderLayout();
22
+ }
23
+
24
+ public function executeAction()
25
+ {
26
+ try
27
+ {
28
+ $installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
29
+ $installer->startSetup();
30
+ $installer->removeAttribute('catalog_category','richsnippet_category');
31
+ $installer->endSetup();
32
+
33
+ /*
34
+ $db_resource = Mage::getSingleton('core/resource');
35
+ $table_name = $db_resource->getTableName('core_resource');
36
+ $connection = $db_resource->getConnection('core_write');
37
+ $table = new Zend_Db_Table(array('name' => $table_name, 'db' => $connection));
38
+ $select = $table->select()->where('code = ?', 'richsnippet_setup');
39
+ $row = $table->fetchRow($select);
40
+ $row->delete();
41
+ */
42
+
43
+ $config = new Mage_Core_Model_Config();
44
+ $config->saveConfig('catalog/newsmodules_richsnippet/enable_uninstall', "0", 'default', 0);
45
+ }
46
+ catch (Exception $e)
47
+ {
48
+ echo $e->getMessage();
49
+ Mage::getSingleton('core/session')->addError('There was an error. Contact technical support.');
50
+ }
51
+ $this->_redirect('*/*/index');
52
+ }
53
+ }
54
+ ?>
app/code/community/NewsModules/RichSnippet/etc/adminhtml.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <newsmodulestab module="richsnippet" translate="title">
5
+ <title>Ne.W.S. Modules</title>
6
+ <sort_order>100</sort_order>
7
+ <children>
8
+ <richsnippet_uninstall module="richsnippet" translate="title">
9
+ <title>Uninstall Rich Snippet</title>
10
+ <sort_order>1</sort_order>
11
+ <action>richsnippet/uninstall/index</action>
12
+ </richsnippet_uninstall>
13
+ </children>
14
+ </newsmodulestab>
15
+ </menu>
16
+ </config>
app/code/community/NewsModules/RichSnippet/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <NewsModules_RichSnippet>
5
- <version>0.1.0</version>
6
  </NewsModules_RichSnippet>
7
  </modules>
8
  <global>
@@ -33,6 +33,15 @@
33
  </richsnippet>
34
  </updates>
35
  </layout>
 
 
 
 
 
 
 
 
 
36
  </frontend>
37
  <adminhtml>
38
  <layout>
@@ -43,4 +52,11 @@
43
  </updates>
44
  </layout>
45
  </adminhtml>
 
 
 
 
 
 
 
46
  </config>
2
  <config>
3
  <modules>
4
  <NewsModules_RichSnippet>
5
+ <version>0.1.2</version>
6
  </NewsModules_RichSnippet>
7
  </modules>
8
  <global>
33
  </richsnippet>
34
  </updates>
35
  </layout>
36
+ <routers>
37
+ <richsnippet>
38
+ <use>standard</use>
39
+ <args>
40
+ <module>NewsModules_RichSnippet</module>
41
+ <frontName>richsnippet</frontName>
42
+ </args>
43
+ </richsnippet>
44
+ </routers>
45
  </frontend>
46
  <adminhtml>
47
  <layout>
52
  </updates>
53
  </layout>
54
  </adminhtml>
55
+ <default>
56
+ <catalog>
57
+ <newsmodules_richsnippet>
58
+ <enable_uninstall>0</enable_uninstall>
59
+ </newsmodules_richsnippet>
60
+ </catalog>
61
+ </default>
62
  </config>
app/code/community/NewsModules/RichSnippet/etc/system.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <catalog>
5
+ <groups>
6
+ <newsmodules_richsnippet translate="label">
7
+ <label>Rich Snippet</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>600</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>0</show_in_website>
12
+ <show_in_store>0</show_in_store>
13
+ <fields>
14
+ <enable_uninstall translate="label comment">
15
+ <label>Enable Uninstall Page</label>
16
+ <comment></comment>
17
+ <frontend_type>select</frontend_type>
18
+ <source_model>adminhtml/system_config_source_yesno</source_model>
19
+ <sort_order>100</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>0</show_in_website>
22
+ <show_in_store>0</show_in_store>
23
+ </enable_uninstall>
24
+ </fields>
25
+ </newsmodules_richsnippet>
26
+ </groups>
27
+ </catalog>
28
+ </sections>
29
+ </config>
app/code/community/NewsModules/RichSnippet/sql/richsnippet_setup/mysql4-install-0.1.0.php CHANGED
@@ -18,11 +18,9 @@
18
  $installer->addAttributeToGroup(
19
  $entityTypeId,
20
  $attributeSetId,
21
- 4, //$attributeGroupId, //General Informations Tab
22
  'richsnippet_category',
23
  '20'
24
  );
25
 
26
- $attributeId = $installer->getAttributeId($entityTypeId, 'richsnippet_category');
27
-
28
  $installer->endSetup();
18
  $installer->addAttributeToGroup(
19
  $entityTypeId,
20
  $attributeSetId,
21
+ $attributeGroupId,
22
  'richsnippet_category',
23
  '20'
24
  );
25
 
 
 
26
  $installer->endSetup();
app/code/community/NewsModules/RichSnippet/sql/richsnippet_setup/upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $entityTypeId = $installer->getEntityTypeId('catalog_category');
6
+ $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
7
+ $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
8
+
9
+ $installer->addAttributeToGroup(
10
+ $entityTypeId,
11
+ $attributeSetId,
12
+ $attributeGroupId,
13
+ 'richsnippet_category',
14
+ '20'
15
+ );
16
+
17
+ $installer->endSetup();
app/code/community/NewsModules/RichSnippet/sql/richsnippet_setup/upgrade-0.1.0-0.1.2.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $entityTypeId = $installer->getEntityTypeId('catalog_category');
6
+ $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
7
+ $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
8
+
9
+ $installer->addAttributeToGroup(
10
+ $entityTypeId,
11
+ $attributeSetId,
12
+ $attributeGroupId,
13
+ 'richsnippet_category',
14
+ '20'
15
+ );
16
+
17
+ $installer->endSetup();
app/design/frontend/base/default/layout/richsnippet.xml CHANGED
@@ -1,5 +1,16 @@
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
 
 
 
 
 
 
 
 
 
 
 
3
  <default>
4
  <reference name="breadcrumbs">
5
  <action method="setTemplate">
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
+ <richsnippet_uninstall_index>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>page/empty.phtml</template></action>
6
+ <!-- Mark root page block that template is applied -->
7
+ <action method="setIsHandle"><applied>1</applied></action>
8
+ </reference>
9
+ <reference name="content">
10
+ <block type="core/template" name="form" template="richsnippet/uninstall/index.phtml" />
11
+ </reference>
12
+ </richsnippet_uninstall_index>
13
+
14
  <default>
15
  <reference name="breadcrumbs">
16
  <action method="setTemplate">
app/design/frontend/base/default/template/richsnippet/uninstall/index.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php if ($display_form) { ?>
2
+ <div style="text-align: center; margin-top: 50px;">
3
+ <form action="<?php echo Mage::getUrl('*/*/execute') ?>" method="post">
4
+ <?php echo $this->__('Do you want remove Rich Snippet Module database changes?'); ?>
5
+ <input type="submit" name="submit" id="submit" value="<?php echo $this->__('Execute'); ?>" />
6
+ </form>
7
+ </div>
8
+ <?php } ?>
js/newsmodules/richsnippet/adminhtml/catalog/category.js CHANGED
@@ -6,10 +6,10 @@ RichSnippet_jQuery( document ).ready(function() {
6
 
7
  function NewsModules_RichSnippet_Init()
8
  {
9
- if (!RichSnippet_jQuery('select#group_4richsnippet_category').hasClass('ready'))
10
  {
11
  var text_node = RichSnippet_jQuery('<p />').attr('id', 'richsnippet_category_text');
12
- var node = RichSnippet_jQuery('select#group_4richsnippet_category');
13
  node.attr('size', 10).css('width', '100%');
14
  node.parent().append(text_node);
15
 
@@ -20,13 +20,13 @@ function NewsModules_RichSnippet_Init()
20
  NewsModules_RichSnippet_DisplayCategoryName();
21
  });
22
 
23
- RichSnippet_jQuery('select#group_4richsnippet_category').addClass('ready');
24
  }
25
  }
26
 
27
  function NewsModules_RichSnippet_DisplayCategoryName()
28
  {
29
- var node = RichSnippet_jQuery('select#group_4richsnippet_category');
30
  var val = node.val();
31
  var text = node.find("[value='"+val+"']").text();
32
  RichSnippet_jQuery('#richsnippet_category_text').html(text);
6
 
7
  function NewsModules_RichSnippet_Init()
8
  {
9
+ if (!RichSnippet_jQuery('select[id^="group_"][id$="richsnippet_category"]').hasClass('ready'))
10
  {
11
  var text_node = RichSnippet_jQuery('<p />').attr('id', 'richsnippet_category_text');
12
+ var node = RichSnippet_jQuery('select[id^="group_"][id$="richsnippet_category"]');
13
  node.attr('size', 10).css('width', '100%');
14
  node.parent().append(text_node);
15
 
20
  NewsModules_RichSnippet_DisplayCategoryName();
21
  });
22
 
23
+ RichSnippet_jQuery('select[id^="group_"][id$="richsnippet_category"]').addClass('ready');
24
  }
25
  }
26
 
27
  function NewsModules_RichSnippet_DisplayCategoryName()
28
  {
29
+ var node = RichSnippet_jQuery('select[id^="group_"][id$="richsnippet_category"]');
30
  var val = node.val();
31
  var text = node.find("[value='"+val+"']").text();
32
  RichSnippet_jQuery('#richsnippet_category_text').html(text);
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NewsModules_RichSnippet</name>
4
- <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -16,11 +16,11 @@ The "brand" meta is passed only if the product's attribute set using the product
16
  &#xD;
17
  The "category" meta is passed only if the current category has been set the attribute "Rich Snippets Category".&#xD;
18
  The items listed in this attribute are the categories used by Google.</description>
19
- <notes>Fix full view of the attribute Rich Snippet Category in Manage Category.</notes>
20
  <authors><author><name>Alessandro Lioce</name><user>alioce</user><email>a.lioce@ne-ws.it</email></author></authors>
21
- <date>2014-06-11</date>
22
- <time>09:08:55</time>
23
- <contents><target name="magecommunity"><dir name="NewsModules"><dir name="RichSnippet"><dir name="Helper"><file name="Copia di Data.php" hash="be6be1f187786b8b5cf1185efcc72fd6"/><file name="Data.php" hash="b88b2bec7bf1586e31bb51de1ddd0383"/></dir><dir name="Model"><dir name="Entity"><dir name="Attribute"><dir name="Source"><file name="Category.php" hash="f82f3126521aa6d2744df3cd3158eb2d"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="255a542deeec2d4c70073b80427fb019"/></dir><dir name="sql"><dir name="richsnippet_setup"><file name="mysql4-install-0.1.0.php" hash="f10f6a9ef680bf19d24520c6dbcf402a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NewsModules_RichSnippet.xml" hash="d422846758fa0117ea973488b366a8ca"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="richsnippet.xml" hash="d09d63ce504e84bf9049f8683f6333dc"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="richsnippet.xml" hash="7dfe678289ad761025473b38c48577c7"/></dir><dir name="template"><dir name="richsnippet"><dir><dir name="bundle"><dir name="catalog"><dir name="product"><file name="price.phtml" hash="6e4f235b27905fb8fdf33db30cfd320d"/></dir></dir></dir><dir name="catalog"><dir name="product"><file name="price.phtml" hash="dedc2a7f819b5a0e4473f60ea604d82c"/><dir name="view"><file name="media.phtml" hash="494023355b297abce31371c0749c0bfe"/><dir name="type"><dir name="availability"><file name="default.phtml" hash="60a9ee05bbd8d4e58776f0b348304b34"/><file name="grouped.phtml" hash="4a3a1cc12d528a057dd91a7d5a337008"/></dir></dir></dir><file name="view.phtml" hash="ce115b4d74f2d34c281e6d54c747ebc0"/></dir></dir><dir name="page"><dir name="html"><file name="breadcrumbs.phtml" hash="5b393d6be60c96b9cb2564498a1c60c6"/></dir></dir><dir name="product"><file name="offer.phtml" hash="3c205b858342cc81b2d02fb15b3d6de1"/></dir></dir><file name="product.phtml" hash="15d55996dd9c9a01b53df12045208412"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="newsmodules"><dir name="richsnippet"><dir name="adminhtml"><dir name="catalog"><file name="category.js" hash="337e50bb7674d14f4efda5de2075f2e1"/></dir></dir><file name="jquery-1.11.1.min.js" hash="8101d596b2b8fa35fe3a634ea342d7c3"/><file name="jquery-noconflict.js" hash="42b1d039453c297cca03ae96c875fb7b"/></dir></dir></dir></target></contents>
24
  <compatible/>
25
  <dependencies><required><php><min>5.2.13</min><max>5.4.29</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
26
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NewsModules_RichSnippet</name>
4
+ <version>0.1.2</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
16
  &#xD;
17
  The "category" meta is passed only if the current category has been set the attribute "Rich Snippets Category".&#xD;
18
  The items listed in this attribute are the categories used by Google.</description>
19
+ <notes>Added uninstall script</notes>
20
  <authors><author><name>Alessandro Lioce</name><user>alioce</user><email>a.lioce@ne-ws.it</email></author></authors>
21
+ <date>2014-06-30</date>
22
+ <time>15:17:43</time>
23
+ <contents><target name="magecommunity"><dir name="NewsModules"><dir name="RichSnippet"><dir name="Helper"><file name="Copia di Data.php" hash="be6be1f187786b8b5cf1185efcc72fd6"/><file name="Data.php" hash="b88b2bec7bf1586e31bb51de1ddd0383"/></dir><dir name="Model"><dir name="Entity"><dir name="Attribute"><dir name="Source"><file name="Category.php" hash="f82f3126521aa6d2744df3cd3158eb2d"/></dir></dir></dir></dir><dir name="controllers"><file name="UninstallController.php" hash="158471444d43a8fc89b58c389c016e50"/></dir><dir name="etc"><file name="adminhtml.xml" hash="114e7bb3398a439a95d4f9baad43e12d"/><file name="config.xml" hash="a68550db6131deafec300497ca5479db"/><file name="system.xml" hash="f9f43760b9c06e674620d06117e12c48"/></dir><dir name="sql"><dir name="richsnippet_setup"><file name="mysql4-install-0.1.0.php" hash="5d30d547bd98a45c343bd00961b35d73"/><file name="upgrade-0.1.0-0.1.1.php" hash="d650e9c46bb919c6e28767031cabb83e"/><file name="upgrade-0.1.0-0.1.2.php" hash="d650e9c46bb919c6e28767031cabb83e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NewsModules_RichSnippet.xml" hash="d422846758fa0117ea973488b366a8ca"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="richsnippet.xml" hash="d09d63ce504e84bf9049f8683f6333dc"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="richsnippet.xml" hash="ec18f0260362d19d3e3cc39d4d96cbf3"/></dir><dir name="template"><dir name="richsnippet"><dir><dir name="bundle"><dir name="catalog"><dir name="product"><file name="price.phtml" hash="6e4f235b27905fb8fdf33db30cfd320d"/></dir></dir></dir><dir name="catalog"><dir name="product"><file name="price.phtml" hash="dedc2a7f819b5a0e4473f60ea604d82c"/><dir name="view"><file name="media.phtml" hash="494023355b297abce31371c0749c0bfe"/><dir name="type"><dir name="availability"><file name="default.phtml" hash="60a9ee05bbd8d4e58776f0b348304b34"/><file name="grouped.phtml" hash="4a3a1cc12d528a057dd91a7d5a337008"/></dir></dir></dir><file name="view.phtml" hash="ce115b4d74f2d34c281e6d54c747ebc0"/></dir></dir><dir name="page"><dir name="html"><file name="breadcrumbs.phtml" hash="5b393d6be60c96b9cb2564498a1c60c6"/></dir></dir><dir name="product"><file name="offer.phtml" hash="3c205b858342cc81b2d02fb15b3d6de1"/></dir><dir name="uninstall"><file name="index.phtml" hash="feb3d1de9ff02b0ef9de2b199bf5303f"/></dir></dir><file name="product.phtml" hash="15d55996dd9c9a01b53df12045208412"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="newsmodules"><dir name="richsnippet"><dir name="adminhtml"><dir name="catalog"><file name="category.js" hash="0bfcb70b8bead57737d9c7028dd211e3"/></dir></dir><file name="jquery-1.11.1.min.js" hash="8101d596b2b8fa35fe3a634ea342d7c3"/><file name="jquery-noconflict.js" hash="42b1d039453c297cca03ae96c875fb7b"/></dir></dir></dir></target></contents>
24
  <compatible/>
25
  <dependencies><required><php><min>5.2.13</min><max>5.4.29</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
26
  </package>