google_rich_cards_weltpixel - Version 1.0.1

Version Notes

- initial release

Download this release

Release Info

Developer Virgil Ghic
Extension google_rich_cards_weltpixel
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0 to 1.0.1

app/code/community/WeltPixel/GoogleCards/Block/Googlecards.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WeltPixel_GoogleCards_Block_Googlecards
4
+ extends Mage_Core_Block_Template
5
+ {
6
+ public function getProduct()
7
+ {
8
+ return Mage::registry('current_product');
9
+ }
10
+
11
+ public function getNonCachedImage($product)
12
+ {
13
+ $_image = Mage::getBaseUrl('media') . 'catalog/product' . $product->getImage();
14
+ return $_image;
15
+ }
16
+
17
+ public function getProductPrice()
18
+ {
19
+ $price = $this->getProduct()->getFinalPrice();
20
+ return $price;
21
+ }
22
+
23
+ public function getProductDescription($_product)
24
+ {
25
+ if (Mage::getStoreConfig('weltpixel_googlecards/general/description')) {
26
+ return nl2br($_product->getData('description'));
27
+ } else {
28
+ return nl2br($_product->getData('short_description'));
29
+ }
30
+ }
31
+
32
+ public function getReviewSummary()
33
+ {
34
+ $storeId = Mage::app()->getStore()->getId();
35
+ $summaryData = Mage::getModel('review/review_summary')
36
+ ->setStoreId($storeId)
37
+ ->load($this->getProduct()->getId());
38
+ return $summaryData;
39
+ }
40
+
41
+ public function getCurrencyCode()
42
+ {
43
+ return Mage::app()->getStore()->getCurrentCurrencyCode();
44
+ }
45
+
46
+ public function getBrand() {
47
+ $brandAttribute = Mage::getStoreConfig('weltpixel_googlecards/general/brand');
48
+ $brandName = '';
49
+ if ($brandAttribute) {
50
+ try {
51
+ $brandName = $this->getProduct()->getAttributeText($brandAttribute);
52
+ if (is_array($brandName) || !$brandName) {
53
+ $brandName = $this->getProduct()->getData($brandAttribute);
54
+ }
55
+ } catch (Exception $ex) {
56
+ $brandName = '';
57
+ }
58
+ }
59
+ return $brandName;
60
+ }
61
+ }
app/code/community/WeltPixel/GoogleCards/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class WeltPixel_GoogleCards_Helper_Data extends Mage_Core_Helper_Abstract {
4
+
5
+ }
app/code/community/WeltPixel/GoogleCards/Model/Adminhtml/System/Config/Brand.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WeltPixel_GoogleCards_Model_Adminhtml_System_Config_Brand {
4
+
5
+ public function toOptionArray() {
6
+ $options = array();
7
+ $options[] = array(
8
+ 'value' => 0,
9
+ 'label' => Mage::helper('weltpixel_googlecards')->__('Please select')
10
+ );
11
+ $collection = Mage::getResourceModel('catalog/product_attribute_collection')
12
+ ->addVisibleFilter()
13
+ ->setOrder('frontend_label', 'ASC');
14
+
15
+ foreach ($collection->getItems() as $attr) {
16
+ $options[] = array(
17
+ 'value' => $attr->getData('attribute_code'),
18
+ 'label' => $attr->getData('frontend_label')
19
+ );
20
+ }
21
+
22
+ return $options;
23
+ }
24
+ }
app/code/community/WeltPixel/GoogleCards/Model/Adminhtml/System/Config/Description.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WeltPixel_GoogleCards_Model_Adminhtml_System_Config_Description {
4
+
5
+ public function toOptionArray() {
6
+ $options = array();
7
+
8
+ $options[] = array(
9
+ 'value' => 0,
10
+ 'label' => Mage::helper('weltpixel_googlecards')->__('Short Description')
11
+ );
12
+
13
+ $options[] = array(
14
+ 'value' => 1,
15
+ 'label' => Mage::helper('weltpixel_googlecards')->__('Long Description')
16
+ );
17
+
18
+ return $options;
19
+ }
20
+ }
app/code/community/WeltPixel/GoogleCards/etc/adminhtml.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <weltpixel translate="title">
5
+ <title>WeltPixel</title>
6
+ <sort_order>300</sort_order>
7
+ <children>
8
+ <googlecards translate="title" module="weltpixel_googlecards">
9
+ <title>Google Cards</title>
10
+ <action>adminhtml/system_config/edit/section/weltpixel_googlecards</action>
11
+ <sort_order>30</sort_order>
12
+ </googlecards>
13
+ </children>
14
+ </weltpixel>
15
+ </menu>
16
+ <acl>
17
+ <resources>
18
+ <admin>
19
+ <children>
20
+ <system>
21
+ <children>
22
+ <config>
23
+ <children>
24
+ <weltpixel_googlecards translate="title" module="weltpixel_googlecards">
25
+ <title>WeltPixel Google Cards</title>
26
+ <sort_order>1200</sort_order>
27
+ </weltpixel_googlecards>
28
+ </children>
29
+ </config>
30
+ </children>
31
+ </system>
32
+ </children>
33
+ </admin>
34
+ </resources>
35
+ </acl>
36
+ </config>
app/code/community/WeltPixel/GoogleCards/etc/config.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <WeltPixel_GoogleCards>
5
+ <version>1.0.0</version>
6
+ </WeltPixel_GoogleCards>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <weltpixel_googlecards>
11
+ <class>WeltPixel_GoogleCards_Block</class>
12
+ </weltpixel_googlecards>
13
+ </blocks>
14
+ <helpers>
15
+ <weltpixel_googlecards>
16
+ <class>WeltPixel_GoogleCards_Helper</class>
17
+ </weltpixel_googlecards>
18
+ </helpers>
19
+ <models>
20
+ <weltpixel_googlecards>
21
+ <class>WeltPixel_GoogleCards_Model</class>
22
+ </weltpixel_googlecards>
23
+ </models>
24
+ </global>
25
+ <frontend>
26
+ <layout>
27
+ <updates>
28
+ <weltpixel_googlecards>
29
+ <file>weltpixel/googlecards.xml</file>
30
+ </weltpixel_googlecards>
31
+ </updates>
32
+ </layout>
33
+ </frontend>
34
+ <default>
35
+ <weltpixel_googlecards>
36
+ <general>
37
+ <enable>1</enable>
38
+ <description>0</description>
39
+ <brand>0</brand>
40
+ </general>
41
+ </weltpixel_googlecards>
42
+ </default>
43
+ </config>
app/code/community/WeltPixel/GoogleCards/etc/system.xml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <weltpixel translate="label">
5
+ <label>WeltPixel Extensions</label>
6
+ <sort_order>150</sort_order>
7
+ </weltpixel>
8
+ </tabs>
9
+ <sections>
10
+ <weltpixel_googlecards translate="label" module="weltpixel_googlecards">
11
+ <label>GoogleCards Setings</label>
12
+ <tab>weltpixel</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>205</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
+ <general translate="label" module="weltpixel_googlecards">
20
+ <label>General</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" module="weltpixel_googlecards">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</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
+ </enable>
36
+ <description translate="label" module="weltpixel_googlecards">
37
+ <label>Description</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>weltpixel_googlecards/adminhtml_system_config_description</source_model>
40
+ <sort_order>10</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <depends>
45
+ <enable>1</enable>
46
+ </depends>
47
+ </description>
48
+ <brand translate="label" module="weltpixel_googlecards">
49
+ <label>Brand</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>weltpixel_googlecards/adminhtml_system_config_brand</source_model>
52
+ <sort_order>20</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <depends>
57
+ <enable>1</enable>
58
+ </depends>
59
+ </brand>
60
+ </fields>
61
+ </general>
62
+ </groups>
63
+ </weltpixel_googlecards>
64
+ </sections>
65
+ </config>
app/design/frontend/base/default/layout/weltpixel/googlecards.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0.0">
3
+ <catalog_product_view>
4
+ <reference name="head">
5
+ <block type="weltpixel_googlecards/googlecards" name="weltpixel_googlecards_head">
6
+ <action method="setTemplate">
7
+ <template>weltpixel/googlecards/meta_head.phtml</template>
8
+ </action>
9
+ </block>
10
+ </reference>
11
+ </catalog_product_view>
12
+ </layout>
app/design/frontend/base/default/template/weltpixel/googlecards/meta_head.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_product = $this->getProduct() ?>
2
+
3
+ <?php if (Mage::getStoreConfig('weltpixel_googlecards/general/enable')): ?>
4
+ <?php
5
+ $review = $this->getReviewSummary();
6
+ $reviewCount = $review->getReviewsCount();
7
+ if (!$reviewCount) {
8
+ $reviewCount = 0;
9
+ }
10
+ $ratingSummary = ($review->getRatingSummary()) ? $review->getRatingSummary() : 20;
11
+ ?>
12
+ <script type="application/ld+json">
13
+ {
14
+ "@context": "http://schema.org/",
15
+ "@type": "Product",
16
+ "name": "<?php echo htmlentities(strip_tags($_product->getName())) ?>",
17
+ "image": "<?php echo $this->getNonCachedImage($_product) ?>",
18
+ "description": "<?php echo htmlentities(strip_tags($this->getProductDescription($_product))) ?>",
19
+ "sku": "<?php echo htmlentities(strip_tags($_product->getSku())) ?>",
20
+ <?php if (strlen(trim($this->getBrand()))): ?>
21
+ "brand": {
22
+ "@type": "Thing",
23
+ "name": "<?php echo $this->getBrand(); ?>"
24
+ },
25
+ <?php endif ?>
26
+ "aggregateRating": {
27
+ "@type": "AggregateRating",
28
+ "bestRating": 5,
29
+ "worstRating": 1,
30
+ "ratingValue": "<?php echo $ratingSummary / 20 ; ?>",
31
+ "reviewCount": "<?php echo $reviewCount ?>"
32
+ },
33
+ "offers": {
34
+ "@type": "Offer",
35
+ "priceCurrency": "<?php echo $this->getCurrencyCode() ?>",
36
+ <?php if ($_product->isAvailable()): ?>
37
+ "availability": "http://schema.org/InStock",
38
+ <?php else : ?>
39
+ "availability": "http://schema.org/OutOfStock",
40
+ <?php endif; ?>
41
+ "price": "<?php echo $this->getProductPrice() ?>"
42
+ }
43
+ }
44
+ </script>
45
+ <?php endif ?>
app/etc/modules/WeltPixel_GoogleCards.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <WeltPixel_GoogleCards>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </WeltPixel_GoogleCards>
8
+ </modules>
9
+ </config>
package.xml CHANGED
@@ -1,46 +1,50 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>google_rich_cards_weltpixel</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Highlight your products and draw organic traffic with Google Rich Cards</summary>
10
- <description>&lt;h1&gt;&#xA0;&lt;/h1&gt;&#xD;
11
- &lt;p&gt;&lt;strong&gt;Improve your website appearance in Mobile organic search with new Rich Cards available from Google.Increase your visibility with Rich Cards and you can draw more traffic to your online store.&lt;/strong&gt;&#xA0;&lt;/p&gt;&#xD;
12
- &lt;p&gt;&lt;br /&gt;Rich cards use scema.org structured markup to display your content, like rich snippets, but in a more atracting and visual way on mobile devices.&lt;br /&gt;&lt;br /&gt;This is a new opportunity to be highlighted in Search results and attract more targeted users to your page. This visual format helps users find what they want as soon as they visualize it.&lt;strong&gt; &lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&#xD;
13
- &lt;ul&gt;&#xD;
14
- &lt;li&gt;Improve your website appearance&lt;/li&gt;&#xD;
15
- &lt;li&gt;Enhance your visibility in search results&lt;/li&gt;&#xD;
16
- &lt;li&gt;Get more targeted traffic&lt;/li&gt;&#xD;
17
- &lt;li&gt;Boost your conversion rate&lt;/li&gt;&#xD;
18
- &lt;li&gt;Raise your brand awareness&lt;/li&gt;&#xD;
19
- &lt;/ul&gt;&#xD;
20
- &lt;p&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;FEATURES: &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&#xD;
21
- &lt;ul&gt;&#xD;
22
- &lt;li&gt;Enable or disable rich cards&lt;/li&gt;&#xD;
23
- &lt;li&gt;Made according to the latest Google and Schema.org standards&lt;/li&gt;&#xD;
24
- &lt;li&gt;No limit on store views within one Magento installation&lt;/li&gt;&#xD;
25
- &lt;li&gt;No limit of products or customers&lt;/li&gt;&#xD;
26
- &lt;li&gt;Meets Magento programming practices and customization compatibility for most versions&lt;/li&gt;&#xD;
27
- &lt;li&gt;Easy to setup&lt;/li&gt;&#xD;
28
- &lt;li&gt;Easy installation&lt;/li&gt;&#xD;
29
- &lt;/ul&gt;&#xD;
30
- &lt;p&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;HOW TO INSTALL:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&#xD;
31
- &lt;ol&gt;&#xD;
32
- &lt;li&gt;Disable compilations via &lt;strong&gt;system-&gt;tools-&gt;Compilations&lt;/strong&gt;&lt;/li&gt;&#xD;
33
- &lt;li&gt;Clear cache by going into &lt;strong&gt;System-&gt; Cache Management&lt;/strong&gt;, selecting all the files in the list, choosing the &lt;strong&gt;refresh&lt;/strong&gt; option in the dropdown menu, and finally clicking &lt;strong&gt;Submit&lt;/strong&gt;.&lt;/li&gt;&#xD;
34
- &lt;li&gt;Unzip the folder where the extension is stored and copy the App folder into either your store root directory using your FTP.&lt;/li&gt;&#xD;
35
- &lt;li&gt;Log out of your admin panel, and log back in again&lt;/li&gt;&#xD;
36
- &lt;li&gt;&lt;strong&gt;Woohoo, the extension is installed!&lt;/strong&gt;&lt;/li&gt;&#xD;
37
- &lt;/ol&gt;&#xD;
38
- &lt;p&gt;&lt;strong&gt;&#xA0;&lt;/strong&gt;&lt;/p&gt;</description>
 
 
 
 
39
  <notes>- initial release</notes>
