Nikolakisae_ShippingLogo - Version 0.1.0

Version Notes

Stable for Magento Vesrion 1.7, 1.8 and 1.8.1

Download this release

Release Info

Developer Niko K
Extension Nikolakisae_ShippingLogo
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Nikolakisae/ShippingLogo/Block/Checkout/Onepage/Shipping/Method/Available.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
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://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Nikolakisae
17
+ * @package Nikolakisae_ShippingLogo
18
+ * @author Niko K
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class Nikolakisae_ShippingLogo_Block_Checkout_Onepage_Shipping_Method_Available extends Mage_Checkout_Block_Onepage_Shipping_Method_Available {
22
+
23
+ public function getTitleImage($code) {
24
+
25
+ $imageLogo = '';
26
+ if (file_exists(Mage::getBaseDir('media') . DS . 'shipping' . DS . $code . DS . Mage::getStoreConfig('carriers/' . $code . '/image')) && Mage::getStoreConfig('carriers/' . $code . '/image')) {
27
+ $imageLogo = '<img src="' . Mage::getBaseUrl('media') . 'shipping/' . $code . '/' . Mage::getStoreConfig('carriers/' . $code . '/image') . '">';
28
+ }
29
+
30
+ if ($imageLogo != '' && Mage::getStoreConfig('carriers/' . $code . '/display_options') == 2) {
31
+ return $imageLogo;
32
+ } elseif ($imageLogo != '' && Mage::getStoreConfig('carriers/' . $code . '/display_options') == 3) {
33
+ return $this->escapeHtml($this->getCarrierName($code)) . ' ' . $imageLogo;
34
+ } elseif ($imageLogo != '' && Mage::getStoreConfig('carriers/' . $code . '/display_options') == 4) {
35
+ return $imageLogo . ' ' . $this->escapeHtml($this->getCarrierName($code));
36
+ }
37
+
38
+ return $this->escapeHtml($this->getCarrierName($code));
39
+ }
40
+
41
+ }
app/code/community/Nikolakisae/ShippingLogo/Model/Adminhtml/System/Config/Source/Options.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
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://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Nikolakisae
17
+ * @package Nikolakisae_ShippingLogo
18
+ * @author Niko K
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class Nikolakisae_ShippingLogo_Model_Adminhtml_System_Config_Source_Options
22
+ {
23
+ /**
24
+ *
25
+ * @return array
26
+ */
27
+ public function toOptionArray()
28
+ {
29
+ return array(
30
+ array('value' => 1, 'label' => 'Only Title'),
31
+ array('value' => 2, 'label' => 'Only Image Logo'),
32
+ array('value' => 3, 'label' => 'Title and Image Logo'),
33
+ array('value' => 4, 'label' => 'Image Logo and Title'),
34
+ );
35
+ }
36
+ }
app/code/community/Nikolakisae/ShippingLogo/etc/config.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Nikolakisae_ShippingLogo>
5
+ <version>0.1.0</version>
6
+ </Nikolakisae_ShippingLogo>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <shippinglogo>
11
+ <class>Nikolakisae_ShippingLogo_Model</class>
12
+ </shippinglogo>
13
+ </models>
14
+ <blocks>
15
+ <shippinglogo>
16
+ <class>Nikolakisae_ShippingLogo_Block</class>
17
+ </shippinglogo>
18
+ <checkout>
19
+ <rewrite>
20
+ <onepage_shipping_method_available>Nikolakisae_ShippingLogo_Block_Checkout_Onepage_Shipping_Method_Available</onepage_shipping_method_available>
21
+ </rewrite>
22
+ </checkout>
23
+ </blocks>
24
+ </global>
25
+ <frontend>
26
+ <layout>
27
+ <updates>
28
+ <shippinglogo>
29
+ <file>shippinglogo.xml</file>
30
+ </shippinglogo>
31
+ </updates>
32
+ </layout>
33
+ </frontend>
34
+ </config>
app/code/community/Nikolakisae/ShippingLogo/etc/system.xml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <carriers translate="label" module="shipping">
5
+ <label>Shipping Methods</label>
6
+ <tab>sales</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>320</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <flatrate translate="label">
14
+ <label>Flat Rate</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>2</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <image translate="label">
22
+ <label>Shipping Logo</label>
23
+ <frontend_type>image</frontend_type>
24
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
25
+ <upload_dir config="system/filesystem/media" scope_info="1">shipping/flatrate</upload_dir>
26
+ <base_url type="media" scope_info="1">shipping/flatrate</base_url>
27
+ <sort_order>4</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ <comment>Allowed file types: jpeg, gif, png.</comment>
32
+ </image>
33
+ <display_options translate="label">
34
+ <label>Display Logo Options</label>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>shippinglogo/adminhtml_system_config_source_options</source_model>
37
+ <sort_order>5</sort_order>
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
+ </display_options>
42
+ </fields>
43
+ </flatrate>
44
+ <freeshipping translate="label">
45
+ <label>Free Shipping</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>2</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
+ <fields>
52
+ <image translate="label">
53
+ <label>Shipping Logo</label>
54
+ <frontend_type>image</frontend_type>
55
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
56
+ <upload_dir config="system/filesystem/media" scope_info="1">shipping/freeshipping</upload_dir>
57
+ <base_url type="media" scope_info="1">shipping/freeshipping</base_url>
58
+ <sort_order>4</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ <comment>Allowed file types: jpeg, gif, png.</comment>
63
+ </image>
64
+ <display_options translate="label">
65
+ <label>Display Logo Options</label>
66
+ <frontend_type>select</frontend_type>
67
+ <source_model>shippinglogo/adminhtml_system_config_source_options</source_model>
68
+ <sort_order>5</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ </display_options>
73
+ </fields>
74
+ </freeshipping>
75
+ <tablerate translate="label">
76
+ <label>Table Rates</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>2</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ <fields>
83
+ <image translate="label">
84
+ <label>Shipping Logo</label>
85
+ <frontend_type>image</frontend_type>
86
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
87
+ <upload_dir config="system/filesystem/media" scope_info="1">shipping/tablerate</upload_dir>
88
+ <base_url type="media" scope_info="1">shipping/tablerate</base_url>
89
+ <sort_order>4</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ <comment>Allowed file types: jpeg, gif, png.</comment>
94
+ </image>
95
+ <display_options translate="label">
96
+ <label>Display Logo Options</label>
97
+ <frontend_type>select</frontend_type>
98
+ <source_model>shippinglogo/adminhtml_system_config_source_options</source_model>
99
+ <sort_order>5</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </display_options>
104
+ </fields>
105
+ </tablerate>
106
+ </groups>
107
+ </carriers>
108
+ </sections>
109
+ </config>
app/design/frontend/default/default/layout/shippinglogo.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <checkout_onepage_shippingmethod>
4
+ <!-- Mage_Checkout -->
5
+ <remove name="right"/>
6
+ <remove name="left"/>
7
+
8
+ <block type="checkout/onepage_shipping_method_available" name="root" output="toHtml" template="shippinglogo/checkout/onepage/shipping_method/available.phtml"/>
9
+ </checkout_onepage_shippingmethod>
10
+ </layout>
app/design/frontend/default/default/template/shippinglogo/checkout/onepage/shipping_method/available.phtml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Checkout_Block_Onepage_Shipping_Method_Available */ ?>
28
+ <?php $_shippingRateGroups = $this->getShippingRates(); ?>
29
+ <?php if (!$_shippingRateGroups): ?>
30
+ <p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
31
+ <?php else: ?>
32
+ <dl class="sp-methods">
33
+ <?php $shippingCodePrice = array(); ?>
34
+ <?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
35
+ <dt><?php echo $this->getTitleImage($code); ?></dt>
36
+ <dd>
37
+ <ul>
38
+ <?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
39
+ <?php $shippingCodePrice[] = "'".$_rate->getCode()."':".(float)$_rate->getPrice(); ?>
40
+ <li>
41
+ <?php if ($_rate->getErrorMessage()): ?>
42
+ <ul class="messages"><li class="error-msg"><ul><li><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li></ul></li></ul>
43
+ <?php else: ?>
44
+ <?php if ($_sole) : ?>
45
+ <span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
46
+ <?php else: ?>
47
+ <input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>
48
+
49
+ <?php if ($_rate->getCode() === $this->getAddressShippingMethod()): ?>
50
+ <script type="text/javascript">
51
+ //<![CDATA[
52
+ lastPrice = <?php echo (float)$_rate->getPrice(); ?>;
53
+ //]]>
54
+ </script>
55
+ <?php endif; ?>
56
+
57
+ <?php endif; ?>
58
+ <label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
59
+ <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
60
+ <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
61
+ <?php echo $_excl; ?>
62
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
63
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
64
+ <?php endif; ?>
65
+ </label>
66
+ <?php endif ?>
67
+ </li>
68
+ <?php endforeach; ?>
69
+ </ul>
70
+ </dd>
71
+ <?php endforeach; ?>
72
+ </dl>
73
+ <script type="text/javascript">
74
+ //<![CDATA[
75
+ <?php if (!empty($shippingCodePrice)): ?>
76
+ var shippingCodePrice = {<?php echo implode(',',$shippingCodePrice); ?>};
77
+ <?php endif; ?>
78
+
79
+ $$('input[type="radio"][name="shipping_method"]').each(function(el){
80
+ Event.observe(el, 'click', function(){
81
+ if (el.checked == true) {
82
+ var getShippingCode = el.getValue();
83
+ <?php if (!empty($shippingCodePrice)): ?>
84
+ var newPrice = shippingCodePrice[getShippingCode];
85
+ if (!lastPrice) {
86
+ lastPrice = newPrice;
87
+ quoteBaseGrandTotal += newPrice;
88
+ }
89
+ if (newPrice != lastPrice) {
90
+ quoteBaseGrandTotal += (newPrice-lastPrice);
91
+ lastPrice = newPrice;
92
+ }
93
+ <?php endif; ?>
94
+ checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
95
+ return false;
96
+ }
97
+ });
98
+ });
99
+ //]]>
100
+ </script>
101
+ <?php endif; ?>
app/etc/modules/Nikolakisae_ShippingLogo.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Nikolakisae_ShippingLogo>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Checkout/>
9
+ <Mage_Shipping/>
10
+ </depends>
11
+ </Nikolakisae_ShippingLogo>
12
+ </modules>
13
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Nikolakisae_ShippingLogo</name>
4
+ <version>0.1.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>Shipping Logo extension for Magento</summary>
10
+ <description>Display a shipping method logo or shipping method logo and method title or method title and shipping method logo or just method title for the Magento's default shipping methods: Flat Rate, Table Rates and Free Shipping.</description>
11
+ <notes>Stable for Magento Vesrion 1.7, 1.8 and 1.8.1</notes>
12
+ <authors><author><name>Niko K</name><user>nikolakisae</user><email>info@nikolakisae.com</email></author></authors>
13
+ <date>2013-12-15</date>
14
+ <time>18:00:16</time>
15
+ <contents><target name="magecommunity"><dir name="Nikolakisae"><dir name="ShippingLogo"><dir name="Block"><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="2669ccd63d3c375a550b2efd06ed932b"/></dir></dir></dir></dir></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Options.php" hash="cd50982d7bf483348a50e6fcf298138a"/></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="49b9697ab58984211b1dbb920b43c6b9"/><file name="system.xml" hash="4b3f3b136ecd63b4f6b568e29389d555"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="shippinglogo.xml" hash="d2a2cc30b82d87dc56458999e1d227d5"/></dir><dir name="template"><dir name="shippinglogo"><dir name="checkout"><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="cc754addaf0da4884334143b33678cfd"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Nikolakisae_ShippingLogo.xml" hash="5ec80126ca88bbc68af44ede7eda5cdb"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>