prashant_header_logo - Version 1.0.0

Version Notes

First Release Version

Download this release

Release Info

Developer Prashant Kumar
Extension prashant_header_logo
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Prashant/Headerlogo/Block/Html/Header.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Prashant_Headerlogo_Block_html_Header extends Mage_Core_Block_Template
3
+ {
4
+ public function _construct()
5
+ {
6
+ $this->setTemplate('page/html/header.phtml');
7
+ }
8
+
9
+ public function getIsHomePage()
10
+ {
11
+ return $this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true));
12
+ }
13
+
14
+ public function setLogo($logo_src, $logo_alt)
15
+ {
16
+ $this->setLogoSrc($logo_src);
17
+ $this->setLogoAlt($logo_alt);
18
+ return $this;
19
+ }
20
+
21
+ public function getLogoSrc()
22
+ {
23
+
24
+ if (empty($this->_data['logo_src'])) {
25
+ $this->_data['logo_src'] = $this->_getLogoFile();
26
+ }
27
+ return $this->_data['logo_src'];
28
+ }
29
+
30
+ protected function _getLogoFile()
31
+ {
32
+ $folderName = Prashant_Headerlogo_Model_System_Config_Backend_Image_Logo::UPLOAD_DIR;
33
+ $storeConfig = Mage::getStoreConfig('design/header/logo_src');
34
+ $logoFile = Mage::getBaseUrl('media') . $folderName . '/' . $storeConfig;
35
+ $absolutePath = Mage::getBaseDir('media') . '/' . $folderName . '/' . $storeConfig;
36
+
37
+ if(!is_null($storeConfig) && $this->_isFile($absolutePath)) {
38
+ $url = $logoFile;
39
+ } else {
40
+ $url = $this->getSkinUrl('images/media/logo.png');
41
+ }
42
+ return $url;
43
+ }
44
+
45
+ protected function _isFile($filename) {
46
+ if (Mage::helper('core/file_storage_database')->checkDbUsage() && !is_file($filename)) {
47
+ Mage::helper('core/file_storage_database')->saveFileToFilesystem($filename);
48
+ }
49
+ return is_file($filename);
50
+ }
51
+ }
app/code/community/Prashant/Headerlogo/Helper/Data.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Prashant_Headerlogo_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ }
app/code/community/Prashant/Headerlogo/Model/System/Config/Backend/Image/Logo.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Prashant_Headerlogo_Model_System_Config_Backend_Image_Logo extends Mage_Adminhtml_Model_System_Config_Backend_Image
3
+ {
4
+ const UPLOAD_DIR = 'logoimage';
5
+ const UPLOAD_ROOT = 'media';
6
+
7
+ protected function _getUploadDir()
8
+ {
9
+ $newdirPath = Mage::getBaseDir('media') . DS . "logoimage";
10
+ if (!file_exists($newdirPath)) {
11
+ mkdir($newdirPath, 0777);
12
+ }
13
+ $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR);
14
+ $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT);
15
+ $uploadDir = $uploadRoot . '/' . $uploadDir;
16
+ return $uploadDir;
17
+ }
18
+
19
+ protected function _addWhetherScopeInfo()
20
+ {
21
+ return true;
22
+ }
23
+
24
+ protected function _getAllowedExtensions()
25
+ {
26
+ return array('ico', 'png', 'gif', 'jpg', 'jpeg', 'apng', 'svg');
27
+ }
28
+
29
+ protected function _getUploadRoot($token) {
30
+ return Mage::getBaseDir($token);
31
+ }
32
+
33
+ }
app/code/community/Prashant/Headerlogo/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <adminhtml>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <prashant_headerlogo>
12
+ <title>Prashant Headerlogo</title>
13
+ </prashant_headerlogo>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </adminhtml>
app/code/community/Prashant/Headerlogo/etc/config.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Prashant_Headerlogo>
5
+ <version>0.1.0</version>
6
+ </Prashant_Headerlogo>
7
+ </modules>
8
+ <adminhtml>
9
+ <acl>
10
+ <resources>
11
+ <all>
12
+ <title>Allow Everything</title>
13
+ </all>
14
+ <admin>
15
+ <children>
16
+ <Prashant_Headerlogo>
17
+ <title>Headerlogo</title>
18
+ <sort_order>10</sort_order>
19
+ </Prashant_Headerlogo>
20
+ </children>
21
+ </admin>
22
+ </resources>
23
+ </acl>
24
+ </adminhtml>
25
+ <global>
26
+ <models>
27
+ <headerlogo>
28
+ <class>Prashant_Headerlogo_Model</class>
29
+ </headerlogo>
30
+ </models>
31
+ <blocks>
32
+ <page>
33
+ <rewrite>
34
+ <html_header>Prashant_Headerlogo_Block_Html_Header</html_header>
35
+ </rewrite>
36
+ </page>
37
+ </blocks>
38
+ <helpers>
39
+ <headerlogo>
40
+ <class>Prashant_Headerlogo_Helper</class>
41
+ </headerlogo>
42
+ </helpers>
43
+ </global>
44
+ </config>
app/code/community/Prashant/Headerlogo/etc/system.xml ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <prashant_extension_tab translate="label" module="headerlogo">
5
+ <label>Prashant Extensions</label>
6
+ <sort_order>120</sort_order>
7
+ </prashant_extension_tab>
8
+ </tabs>
9
+ <sections>
10
+ <prashant_headerlogo module="headerlogo" translate="label">
11
+ <label>Store Logo Upload </label>
12
+ <sort_order>200</sort_order>
13
+ <show_in_default>1</show_in_default>
14
+ <show_in_website>1</show_in_website>
15
+ <show_in_store>1</show_in_store>
16
+ <tab>prashant_extension_tab</tab>
17
+ <groups>
18
+ <header_setting translate="label">
19
+ <label>Store logo Settings</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>200</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
+ <enabled>
27
+ <label>Enable Store logo</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>150</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
+ <comment>Enable Headerlogo script</comment>
35
+ </enabled>
36
+ </fields>
37
+ </header_setting>
38
+ </groups>
39
+ </prashant_headerlogo>
40
+ <design translate="label" module="core">
41
+ <groups>
42
+ <head translate="label">
43
+ <label>HTML Head</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>20</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <fields>
50
+ <shortcut_icon translate="label comment">
51
+ <label>Favicon Icon</label>
52
+ <comment>Allowed file types: ICO, PNG, GIF, JPG, JPEG, APNG, SVG. Not all browsers support all these formats!</comment>
53
+ <frontend_type>image</frontend_type>
54
+ <backend_model>adminhtml/system_config_backend_image_favicon</backend_model>
55
+ <base_url type="media" scope_info="1">favicon</base_url>
56
+ <sort_order>5</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </shortcut_icon>
61
+ <default_title translate="label">
62
+ <label>Default Title</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>10</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </default_title>
69
+ <title_prefix translate="label">
70
+ <label>Title Prefix</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>12</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </title_prefix>
77
+ <title_suffix translate="label">
78
+ <label>Title Suffix</label>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>14</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </title_suffix>
85
+ <default_description translate="label">
86
+ <label>Default Description</label>
87
+ <frontend_type>textarea</frontend_type>
88
+ <sort_order>20</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </default_description>
93
+ <default_keywords translate="label">
94
+ <label>Default Keywords</label>
95
+ <frontend_type>textarea</frontend_type>
96
+ <sort_order>30</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ </default_keywords>
101
+ <default_robots translate="label">
102
+ <label>Default Robots</label>
103
+ <frontend_type>select</frontend_type>
104
+ <source_model>adminhtml/system_config_source_design_robots</source_model>
105
+ <sort_order>40</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </default_robots>
110
+ <includes translate="label comment">
111
+ <label>Miscellaneous Scripts</label>
112
+ <comment>This will be included before head closing tag in page HTML.</comment>
113
+ <frontend_type>textarea</frontend_type>
114
+ <sort_order>70</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </includes>
119
+ <demonotice translate="label comment">
120
+ <label>Display Demo Store Notice</label>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>adminhtml/system_config_source_yesno</source_model>
123
+ <sort_order>80</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </demonotice>
128
+ </fields>
129
+ </head>
130
+ <header translate="label">
131
+ <label>Header</label>
132
+ <frontend_type>text</frontend_type>
133
+ <sort_order>30</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>1</show_in_store>
137
+ <fields>
138
+ <logo_src translate="label comment">
139
+ <label>Logo Image Source</label>
140
+ <comment>Allowed file types: PNG, GIF, JPEG. Not all browsers support all these formats!</comment>
141
+ <frontend_type>image</frontend_type>
142
+ <backend_model>headerlogo/system_config_backend_image_logo</backend_model>
143
+ <base_url type="media" scope_info="1">logoimage</base_url>
144
+ <sort_order>10</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ </logo_src>
149
+ <logo_alt translate="label">
150
+ <label>Logo Image Alt</label>
151
+ <frontend_type>text</frontend_type>
152
+ <sort_order>20</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ </logo_alt>
157
+ <logo_src_small translate="label">
158
+ <label>Small Logo Image Src</label>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>25</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ </logo_src_small>
165
+ <welcome translate="label">
166
+ <label>Welcome Text</label>
167
+ <frontend_type>text</frontend_type>
168
+ <sort_order>30</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ </welcome>
173
+ </fields>
174
+ </header>
175
+ <footer translate="label">
176
+ <label>Footer</label>
177
+ <frontend_type>text</frontend_type>
178
+ <sort_order>40</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>1</show_in_website>
181
+ <show_in_store>1</show_in_store>
182
+ <fields>
183
+ <copyright translate="label">
184
+ <label>Copyright</label>
185
+ <frontend_type>textarea</frontend_type>
186
+ <sort_order>10</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </copyright>
191
+ <absolute_footer translate="label comment">
192
+ <label>Miscellaneous HTML</label>
193
+ <comment>This will be displayed just before body closing tag.</comment>
194
+ <frontend_type>textarea</frontend_type>
195
+ <sort_order>20</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ </absolute_footer>
200
+ </fields>
201
+ </footer>
202
+ </groups>
203
+ <depends><enabled>1</enabled></depends>
204
+ </design>
205
+ </sections>
206
+ </config>
app/etc/modules/Prashant_Headerlogo.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Prashant_Headerlogo>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Prashant_Headerlogo>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>prashant_header_logo</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Admin can upload store logo from magento back-end easily.</summary>
10
+ <description>This extension provides the functionality for the admin to upload store logo. Admin can upload store logo from magento back-end at same place where default megento will use for the logo.</description>
11
+ <notes>First Release Version</notes>
12
+ <authors><author><name>Prashant Kumar</name><user>prashantkr</user><email>vicky.bgp@gmail.com</email></author></authors>
13
+ <date>2016-06-28</date>
14
+ <time>10:37:36</time>
15
+ <contents><target name="magecommunity"><dir name="Prashant"><dir name="Headerlogo"><dir name="Block"><dir name="Html"><file name="Header.php" hash="5d565da73eff1c14b0247d5f92c86901"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c6a27189bf862febceb2425309022ecc"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Image"><file name="Logo.php" hash="48a43b5b95d007dc65d56869cb59a91e"/></dir></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6935d5e4758764ba080c0c2d2ffb7165"/><file name="config.xml" hash="8c1be5eca26dfb5cd5f662cfb1a550d3"/><file name="system.xml" hash="768b55ccef08fe9709666223257a3c72"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Prashant_Headerlogo.xml" hash="68ac4d31b436f7b17e63a2da88281f42"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>