Version Notes
+ Automatic markup creation;
+ The extension displays in search results: product name, stock status, price, currency, product description, product ID;
+ Intuitive interface;
+ Easy 2-minutes installation;
+ Meets Magento programming practices for most versions and customizations compatibility.
Download this release
Release Info
Developer | MagPleasure Ltd. |
Extension | rich_snippets |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Magpleasure/Richsnippets/Block/Catalog/Product/View.php +51 -0
- app/code/local/Magpleasure/Richsnippets/Block/Catalog/Product/View/Markup.php +46 -0
- app/code/local/Magpleasure/Richsnippets/Helper/Data.php +82 -0
- app/code/local/Magpleasure/Richsnippets/Model/Observer.php +28 -0
- app/code/local/Magpleasure/Richsnippets/etc/config.xml +164 -0
- app/code/local/Magpleasure/Richsnippets/etc/system.xml +57 -0
- app/design/frontend/base/default/layout/richsnippets.xml +26 -0
- app/design/frontend/base/default/template/richsnippets/catalog/product/view/markup.phtml +57 -0
- app/etc/modules/Magpleasure_Richsnippets.xml +26 -0
- app/locale/en_US/Magpleasure_Richsnippets.csv +4 -0
- package.xml +23 -0
app/code/local/Magpleasure/Richsnippets/Block/Catalog/Product/View.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magpleasure Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magpleasure.com/LICENSE.txt
|
12 |
+
*
|
13 |
+
* @category Magpleasure
|
14 |
+
* @package Magpleasure_Richsnippets
|
15 |
+
* @copyright Copyright (c) 2014 Magpleasure Ltd. (http://www.magpleasure.com)
|
16 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
17 |
+
*/
|
18 |
+
class Magpleasure_Richsnippets_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View
|
19 |
+
{
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Rich snippets helper
|
23 |
+
*
|
24 |
+
* @return Magpleasure_Richsnippets_Helper_Data
|
25 |
+
*/
|
26 |
+
protected function _helper()
|
27 |
+
{
|
28 |
+
return Mage::helper('richsnippets');
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Render block HTML
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
protected function _toHtml()
|
37 |
+
{
|
38 |
+
$html = parent::_toHtml();
|
39 |
+
if ($this->_helper()->getConfigValue('general', 'enabled')) {
|
40 |
+
$html = $this->_insertRichSnippets($html);
|
41 |
+
}
|
42 |
+
return $html;
|
43 |
+
}
|
44 |
+
|
45 |
+
protected function _insertRichSnippets($html)
|
46 |
+
{
|
47 |
+
$markup = $this->getLayout()->getBlock('mp.richsnippets')->toHtml();
|
48 |
+
$html = preg_replace('/(div.*?class=".*?product-view.*?".*?)>/', '$1 itemscope itemtype="http://schema.org/Product">' . $markup, $html);
|
49 |
+
return $html;
|
50 |
+
}
|
51 |
+
}
|
app/code/local/Magpleasure/Richsnippets/Block/Catalog/Product/View/Markup.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magpleasure Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magpleasure.com/LICENSE.txt
|
12 |
+
*
|
13 |
+
* @category Magpleasure
|
14 |
+
* @package Magpleasure_Richsnippets
|
15 |
+
* @copyright Copyright (c) 2014 Magpleasure Ltd. (http://www.magpleasure.com)
|
16 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
17 |
+
*/
|
18 |
+
class Magpleasure_Richsnippets_Block_Catalog_Product_View_Markup extends Mage_Catalog_Block_Product_View
|
19 |
+
{
|
20 |
+
const CACHE_TAG = 'MP_RS_MARKUP';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Internal constructor
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
parent::_construct();
|
29 |
+
|
30 |
+
$this->addData(array(
|
31 |
+
'cache_lifetime' => 3600,
|
32 |
+
'cache_tags' => array(Mage_Catalog_Model_Product::CACHE_TAG . "_" . $this->getProduct()->getId()),
|
33 |
+
'cache_key' => self::CACHE_TAG . '_' . Mage::app()->getStore()->getCode() . '_' . $this->getProduct()->getId(),
|
34 |
+
));
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Rich snippets helper
|
39 |
+
*
|
40 |
+
* @return Magpleasure_Richsnippets_Helper_Data
|
41 |
+
*/
|
42 |
+
protected function _helper()
|
43 |
+
{
|
44 |
+
return Mage::helper('richsnippets');
|
45 |
+
}
|
46 |
+
}
|
app/code/local/Magpleasure/Richsnippets/Helper/Data.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magpleasure Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magpleasure.com/LICENSE.txt
|
12 |
+
*
|
13 |
+
* @category Magpleasure
|
14 |
+
* @package Magpleasure_Richsnippets
|
15 |
+
* @copyright Copyright (c) 2014 Magpleasure Ltd. (http://www.magpleasure.com)
|
16 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
17 |
+
*/
|
18 |
+
class Magpleasure_Richsnippets_Helper_Data extends Mage_Core_Helper_Abstract
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Value from config path 'richsnippets/group/field'
|
22 |
+
*
|
23 |
+
* @param $group
|
24 |
+
* @param $field
|
25 |
+
* @return mixed
|
26 |
+
*/
|
27 |
+
public function getConfigValue($group, $field)
|
28 |
+
{
|
29 |
+
return Mage::getStoreConfig('richsnippets' . DS . $group . DS . $field);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Calculate default configurable price for bundle product
|
34 |
+
*
|
35 |
+
* @param $product
|
36 |
+
* @return int
|
37 |
+
*/
|
38 |
+
public function getConfiguredPrice($product)
|
39 |
+
{
|
40 |
+
if (Mage_Catalog_Model_Product_Type::TYPE_BUNDLE != $product->getTypeId()) {
|
41 |
+
return 0;
|
42 |
+
}
|
43 |
+
$priceModel = $product->getPriceModel();
|
44 |
+
$bundleBlock = Mage::getSingleton('core/layout')->createBlock('bundle/catalog_product_view_type_bundle');
|
45 |
+
$options = $bundleBlock->setProduct($product)->getOptions();
|
46 |
+
$price = 0;
|
47 |
+
/** @var Mage_Bundle_Model_Option $option */
|
48 |
+
foreach ($options as $option) {
|
49 |
+
$selection = $option->getDefaultSelection();
|
50 |
+
if (null === $selection) {
|
51 |
+
continue;
|
52 |
+
}
|
53 |
+
$price += $priceModel->getSelectionPreFinalPrice($product, $selection, $selection->getSelectionQty());
|
54 |
+
}
|
55 |
+
return $price;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Calculate default price for grouped product
|
60 |
+
*
|
61 |
+
* @param $groupedProduct
|
62 |
+
* @param bool $incTax
|
63 |
+
* @return int
|
64 |
+
*/
|
65 |
+
public function getGroupedProductPrice($groupedProduct, $incTax = true)
|
66 |
+
{
|
67 |
+
$productIds = $groupedProduct->getTypeInstance()->getChildrenIds($groupedProduct->getId());
|
68 |
+
$price = 0;
|
69 |
+
foreach ($productIds as $ids) {
|
70 |
+
foreach ($ids as $id) {
|
71 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
72 |
+
if ($incTax) {
|
73 |
+
$price += Mage::helper('tax')->getPrice($product, $product->getPriceModel()->getFinalPrice(null, $product, true), true);
|
74 |
+
} else {
|
75 |
+
$price += $product->getPriceModel()->getFinalPrice(null, $product, true);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
return $price;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
app/code/local/Magpleasure/Richsnippets/Model/Observer.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magpleasure Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magpleasure.com/LICENSE.txt
|
12 |
+
*
|
13 |
+
* @category Magpleasure
|
14 |
+
* @package Magpleasure_Richsnippets
|
15 |
+
* @copyright Copyright (c) 2014 Magpleasure Ltd. (http://www.magpleasure.com)
|
16 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
17 |
+
*/
|
18 |
+
class Magpleasure_Richsnippets_Model_Observer extends Mage_Core_Block_Abstract
|
19 |
+
{
|
20 |
+
public function productPageBeforeLoad()
|
21 |
+
{
|
22 |
+
if (Mage::helper('core')->isModuleOutputEnabled('Magpleasure_Richsnippets')) {
|
23 |
+
$node = Mage::getConfig()->getNode('global/blocks/catalog/rewrite');
|
24 |
+
$richNode = Mage::getConfig()->getNode('global/blocks/catalog/richrewrite/product_view');
|
25 |
+
$node->appendChild($richNode);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
app/code/local/Magpleasure/Richsnippets/etc/config.xml
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magpleasure Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magpleasure.com/LICENSE.txt
|
12 |
+
*
|
13 |
+
* @category Magpleasure
|
14 |
+
* @package Magpleasure_Richsnippets
|
15 |
+
* @copyright Copyright (c) 2014 Magpleasure Ltd. (http://www.magpleasure.com)
|
16 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<modules>
|
21 |
+
<Magpleasure_Richsnippets>
|
22 |
+
<version>1.0</version>
|
23 |
+
</Magpleasure_Richsnippets>
|
24 |
+
</modules>
|
25 |
+
<frontend>
|
26 |
+
<routers>
|
27 |
+
<richsnippets>
|
28 |
+
<use>standard</use>
|
29 |
+
<args>
|
30 |
+
<module>Magpleasure_Richsnippets</module>
|
31 |
+
<frontName>richsnippets</frontName>
|
32 |
+
</args>
|
33 |
+
</richsnippets>
|
34 |
+
</routers>
|
35 |
+
<layout>
|
36 |
+
<updates>
|
37 |
+
<richsnippets>
|
38 |
+
<file>richsnippets.xml</file>
|
39 |
+
</richsnippets>
|
40 |
+
</updates>
|
41 |
+
</layout>
|
42 |
+
<translate>
|
43 |
+
<modules>
|
44 |
+
<Magpleasure_Richsnippets>
|
45 |
+
<files>
|
46 |
+
<default>Magpleasure_Richsnippets.csv</default>
|
47 |
+
</files>
|
48 |
+
</Magpleasure_Richsnippets>
|
49 |
+
</modules>
|
50 |
+
</translate>
|
51 |
+
<events>
|
52 |
+
<controller_action_predispatch_catalog_product_view>
|
53 |
+
<observers>
|
54 |
+
<mp_richsnippets_product_view_predispatch>
|
55 |
+
<type>singleton</type>
|
56 |
+
<class>richsnippets/observer</class>
|
57 |
+
<method>productPageBeforeLoad</method>
|
58 |
+
</mp_richsnippets_product_view_predispatch>
|
59 |
+
</observers>
|
60 |
+
</controller_action_predispatch_catalog_product_view>
|
61 |
+
</events>
|
62 |
+
</frontend>
|
63 |
+
<global>
|
64 |
+
<models>
|
65 |
+
<richsnippets>
|
66 |
+
<class>Magpleasure_Richsnippets_Model</class>
|
67 |
+
</richsnippets>
|
68 |
+
</models>
|
69 |
+
<helpers>
|
70 |
+
<richsnippets>
|
71 |
+
<class>Magpleasure_Richsnippets_Helper</class>
|
72 |
+
</richsnippets>
|
73 |
+
</helpers>
|
74 |
+
<blocks>
|
75 |
+
<richsnippets>
|
76 |
+
<class>Magpleasure_Richsnippets_Block</class>
|
77 |
+
</richsnippets>
|
78 |
+
<catalog>
|
79 |
+
<rewrite></rewrite>
|
80 |
+
<richrewrite>
|
81 |
+
<product_view>Magpleasure_Richsnippets_Block_Catalog_Product_View</product_view>
|
82 |
+
</richrewrite>
|
83 |
+
</catalog>
|
84 |
+
</blocks>
|
85 |
+
<resources>
|
86 |
+
<richsnippets_setup>
|
87 |
+
<setup>
|
88 |
+
<module>Magpleasure_Ajaxreviews</module>
|
89 |
+
</setup>
|
90 |
+
<connection>
|
91 |
+
<use>core_setup</use>
|
92 |
+
</connection>
|
93 |
+
</richsnippets_setup>
|
94 |
+
<richsnippets_write>
|
95 |
+
<connection>
|
96 |
+
<use>core_write</use>
|
97 |
+
</connection>
|
98 |
+
</richsnippets_write>
|
99 |
+
<richsnippets_read>
|
100 |
+
<connection>
|
101 |
+
<use>core_read</use>
|
102 |
+
</connection>
|
103 |
+
</richsnippets_read>
|
104 |
+
</resources>
|
105 |
+
</global>
|
106 |
+
<admin>
|
107 |
+
<routers>
|
108 |
+
<richsnippets_admin>
|
109 |
+
<use>admin</use>
|
110 |
+
<args>
|
111 |
+
<module>Magpleasure_Richsnippets</module>
|
112 |
+
<frontName>richsnippets_admin</frontName>
|
113 |
+
</args>
|
114 |
+
</richsnippets_admin>
|
115 |
+
</routers>
|
116 |
+
</admin>
|
117 |
+
<adminhtml>
|
118 |
+
<acl>
|
119 |
+
<resources>
|
120 |
+
<all>
|
121 |
+
<title>Allow Everything</title>
|
122 |
+
</all>
|
123 |
+
<admin>
|
124 |
+
<children>
|
125 |
+
<system>
|
126 |
+
<children>
|
127 |
+
<config>
|
128 |
+
<children>
|
129 |
+
<richsnippets>
|
130 |
+
<title>Magpleasure - Rich Snippets</title>
|
131 |
+
</richsnippets>
|
132 |
+
</children>
|
133 |
+
</config>
|
134 |
+
</children>
|
135 |
+
</system>
|
136 |
+
</children>
|
137 |
+
</admin>
|
138 |
+
</resources>
|
139 |
+
</acl>
|
140 |
+
<layout>
|
141 |
+
<updates>
|
142 |
+
<richsnippets>
|
143 |
+
<file>richsnippets.xml</file>
|
144 |
+
</richsnippets>
|
145 |
+
</updates>
|
146 |
+
</layout>
|
147 |
+
<translate>
|
148 |
+
<modules>
|
149 |
+
<Magpleasure_Richsnippets>
|
150 |
+
<files>
|
151 |
+
<default>Magpleasure_Richsnippets.csv</default>
|
152 |
+
</files>
|
153 |
+
</Magpleasure_Richsnippets>
|
154 |
+
</modules>
|
155 |
+
</translate>
|
156 |
+
</adminhtml>
|
157 |
+
<default>
|
158 |
+
<richsnippets>
|
159 |
+
<general>
|
160 |
+
<enabled>1</enabled>
|
161 |
+
</general>
|
162 |
+
</richsnippets>
|
163 |
+
</default>
|
164 |
+
</config>
|
app/code/local/Magpleasure/Richsnippets/etc/system.xml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magpleasure Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magpleasure.com/LICENSE.txt
|
12 |
+
*
|
13 |
+
* @category Magpleasure
|
14 |
+
* @package Magpleasure_Richsnippets
|
15 |
+
* @copyright Copyright (c) 2014 Magpleasure Ltd. (http://www.magpleasure.com)
|
16 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<tabs>
|
21 |
+
<magpleasure translate="label" module="richsnippets">
|
22 |
+
<label>MagPleasure Extensions</label>
|
23 |
+
<sort_order>300</sort_order>
|
24 |
+
</magpleasure>
|
25 |
+
</tabs>
|
26 |
+
<sections>
|
27 |
+
<richsnippets module="richsnippets" translate="label">
|
28 |
+
<label>Rich Snippets</label>
|
29 |
+
<tab>magpleasure</tab>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>600</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 |
+
<groups>
|
36 |
+
<general>
|
37 |
+
<label>General Settings</label>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<fields>
|
43 |
+
<enabled translate="label">
|
44 |
+
<label>Enabled</label>
|
45 |
+
<frontend_type>select</frontend_type>
|
46 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
47 |
+
<sort_order>10</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
</enabled>
|
52 |
+
</fields>
|
53 |
+
</general>
|
54 |
+
</groups>
|
55 |
+
</richsnippets>
|
56 |
+
</sections>
|
57 |
+
</config>
|
app/design/frontend/base/default/layout/richsnippets.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magpleasure Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magpleasure.com/LICENSE.txt
|
12 |
+
*
|
13 |
+
* @category Magpleasure
|
14 |
+
* @package Magpleasure_Richsnippets
|
15 |
+
* @copyright Copyright (c) 2014 Magpleasure Ltd. (http://www.magpleasure.com)
|
16 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<layout version="0.1.0">
|
20 |
+
<catalog_product_view>
|
21 |
+
<reference name="product.info">
|
22 |
+
<block type="richsnippets/catalog_product_view_markup" template="richsnippets/catalog/product/view/markup.phtml" name="mp.richsnippets"/>
|
23 |
+
</reference>
|
24 |
+
</catalog_product_view>
|
25 |
+
</layout>
|
26 |
+
|
app/design/frontend/base/default/template/richsnippets/catalog/product/view/markup.phtml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magpleasure Ltd.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magpleasure.com/LICENSE.txt
|
11 |
+
*
|
12 |
+
* @category Magpleasure
|
13 |
+
* @package Magpleasure_Richsnippets
|
14 |
+
* @copyright Copyright (c) 2014 MagPleasure Ltd. (http://www.magpleasure.com)
|
15 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
/** @var $this Magpleasure_Richsnippets_Block_Catalog_Product_View_Markup */
|
19 |
+
/** @var $_priceModel Mage_Bundle_Model_Product_Price */
|
20 |
+
|
21 |
+
?>
|
22 |
+
<?php if ($this->_helper()->getConfigValue('general', 'enabled')): ?>
|
23 |
+
<?php $_product = $this->getProduct() ?>
|
24 |
+
<div style="display:none!important">
|
25 |
+
<?php $_image = Mage::helper('catalog/image')->init($_product, 'small_image')->resize(125, 125); ?>
|
26 |
+
<meta itemprop="image" content="<?php echo $_image; ?>">
|
27 |
+
<meta itemprop="name" content="<?php echo $this->escapeHtml($_product->getName()); ?>">
|
28 |
+
<meta itemprop="description" content="<?php echo $this->escapeHtml($_product->getDescription()); ?>">
|
29 |
+
<meta itemprop="productID" content="<?php echo $_product->getSku(); ?>">
|
30 |
+
</div>
|
31 |
+
<div style="display:none!important" itemscope itemprop="offers" itemtype="http://schema.org/Offer">
|
32 |
+
<?php if (Mage_Catalog_Model_Product_Type::TYPE_GROUPED == $_product->getTypeId()): ?>
|
33 |
+
<meta itemprop="price" content="<?php echo $this->_helper()->getGroupedProductPrice($_product); ?>">
|
34 |
+
<?php $_available = $_product->isAvailable() && count($_product->getTypeInstance()->getAssociatedProducts()) > 0; ?>
|
35 |
+
<meta itemprop="availability" content="<?php echo $_available ? 'http://schema.org/InStock' : 'http://schema.org/OutOfStock'; ?>">
|
36 |
+
<?php else: ?>
|
37 |
+
<?php if (Mage_Catalog_Model_Product_Type::TYPE_BUNDLE == $_product->getTypeId()): ?>
|
38 |
+
<?php $_priceModel = Mage::getModel('bundle/product_price'); ?>
|
39 |
+
<?php $_configuredPrice = $this->_helper()->getConfiguredPrice($_product); ?>
|
40 |
+
<?php $_minPrice = method_exists($_priceModel, 'getTotalPrices') ? $_priceModel->getTotalPrices($_product, 'min', 1) : $_priceModel->getPrices($_product, 'min'); ?>
|
41 |
+
<meta itemprop="price" content="<?php echo round($_configuredPrice ? $_configuredPrice : $_minPrice, 2); ?>">
|
42 |
+
<div style="display:none!important" itemscope itemprop="priceSpecification" itemtype="http://schema.org/PriceSpecification">
|
43 |
+
<meta itemprop="priceCurrency" content="<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>">
|
44 |
+
<meta itemprop="minPrice" content="<?php echo round($_minPrice, 2); ?>">
|
45 |
+
<?php $_maxPrice = method_exists($_priceModel, 'getTotalPrices') ? $_priceModel->getTotalPrices($_product, 'max', 1) : $_priceModel->getPrices($_product, 'max'); ?>
|
46 |
+
<meta itemprop="maxPrice" content="<?php echo round($_maxPrice, 2); ?>">
|
47 |
+
</div>
|
48 |
+
<?php elseif (method_exists(new Mage(), 'getEdition') && Mage::EDITION_ENTERPRISE == Mage::getEdition() && Enterprise_GiftCard_Model_Catalog_Product_Type_Giftcard::TYPE_GIFTCARD == $_product->getTypeId()): ?>
|
49 |
+
<meta itemprop="price" content="<?php echo round($_product->getPriceModel()->getMinAmount($_product), 2); ?>">
|
50 |
+
<?php else: ?>
|
51 |
+
<meta itemprop="price" content="<?php echo round($_product->getPriceModel()->getFinalPrice(null, $_product), 2); ?>">
|
52 |
+
<?php endif; ?>
|
53 |
+
<meta itemprop="availability" content="<?php echo $_product->isAvailable() ? 'http://schema.org/InStock' : 'http://schema.org/OutOfStock'; ?>">
|
54 |
+
<?php endif; ?>
|
55 |
+
<meta itemprop="priceCurrency" content="<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>">
|
56 |
+
</div>
|
57 |
+
<?php endif; ?>
|
app/etc/modules/Magpleasure_Richsnippets.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magpleasure Ltd.
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.magpleasure.com/LICENSE.txt
|
12 |
+
*
|
13 |
+
* @category Magpleasure
|
14 |
+
* @package Magpleasure_Richsnippets
|
15 |
+
* @copyright Copyright (c) 2014 Magpleasure Ltd. (http://www.magpleasure.com)
|
16 |
+
* @license http://www.magpleasure.com/LICENSE.txt
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<modules>
|
21 |
+
<Magpleasure_Richsnippets>
|
22 |
+
<active>true</active>
|
23 |
+
<codePool>local</codePool>
|
24 |
+
</Magpleasure_Richsnippets>
|
25 |
+
</modules>
|
26 |
+
</config>
|
app/locale/en_US/Magpleasure_Richsnippets.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
"Enabled","Enabled"
|
2 |
+
"General Settings","General Settings"
|
3 |
+
"MagPleasure Extensions","MagPleasure Extensions"
|
4 |
+
"Rich Snippets","Rich Snippets"
|
package.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>rich_snippets</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/OSL-3.0">OSL-3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Rich Snippets will allow you to integrate the information about product price, description, availability, currency etc. into search results.</summary>
|
10 |
+
<description>The extension is very easy-to use as there is only one option in the backend. You don’t need to do markups for Google by yourself: the extension will do it automatically.
|
11 |
+
Without Rich Snippets, the AJAX Reviews extension will not display product rating in Google search results.</description>
|
12 |
+
<notes>+ Automatic markup creation;
|
13 |
+
+ The extension displays in search results: product name, stock status, price, currency, product description, product ID;
|
14 |
+
+ Intuitive interface;
|
15 |
+
+ Easy 2-minutes installation;
|
16 |
+
+ Meets Magento programming practices for most versions and customizations compatibility.</notes>
|
17 |
+
<authors><author><name>MagPleasure Ltd.</name><user>Magpleasure</user><email>support@magpleasure.com</email></author></authors>
|
18 |
+
<date>2014-11-12</date>
|
19 |
+
<time>08:49:44</time>
|
20 |
+
<contents><target name="magelocal"><dir name="Magpleasure"><dir name="Richsnippets"><dir><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="View"><file name="Markup.php" hash="65d2f3816f74011c71f57c1cf114c7fc"/></dir><file name="View.php" hash="fafc74633d2da2e9424c244a4e95fd82"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="a4e5ffdc508b14e3ac7943f9a3826324"/></dir><dir name="Model"><file name="Observer.php" hash="d3dcb140deadb77529a5cdf3e95da462"/></dir><dir name="etc"><file name="config.xml" hash="1328e3968c9bc7cceb8daca8f200267e"/><file name="system.xml" hash="14320c63de223ce8a877a7ef1d3938d2"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="richsnippets.xml" hash="d4d735d9d86674455c90069d0f805fb8"/></dir><dir name="template"><dir name="richsnippets"><dir><dir name="catalog"><dir name="product"><dir name="view"><file name="markup.phtml" hash="9b8982fa76932bca6d9ed20db44c2189"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magpleasure_Richsnippets.xml" hash="a4cc0de1ab3b0fb132a1e4a2c22c66be"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Magpleasure_Richsnippets.csv" hash="c356d86fd9d1db251c8df93d5fd27ebc"/></dir></target></contents>
|
21 |
+
<compatible/>
|
22 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
23 |
+
</package>
|