Version Notes
1. Moved layout XML into a socialshare folder
2. Moved design phtml into base/default to support fallback of non-default based themes
3. Added logic to prevent Facebook Share JS from loading if no FB app-id is specified (body.html) -> prevents load & js errors for users who only need the OG metadata.
4. Added image upload functionality in adminhtml configuration for a default OG image (website logo, for instance). This is only loaded if no other image is found, and is not required.
5. Added OG Tags support for the homepage and Category pages
6. Added support for category images
7. Added support for MAP (if enabled in magento core config), final price vs special price/price and related logic.
8. Added support for product ratings
9. Built logic around an array to allow for defaults to be inserted for missing data.
10. Naming, capitalization and spelling in system.xml -> nothing that changes configuration values that already existed.
Release Info
Developer | Roy Toledo |
Extension | SocialShareOG |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.6.1 to 3.0.0
- app/code/community/SocialShare/OpenGraphTags/etc/adminhtml.xml +19 -19
- app/code/community/SocialShare/OpenGraphTags/etc/config.xml +112 -112
- app/code/community/SocialShare/OpenGraphTags/etc/system.xml +88 -67
- app/design/frontend/base/default/layout/socialshare/OpenGraphTags.xml +21 -0
- app/design/frontend/{default → base}/default/template/socialshare/body.phtml +2 -0
- app/design/frontend/base/default/template/socialshare/head.phtml +94 -0
- app/design/frontend/default/default/layout/OpenGraphTags.xml +0 -21
- app/design/frontend/default/default/template/socialshare/head.phtml +0 -19
- package.xml +17 -7
@@ -1,22 +1,22 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
</config>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<opengraphtags translate="title" module="opengraphtags">
|
12 |
+
<title>Open Graph Tags</title>
|
13 |
+
</opengraphtags>
|
14 |
+
</children>
|
15 |
+
</config>
|
16 |
+
</children>
|
17 |
+
</system>
|
18 |
+
</children>
|
19 |
+
</admin>
|
20 |
+
</resources>
|
21 |
+
</acl>
|
22 |
</config>
|
@@ -1,113 +1,113 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<SocialShare_OpenGraphTags>
|
5 |
-
<version>
|
6 |
-
</SocialShare_OpenGraphTags>
|
7 |
-
</modules>
|
8 |
-
|
9 |
-
<frontend>
|
10 |
-
<layout>
|
11 |
-
<updates>
|
12 |
-
<OpenGraphTags>
|
13 |
-
<file>OpenGraphTags.xml</file>
|
14 |
-
</OpenGraphTags>
|
15 |
-
</updates>
|
16 |
-
</layout>
|
17 |
-
|
18 |
-
</frontend>
|
19 |
-
|
20 |
-
<adminhtml>
|
21 |
-
<!--
|
22 |
-
<translate>
|
23 |
-
<modules>
|
24 |
-
<SocialShare_OpenGraphTags>
|
25 |
-
<files>
|
26 |
-
<default>SocialShare_OpenGraphTags.csv</default>
|
27 |
-
</files>
|
28 |
-
</SocialShare_OpenGraphTags>
|
29 |
-
</modules>
|
30 |
-
</translate>
|
31 |
-
-->
|
32 |
-
<acl>
|
33 |
-
<resources>
|
34 |
-
<admin>
|
35 |
-
<children>
|
36 |
-
<system>
|
37 |
-
<children>
|
38 |
-
<config>
|
39 |
-
<children>
|
40 |
-
<opengraphtags translate="title" module="opengraphtags">
|
41 |
-
<title>Social Share - Open Graph</title>
|
42 |
-
</opengraphtags>
|
43 |
-
</children>
|
44 |
-
</config>
|
45 |
-
</children>
|
46 |
-
</system>
|
47 |
-
</children>
|
48 |
-
</admin>
|
49 |
-
</resources>
|
50 |
-
</acl>
|
51 |
-
</adminhtml>
|
52 |
-
|
53 |
-
<global>
|
54 |
-
<resources>
|
55 |
-
<OpenGraphTags_setup>
|
56 |
-
<setup>
|
57 |
-
<module>SocialShare_OpenGraphTags</module>
|
58 |
-
</setup>
|
59 |
-
<connection>
|
60 |
-
<use>core_setup</use>
|
61 |
-
</connection>
|
62 |
-
</OpenGraphTags_setup>
|
63 |
-
<OpenGraphTags_write>
|
64 |
-
<connection>
|
65 |
-
<use>core_write</use>
|
66 |
-
</connection>
|
67 |
-
</OpenGraphTags_write>
|
68 |
-
<OpenGraphTags_read>
|
69 |
-
<connection>
|
70 |
-
<use>core_read</use>
|
71 |
-
</connection>
|
72 |
-
</OpenGraphTags_read>
|
73 |
-
</resources>
|
74 |
-
<blocks>
|
75 |
-
<OpenGraphTags>
|
76 |
-
<class>SocialShare_OpenGraphTags_Block</class>
|
77 |
-
</OpenGraphTags>
|
78 |
-
</blocks>
|
79 |
-
<helpers>
|
80 |
-
<opengraphtags>
|
81 |
-
<class>SocialShare_OpenGraphTags_Helper</class>
|
82 |
-
</opengraphtags>
|
83 |
-
</helpers>
|
84 |
-
<models>
|
85 |
-
<opengraphtags>
|
86 |
-
<class>SocialShare_OpenGraphTags_Model</class>
|
87 |
-
</opengraphtags>
|
88 |
-
</models>
|
89 |
-
</global>
|
90 |
-
|
91 |
-
<default>
|
92 |
-
<opengraphtags>
|
93 |
-
|
94 |
-
<conf>
|
95 |
-
<enabled>1</enabled>
|
96 |
-
<lang>en_US</lang>
|
97 |
-
</conf>
|
98 |
-
|
99 |
-
<!--
|
100 |
-
<general>
|
101 |
-
<enabled>1</enabled>
|
102 |
-
<color>2</color>
|
103 |
-
<lang>en_US</lang>
|
104 |
-
</general>
|
105 |
-
<opengraph>
|
106 |
-
<enabled_op>0</enabled_op>
|
107 |
-
<color>2</color>
|
108 |
-
<lang>en_US</lang>
|
109 |
-
</opengraph>
|
110 |
-
-->
|
111 |
-
</opengraphtags>
|
112 |
-
</default>
|
113 |
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<SocialShare_OpenGraphTags>
|
5 |
+
<version>3.0</version>
|
6 |
+
</SocialShare_OpenGraphTags>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<frontend>
|
10 |
+
<layout>
|
11 |
+
<updates>
|
12 |
+
<OpenGraphTags>
|
13 |
+
<file>socialshare/OpenGraphTags.xml</file>
|
14 |
+
</OpenGraphTags>
|
15 |
+
</updates>
|
16 |
+
</layout>
|
17 |
+
|
18 |
+
</frontend>
|
19 |
+
|
20 |
+
<adminhtml>
|
21 |
+
<!--
|
22 |
+
<translate>
|
23 |
+
<modules>
|
24 |
+
<SocialShare_OpenGraphTags>
|
25 |
+
<files>
|
26 |
+
<default>SocialShare_OpenGraphTags.csv</default>
|
27 |
+
</files>
|
28 |
+
</SocialShare_OpenGraphTags>
|
29 |
+
</modules>
|
30 |
+
</translate>
|
31 |
+
-->
|
32 |
+
<acl>
|
33 |
+
<resources>
|
34 |
+
<admin>
|
35 |
+
<children>
|
36 |
+
<system>
|
37 |
+
<children>
|
38 |
+
<config>
|
39 |
+
<children>
|
40 |
+
<opengraphtags translate="title" module="opengraphtags">
|
41 |
+
<title>Social Share - Open Graph</title>
|
42 |
+
</opengraphtags>
|
43 |
+
</children>
|
44 |
+
</config>
|
45 |
+
</children>
|
46 |
+
</system>
|
47 |
+
</children>
|
48 |
+
</admin>
|
49 |
+
</resources>
|
50 |
+
</acl>
|
51 |
+
</adminhtml>
|
52 |
+
|
53 |
+
<global>
|
54 |
+
<resources>
|
55 |
+
<OpenGraphTags_setup>
|
56 |
+
<setup>
|
57 |
+
<module>SocialShare_OpenGraphTags</module>
|
58 |
+
</setup>
|
59 |
+
<connection>
|
60 |
+
<use>core_setup</use>
|
61 |
+
</connection>
|
62 |
+
</OpenGraphTags_setup>
|
63 |
+
<OpenGraphTags_write>
|
64 |
+
<connection>
|
65 |
+
<use>core_write</use>
|
66 |
+
</connection>
|
67 |
+
</OpenGraphTags_write>
|
68 |
+
<OpenGraphTags_read>
|
69 |
+
<connection>
|
70 |
+
<use>core_read</use>
|
71 |
+
</connection>
|
72 |
+
</OpenGraphTags_read>
|
73 |
+
</resources>
|
74 |
+
<blocks>
|
75 |
+
<OpenGraphTags>
|
76 |
+
<class>SocialShare_OpenGraphTags_Block</class>
|
77 |
+
</OpenGraphTags>
|
78 |
+
</blocks>
|
79 |
+
<helpers>
|
80 |
+
<opengraphtags>
|
81 |
+
<class>SocialShare_OpenGraphTags_Helper</class>
|
82 |
+
</opengraphtags>
|
83 |
+
</helpers>
|
84 |
+
<models>
|
85 |
+
<opengraphtags>
|
86 |
+
<class>SocialShare_OpenGraphTags_Model</class>
|
87 |
+
</opengraphtags>
|
88 |
+
</models>
|
89 |
+
</global>
|
90 |
+
|
91 |
+
<default>
|
92 |
+
<opengraphtags>
|
93 |
+
|
94 |
+
<conf>
|
95 |
+
<enabled>1</enabled>
|
96 |
+
<lang>en_US</lang>
|
97 |
+
</conf>
|
98 |
+
|
99 |
+
<!--
|
100 |
+
<general>
|
101 |
+
<enabled>1</enabled>
|
102 |
+
<color>2</color>
|
103 |
+
<lang>en_US</lang>
|
104 |
+
</general>
|
105 |
+
<opengraph>
|
106 |
+
<enabled_op>0</enabled_op>
|
107 |
+
<color>2</color>
|
108 |
+
<lang>en_US</lang>
|
109 |
+
</opengraph>
|
110 |
+
-->
|
111 |
+
</opengraphtags>
|
112 |
+
</default>
|
113 |
</config>
|
@@ -1,76 +1,97 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
<lang translate="label">
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
<sort_order>20</sort_order>
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
<facebook>
|
47 |
<label>Facebook</label>
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
<fb_admins translate="label">
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
</facebook>
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
</config>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
+
<tabs>
|
4 |
+
<socialshare>
|
5 |
+
<label>Social Share</label>
|
6 |
+
<sort_order>150</sort_order>
|
7 |
+
</socialshare>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<opengraphtags translate="label" module="opengraphtags">
|
11 |
+
<label>Basic Configuration</label>
|
12 |
+
<tab>socialshare</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>10</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 |
+
<conf translate="label">
|
20 |
+
<label>General Configurations</label>
|
21 |
+
<sort_order>10</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<fields>
|
26 |
+
<active translate="label">
|
27 |
+
<label>Extensions Active</label>
|
28 |
+
<frontend_type>select</frontend_type>
|
29 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
30 |
+
<sort_order>10</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</active>
|
35 |
<lang translate="label">
|
36 |
+
<label>Language</label>
|
37 |
+
<frontend_type>select</frontend_type>
|
38 |
+
<source_model>opengraphtags/system_config_source_dropdown_localization</source_model>
|
39 |
<sort_order>20</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</lang>
|
44 |
+
</fields>
|
45 |
+
</conf>
|
46 |
<facebook>
|
47 |
<label>Facebook</label>
|
48 |
+
<sort_order>20</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
<fields>
|
53 |
+
<fb_appid translate="label">
|
54 |
+
<label>Application ID / Key</label>
|
55 |
+
<comment><![CDATA[ Get a <a target="_blank" href="https://developers.facebook.com/apps">Facebook API Key</a>]]></comment>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<sort_order>20</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</fb_appid>
|
62 |
<fb_admins translate="label">
|
63 |
+
<label>Admin ID</label>
|
64 |
+
<comment><![CDATA[ Your Facebook ID (For Analytics and Admin Rights) <br /> * Optional ]]></comment>
|
65 |
+
<frontend_type>text</frontend_type>
|
66 |
+
<sort_order>30</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
</fb_admins>
|
71 |
+
</fields>
|
72 |
</facebook>
|
73 |
+
<defaults>
|
74 |
+
<label>Default Options</label>
|
75 |
+
<sort_order>30</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
<fields>
|
80 |
+
<default_image translate="label">
|
81 |
+
<label>Default OG Image</label>
|
82 |
+
<comment><![CDATA[ Saved in the media/socialshare/image folder.<br /> Minimum Dimensions: 200 x 200.<br /> Allowed file types: jpeg, gif, & png.]]></comment>
|
83 |
+
<frontend_type>image</frontend_type>
|
84 |
+
<backend_model>adminhtml/system_config_backend_image</backend_model>
|
85 |
+
<upload_dir config="system/filesystem/media" scope_info="1">socialshare/image</upload_dir>
|
86 |
+
<base_url type="media" scope_info="1">socialshare/image</base_url>
|
87 |
+
<sort_order>30</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>1</show_in_store>
|
91 |
+
</default_image>
|
92 |
+
</fields>
|
93 |
+
</defaults>
|
94 |
+
</groups>
|
95 |
+
</opengraphtags>
|
96 |
+
</sections>
|
97 |
</config>
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<block type="core/template" name="og_meta">
|
6 |
+
<action method="setTemplate" ifconfig="opengraphtags/conf/active">
|
7 |
+
<template>socialshare/head.phtml</template>
|
8 |
+
</action>
|
9 |
+
</block>
|
10 |
+
</reference>
|
11 |
+
|
12 |
+
<reference name="after_body_start">
|
13 |
+
<block type="core/template" name="og_meta">
|
14 |
+
<action method="setTemplate" ifconfig="opengraphtags/conf/active">
|
15 |
+
<template>socialshare/body.phtml</template>
|
16 |
+
</action>
|
17 |
+
</block>
|
18 |
+
</reference>
|
19 |
+
|
20 |
+
</default>
|
21 |
+
</layout>
|
@@ -1,3 +1,4 @@
|
|
|
|
1 |
<!-- SocialShare - OpenGraphTags Body -->
|
2 |
<div id="fb-root"></div>
|
3 |
<script>
|
@@ -19,3 +20,4 @@
|
|
19 |
}(document));
|
20 |
</script>
|
21 |
<!-- SocialShare - OpenGraphTags Body END -->
|
|
1 |
+
<?php if (Mage::getStoreConfig('opengraphtags/facebook/fb_appid') != '') { ?>
|
2 |
<!-- SocialShare - OpenGraphTags Body -->
|
3 |
<div id="fb-root"></div>
|
4 |
<script>
|
20 |
}(document));
|
21 |
</script>
|
22 |
<!-- SocialShare - OpenGraphTags Body END -->
|
23 |
+
<?php } ?>
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- BEGIN SocialShare - OpenGraphTags Head -->
|
2 |
+
<?php
|
3 |
+
/*
|
4 |
+
TODO: Test Category Stuff
|
5 |
+
*/
|
6 |
+
|
7 |
+
$_socialShareOgData = array();
|
8 |
+
$_imageSize = array('x' => 200 , 'y' => 200);
|
9 |
+
if (Mage::getStoreConfig('opengraphtags/facebook/fb_appid') != '') {
|
10 |
+
$_socialShareOgData["fb:app_id"] = trim(Mage::getStoreConfig('opengraphtags/facebook/fb_appid'));
|
11 |
+
}
|
12 |
+
if (Mage::getStoreConfig('opengraphtags/facebook/fb_admins') != '') {
|
13 |
+
$_socialShareOgData["fb:admins"] = trim(Mage::getStoreConfig('opengraphtags/facebook/fb_admins'));
|
14 |
+
}
|
15 |
+
|
16 |
+
/* Defaults */
|
17 |
+
$_socialShareOgData["og:type"] = "article";
|
18 |
+
$_socialShareOgData["og:title"] = htmlspecialchars($this->getLayout()->getBlock('head')->getTitle());
|
19 |
+
$_socialShareOgData["og:url"] = Mage::helper('core/url')->getCurrentUrl();
|
20 |
+
$_socialShareOgData["og:description"] = htmlspecialchars( $this->getLayout()->getBlock('head')->getDescription() );
|
21 |
+
//$_socialShareOgData["og:description"] = strip_tags($this->getDescription());
|
22 |
+
|
23 |
+
$_socialShareOgData["og:site_name"] = Mage::app()->getStore()->getFrontEndName();
|
24 |
+
|
25 |
+
/* Product Pages */
|
26 |
+
if($_product = Mage::registry('current_product')) {
|
27 |
+
$_socialShareOgData["og:type"] = "product";
|
28 |
+
$_socialShareOgData["og:title"] = htmlspecialchars($_product->getName());
|
29 |
+
$_socialShareOgData["og:image"] = Mage::helper('catalog/image')->init($_product, 'image');//->resize($_imageSize['x'], $_imageSize['y']); //Causes Errors with the Facebook Debugger
|
30 |
+
$_socialShareOgData["og:url"] = $_product->getProductUrl();
|
31 |
+
if( empty($_socialShareOgData["og:description"]) )
|
32 |
+
$_socialShareOgData["og:description"] = htmlspecialchars(strip_tags(($_product->getShortDescription())));
|
33 |
+
|
34 |
+
/* Pricing */
|
35 |
+
if (Mage::getStoreConfig('sales/msrp/enabled') != "1") { // MAP pricing NOT enabled
|
36 |
+
if ($_product->getFinalPrice() && $_product->getFinalPrice() <> $_product->getPrice()) { // Product on sale (or catalog price rule applied)
|
37 |
+
$_socialShareOgData["og:price:standard_amount"] = $_product->getPrice();
|
38 |
+
$_socialShareOgData["og:price:amount"] = $_product->getFinalPrice();
|
39 |
+
$_socialShareOgData["og:product:price:amount"] = $_product->getFinalPrice(); // required by FB in lieue if the standard og:price:amount
|
40 |
+
} else { // Product not on sale
|
41 |
+
$_socialShareOgData["og:price:standard_amount"] = $_product->getPrice();
|
42 |
+
$_socialShareOgData["og:price:amount"] = $_product->getSpecialPrice();
|
43 |
+
}
|
44 |
+
$_socialShareOgData["og:price:currency"] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
45 |
+
} elseif ($_product->getMsrp()) { // MAP pricing enabled and product has MSRP
|
46 |
+
$_socialShareOgData["og:price:standard_amount"] = $_product->getMsrp();
|
47 |
+
$_socialShareOgData["og:price:currency"] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
48 |
+
}
|
49 |
+
|
50 |
+
/* Product Rating */
|
51 |
+
if (($entityId = Mage::app()->getRequest()->getParam('id')) > 0) {
|
52 |
+
if (($reviewsCount = Mage::getModel('review/review')->getTotalReviews($entityId, true)) > 0) {
|
53 |
+
Mage::getModel('review/review')->getEntitySummary($_product,Mage::app()->getStore()->getStoreId());
|
54 |
+
if ($ratingSummary = $_product->getRatingSummary()->getRatingSummary()) {
|
55 |
+
$_socialShareOgData["og:rating"] = $ratingSummary / 20; // Number (float), rating of this product (for example, 4.6) (Magento provides the product rating as a percentage, so divide by 20 to make it out of 5)
|
56 |
+
$_socialShareOgData["og:rating_scale"] = 5; //Number (int), maximum value of the ratings scale. Required if rating provided (e.g. 5)
|
57 |
+
$_socialShareOgData["og:rating_count"] = $reviewsCount; //Number (int), rating count of which the product is rated(e.g. 113)
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/* Category Pages */
|
64 |
+
elseif($_category = Mage::registry('current_category')) {
|
65 |
+
// $cur_category = Mage::getModel('catalog/category')->load($_category->getId());
|
66 |
+
// $imageUrl = $cur_category->getImageUrl();
|
67 |
+
$_socialShareOgData["og:type"] = "product.group";
|
68 |
+
$_socialShareOgData["og:title"] = htmlspecialchars($_category->getName());
|
69 |
+
$_socialShareOgData["og:url"] = $_category->getUrl();
|
70 |
+
$_socialShareOgData["og:image"] = $_category->getImageUrl();
|
71 |
+
}
|
72 |
+
|
73 |
+
/* CMS Home Page */
|
74 |
+
elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) {
|
75 |
+
$_socialShareOgData["og:type"] = "website";
|
76 |
+
}
|
77 |
+
|
78 |
+
/* Clear null/empty keys */
|
79 |
+
$_socialShareOgData = array_filter($_socialShareOgData);
|
80 |
+
|
81 |
+
/* Default Image */
|
82 |
+
if(!array_key_exists("og:image", $_socialShareOgData)) {
|
83 |
+
if (Mage::getStoreConfig('opengraphtags/defaults/default_image')) {
|
84 |
+
$image = Mage::getBaseUrl('media') . 'socialshare/image/' . Mage::getStoreConfig('opengraphtags/defaults/default_image');
|
85 |
+
$_socialShareOgData["og:image"] = $image;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/* Print OG Tags */
|
90 |
+
foreach($_socialShareOgData as $key => $value) {
|
91 |
+
echo "<meta property=\"{$key}\" content=\"{$value}\" />\n";
|
92 |
+
}
|
93 |
+
?>
|
94 |
+
<!-- END SocialShare - OpenGraphTags Head -->
|
@@ -1,21 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<default>
|
4 |
-
<reference name="head">
|
5 |
-
<block type="core/template" name="og_meta">
|
6 |
-
<action method="setTemplate" ifconfig="opengraphtags/conf/active">
|
7 |
-
<template>socialshare/head.phtml</template>
|
8 |
-
</action>
|
9 |
-
</block>
|
10 |
-
</reference>
|
11 |
-
|
12 |
-
<reference name="after_body_start">
|
13 |
-
<block type="core/template" name="og_meta">
|
14 |
-
<action method="setTemplate" ifconfig="opengraphtags/conf/active">
|
15 |
-
<template>socialshare/body.phtml</template>
|
16 |
-
</action>
|
17 |
-
</block>
|
18 |
-
</reference>
|
19 |
-
|
20 |
-
</default>
|
21 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,19 +0,0 @@
|
|
1 |
-
<!-- SocialShare - OpenGraphTags Head -->
|
2 |
-
<?php if (Mage::getStoreConfig('opengraphtags/facebook/fb_appid') != ''): ?>
|
3 |
-
<meta property="fb:app_id" content="<?php echo trim(Mage::getStoreConfig('opengraphtags/facebook/fb_appid'));?>" />
|
4 |
-
<?php endif; ?>
|
5 |
-
<?php if (Mage::getStoreConfig('opengraphtags/facebook/fb_admins') != ''): ?>
|
6 |
-
<meta property="fb:admins" content="<?php echo trim(Mage::getStoreConfig('opengraphtags/facebook/fb_admins'));?>" />
|
7 |
-
<?php endif; ?>
|
8 |
-
<meta property="og:url" content="<?php echo $this->helper('core/url')->getCurrentUrl();?>" />
|
9 |
-
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName(); ?>" />
|
10 |
-
<?php $_product = Mage::registry('current_product');
|
11 |
-
if ($_product): ?>
|
12 |
-
<meta property="og:type" content="product" />
|
13 |
-
<meta property="og:title" content="<?php echo $this->getLayout()->getBlock('head')->getTitle(); ?>"/>
|
14 |
-
<meta property="og:image" content="<?php echo Mage::helper('catalog/image')->init($_product, 'image');?>"/>
|
15 |
-
<meta property="og:price:amount" content="<?php echo $_product->getSpecialPrice() ?>" />
|
16 |
-
<meta property="og:price:standard_amount" content="<?php echo $_product->getPrice() ?>" />
|
17 |
-
<meta property="og:price:currency" content="<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>" />
|
18 |
-
<?php endif; ?>
|
19 |
-
<!-- SocialShare - OpenGraphTags Head END -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,19 +1,29 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>SocialShareOG</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Open Graph Tags support for
|
10 |
-
<description>Easy to use Open Graph Meta
|
11 |
</description>
|
12 |
-
<notes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
<authors><author><name>Roy Toledo</name><user>NikNak</user><email>toledoroy@gmail.com</email></author></authors>
|
14 |
-
<date>2015-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magecommunity"><dir name="SocialShare"><dir name="OpenGraphTags"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Color.php" hash="ec237e9de0c6de32f75f1419a337defb"/><file name="Font.php" hash="a25370be2d6777fc30fa295888d59800"/><file name="Language.php" hash="d31bd885a47e85565d2b553d41664cdf"/><file name="Layout.php" hash="0e0c072db9b994d340e5a876fabfc470"/><file name="Verb.php" hash="502714d6b8e0b6dfb592e8f78753869a"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0d955fa9a94fddc4e5fe8b6c87f1cece"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Localization.php" hash="124bfcf8e6be20123772da9c5c458989"/></dir></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>4.0.0</min><max>6.8.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>SocialShareOG</name>
|
4 |
+
<version>3.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Open Graph Tags support for Magento store</summary>
|
10 |
+
<description>This Easy to use extension adds automatic Open Graph Meta Tags for your Magento store
|
11 |
</description>
|
12 |
+
<notes>1. Moved layout XML into a socialshare folder
|
13 |
+
2. Moved design phtml into base/default to support fallback of non-default based themes
|
14 |
+
3. Added logic to prevent Facebook Share JS from loading if no FB app-id is specified (body.html) -> prevents load & js errors for users who only need the OG metadata.
|
15 |
+
4. Added image upload functionality in adminhtml configuration for a default OG image (website logo, for instance). This is only loaded if no other image is found, and is not required.
|
16 |
+
5. Added OG Tags support for the homepage and Category pages
|
17 |
+
6. Added support for category images
|
18 |
+
7. Added support for MAP (if enabled in magento core config), final price vs special price/price and related logic.
|
19 |
+
8. Added support for product ratings
|
20 |
+
9. Built logic around an array to allow for defaults to be inserted for missing data.
|
21 |
+
10. Naming, capitalization and spelling in system.xml -> nothing that changes configuration values that already existed.
|
22 |
+
</notes>
|
23 |
<authors><author><name>Roy Toledo</name><user>NikNak</user><email>toledoroy@gmail.com</email></author></authors>
|
24 |
+
<date>2015-04-11</date>
|
25 |
+
<time>07:42:12</time>
|
26 |
+
<contents><target name="magecommunity"><dir name="SocialShare"><dir name="OpenGraphTags"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Color.php" hash="ec237e9de0c6de32f75f1419a337defb"/><file name="Font.php" hash="a25370be2d6777fc30fa295888d59800"/><file name="Language.php" hash="d31bd885a47e85565d2b553d41664cdf"/><file name="Layout.php" hash="0e0c072db9b994d340e5a876fabfc470"/><file name="Verb.php" hash="502714d6b8e0b6dfb592e8f78753869a"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0d955fa9a94fddc4e5fe8b6c87f1cece"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Localization.php" hash="124bfcf8e6be20123772da9c5c458989"/></dir></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="000d6508eaaec0ab8f9ca63d5bd1418a"/><file name="config.xml" hash="efdb49f4ced5ec95afd300797f1ec187"/><file name="system.xml" hash="bbbba32503774d6adabaf78aeafecd8c"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="socialshare"><file name="OpenGraphTags.xml" hash="fab44e385036aa51b436aee01baed864"/></dir></dir><dir name="template"><dir name="socialshare"><file name="head.phtml" hash="e89ec008cdc985d94a4cce096ebe6a70"/><file name="body.phtml" hash="a978f917347c374dbe8fb9145d22df94"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SocialShare_OpenGraphTags.xml" hash="820d4be224ecac5ad1ba1a7e23cb7b55"/></dir></target></contents>
|
27 |
<compatible/>
|
28 |
<dependencies><required><php><min>4.0.0</min><max>6.8.0</max></php></required></dependencies>
|
29 |
</package>
|