40
  <authors><author><name>Virgil Ghic</name><user>virgil</user><email>mail@weltpixel.com</email></author></authors>
41
  <date>2016-05-25</date>
42
- <time>13:31:51</time>
43
- <contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="weltpixel"><file name="googlecards.xml" hash=""/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="WeltPixel_GoogleCards.xml" hash=""/></dir></target></contents>
44
  <compatible/>
45
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
46
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>google_rich_cards_weltpixel</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Highlight your products and draw organic traffic with Google Rich Cards</summary>
10
+ <description>Improve your website appearance in Mobile organic search with new Rich Cards available from Google.Increase your visibility with Rich Cards and you can draw more traffic to your online store. &#xD;
11
+ &#xD;
12
+ &#xD;
13
+ Rich cards use scema.org structured markup to display your content, like rich snippets, but in a more atracting and visual way on mobile devices.&#xD;
14
+ &#xD;
15
+ This is a new opportunity to be highlighted in Search results and attract more targeted users to your page. This visual format helps users find what they want as soon as they visualize it. &#xD;
16
+ &#xD;
17
+ &#xD;
18
+ Improve your website appearance&#xD;
19
+ Enhance your visibility in search results&#xD;
20
+ Get more targeted traffic&#xD;
21
+ Boost your conversion rate&#xD;
22
+ Raise your brand awareness&#xD;
23
+ &#xD;
24
+ &#xD;
25
+ FEATURES: &#xD;
26
+ -Enable or disable rich cards&#xD;
27
+ -Made according to the latest Google and Schema.org standards&#xD;
28
+ -No limit on store views within one Magento installation&#xD;
29
+ -No limit of products or customers&#xD;
30
+ -Meets Magento programming practices and customization compatibility for most versions&#xD;
31
+ -Easy to setup&#xD;
32
+ -Easy installation&#xD;
33
+ &#xD;
34
+ &#xD;
35
+ HOW TO INSTALL:&#xD;
36
+ &#xD;
37
+ &#xD;
38
+ 1. Disable compilations via system-&gt;tools-&gt;Compilations&#xD;
39
+ 2. Clear cache by going into System-&gt; Cache Management, selecting all the files in the list, choosing the refresh option in the dropdown menu, and finally clicking Submit.&#xD;
40
+ 3. Unzip the folder where the extension is stored and copy the App folder into either your store root directory using your FTP.&#xD;
41
+ 4. Log out of your admin panel, and log back in again&#xD;
42
+ 5. Woohoo, the extension is installed!</description>
43
  <notes>- initial release</notes>
44
  <authors><author><name>Virgil Ghic</name><user>virgil</user><email>mail@weltpixel.com</email></author></authors>
45
  <date>2016-05-25</date>
46
+ <time>14:47:47</time>
47
+ <contents><target name="magecommunity"><dir name="WeltPixel"><dir name="GoogleCards"><dir name="Block"><file name="Googlecards.php" hash="8efbc070d0b0c5db9bd127b63ac865e5"/></dir><dir name="Helper"><file name="Data.php" hash="2bfe135bba7c2f8ef2e7f3be3f4374c6"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Brand.php" hash="f4aecea72a2b25d241b6c279c29964a9"/><file name="Description.php" hash="d7ff077f938e3778ee7369deed1ab890"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="b5c0945a37509307af2bd98805ec75ad"/><file name="config.xml" hash="bbbefc67b8dc47f723eadddd6178514c"/><file name="system.xml" hash="3d1b0343777e569b00f599f9712ec686"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="weltpixel"><file name="googlecards.xml" hash="6e186024bfa6fc0f323de7ae188e6b66"/></dir></dir><dir name="template"><dir name="weltpixel"><dir name="googlecards"><file name="meta_head.phtml" hash="0e686bcbc375f3459a088d577ee51da2"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="WeltPixel_GoogleCards.xml" hash="1941ce65eea76d6f91433ff16e094616"/></dir></target></contents>
48
  <compatible/>
49
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
50
  </package>