leonambernini_buyfloatingbutton - Version 1.0.0

Version Notes

The first version stable

Download this release

Release Info

Developer Leonam Bernini
Extension leonambernini_buyfloatingbutton
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/LeonamBernini/BuyFloatingButton/Block/Buyfloatingbutton.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_BuyFloatingButton_Block_Buyfloatingbutton extends Mage_Catalog_Block_Product_Abstract
4
+ {
5
+ }
app/code/community/LeonamBernini/BuyFloatingButton/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LeonamBernini_BuyFloatingButton_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/LeonamBernini/BuyFloatingButton/etc/config.xml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <LeonamBernini_BuyFloatingButton>
5
+ <version>1.0.0</version>
6
+ </LeonamBernini_BuyFloatingButton>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <routers>
11
+ <buyfloatingbutton>
12
+ <use>standard</use>
13
+ <args>
14
+ <module>LeonamBernini_BuyFloatingButton</module>
15
+ <frontName>buyfloatingbutton</frontName>
16
+ </args>
17
+ </buyfloatingbutton>
18
+ </routers>
19
+ <translate>
20
+ <modules>
21
+ <LeonamBernini_BuyFloatingButton>
22
+ <files>
23
+ <default>LeonamBernini_BuyFloatingButton.csv</default>
24
+ </files>
25
+ </LeonamBernini_BuyFloatingButton>
26
+ </modules>
27
+ </translate>
28
+ <layout>
29
+ <updates>
30
+ <buyfloatingbutton>
31
+ <file>leonambernini/buyfloatingbutton.xml</file>
32
+ </buyfloatingbutton>
33
+ </updates>
34
+ </layout>
35
+ </frontend>
36
+
37
+ <adminhtml>
38
+ <layout>
39
+ <updates>
40
+ <leonambernini>
41
+ <file>buyfloatingbutton/buyfloatingbutton.xml</file>
42
+ </leonambernini>
43
+ </updates>
44
+ </layout>
45
+
46
+ <translate>
47
+ <modules>
48
+ <LeonamBernini_BuyFloatingButton>
49
+ <files>
50
+ <default>LeonamBernini_BuyFloatingButton.csv</default>
51
+ </files>
52
+ </LeonamBernini_BuyFloatingButton>
53
+ </modules>
54
+ </translate>
55
+
56
+ <acl>
57
+ <resources>
58
+ <admin>
59
+ <children>
60
+ <system>
61
+ <children>
62
+ <config>
63
+ <children>
64
+ <buyfloatingbutton>
65
+ <title>BuyFloatingButton Settings - NEX</title>
66
+ </buyfloatingbutton>
67
+ </children>
68
+ </config>
69
+ </children>
70
+ </system>
71
+ </children>
72
+ </admin>
73
+ </resources>
74
+ </acl>
75
+
76
+ </adminhtml>
77
+
78
+ <global>
79
+
80
+ <resources>
81
+ <buyfloatingbutton_setup>
82
+ <setup>
83
+ <module>LeonamBernini_BuyFloatingButton</module>
84
+ </setup>
85
+ <connection>
86
+ <use>core_setup</use>
87
+ </connection>
88
+ </buyfloatingbutton_setup>
89
+ <buyfloatingbutton_write>
90
+ <connection>
91
+ <use>core_write</use>
92
+ </connection>
93
+ </buyfloatingbutton_write>
94
+ <buyfloatingbutton_read>
95
+ <connection>
96
+ <use>core_read</use>
97
+ </connection>
98
+ </buyfloatingbutton_read>
99
+ </resources>
100
+
101
+ <blocks>
102
+ <buyfloatingbutton>
103
+ <class>LeonamBernini_BuyFloatingButton_Block</class>
104
+ </buyfloatingbutton>
105
+ </blocks>
106
+
107
+ <helpers>
108
+ <buyfloatingbutton>
109
+ <class>LeonamBernini_BuyFloatingButton_Helper</class>
110
+ </buyfloatingbutton>
111
+ </helpers>
112
+ </global>
113
+
114
+ <default>
115
+ <buyfloatingbutton>
116
+ <general>
117
+ <enable>0</enable>
118
+ </general>
119
+ </buyfloatingbutton>
120
+ </default>
121
+
122
+ <admin>
123
+ <routers>
124
+ <buyfloatingbutton>
125
+ <use>admin</use>
126
+ <args>
127
+ <module>LeonamBernini_BuyFloatingButton</module>
128
+ <frontName>buyfloatingbutton</frontName>
129
+ </args>
130
+ </buyfloatingbutton>
131
+ </routers>
132
+ </admin>
133
+
134
+ </config>
app/code/community/LeonamBernini/BuyFloatingButton/etc/system.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <leonambernini translate="label">
5
+ <label>Leonam Bernini</label>
6
+ <sort_order>100</sort_order>
7
+ </leonambernini>
8
+ </tabs>
9
+ <sections>
10
+ <buyfloatingbutton translate="label" module="buyfloatingbutton">
11
+ <label>Buy Floating Button</label>
12
+ <class>buyfloatingbutton-section</class>
13
+ <tab>leonambernini</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>9999</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <general translate="label">
21
+ <label>General</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <enable translate="label comment">
29
+ <label>Enable</label>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </enable>
37
+ </fields>
38
+ </general>
39
+ </groups>
40
+ </buyfloatingbutton>
41
+ </sections>
42
+ </config>
app/design/frontend/base/default/layout/leonambernini/buyfloatingbutton.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <catalog_product_view>
4
+ <reference name="head">
5
+ <action method="addJs">
6
+ <script>leonam_bernini/buyfloatingbutton/buybutton.js</script>
7
+ </action>
8
+ <action method="addCss">
9
+ <stylesheet>leonam_bernini/buyfloatingbutton/css/buybutton.css</stylesheet>
10
+ </action>
11
+ </reference>
12
+ <reference name="product.info.form">
13
+ <block type="buyfloatingbutton/buyfloatingbutton" name="leonambernini.buyfloatingbutton" template="leonambernini/buyfloatingbutton/addtocart.phtml" output="toHtml"/>
14
+ </reference>
15
+ </catalog_product_view>
16
+ </layout>
app/design/frontend/base/default/template/leonambernini/buyfloatingbutton/addtocart.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_product = $this->getProduct(); ?>
2
+ <?php $buttonTitle = $this->__('Add to Cart'); ?>
3
+ <?php if($_product->isSaleable()): ?>
4
+ <?php if( Mage::getStoreConfig("buyfloatingbutton/general/enable") ): ?>
5
+ <div id="add-to-cart-floating" class="add-to-cart-floating">
6
+ <span id="open-close-box-floating" class="open-close-box-floating" title="<?php echo $this->__('Buy Floating Button') ?>"></span><!-- .open-close-box-floating -->
7
+ <span class="price-info-floating">
8
+ <?php echo $this->getPriceHtml($_product, false, '-floating') ?>
9
+ <?php echo $this->getChildHtml('bundle_prices') ?>
10
+ <?php echo $this->getTierPriceHtml() ?>
11
+ </span><!-- .box-prices-floating -->
12
+ <div class="add-to-cart-buttons">
13
+ <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart-floating" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
14
+ <?php echo $this->getChildHtml('', true, true) ?>
15
+ </div>
16
+ </div><!-- add-to-cart-floating -->
17
+ <?php endif; ?>
18
+ <?php endif; ?>
app/etc/modules/LeonamBernini_BuyFloatingButton.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ * @category LeonamBernini
4
+ * @package LeonamBernini_BuyFloatingButton
5
+ * @copyright Copyright (c) 2014 Leonam Bernini. (http://www.agencianex.com.br)
6
+ */
7
+ -->
8
+ <config>
9
+ <modules>
10
+ <LeonamBernini_BuyFloatingButton>
11
+ <active>true</active>
12
+ <codePool>community</codePool>
13
+ </LeonamBernini_BuyFloatingButton>
14
+ </modules>
15
+ </config>
app/locale/en_US/LeonamBernini_BuyFloatingButton.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ "BuyFloatingButton Settings - NEX", "BuyFloatingButton Settings - NEX"
2
+ "Buy Floating Button", "Buy Floating Button"
3
+ "General", "General"
4
+ "Enable", "Enable"
5
+ "Add to Cart", "Add to Cart"
app/locale/pt_BR/LeonamBernini_BuyFloatingButton.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ "BuyFloatingButton Settings - NEX", "Botão Comprar Flutuante Configurações - NEX"
2
+ "Buy Floating Button", "Botão Comprar Flutuante"
3
+ "General", "Geral"
4
+ "Enable", "Habilitado"
5
+ "Add to Cart", "Comprar"
js/leonam_bernini/buyfloatingbutton/buybutton.js ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Created on : 06/11/2014, 04:35:27
3
+ Author : Leonam Bernini (leonamb19@gmail.com)
4
+ */
5
+ window.onload = function()
6
+ {
7
+ var $prices = document.getElementsByClassName('price');
8
+ var $btnOpenCloseBox = document.getElementById("open-close-box-floating");
9
+ var $addToCartFloating = document.getElementById('add-to-cart-floating');
10
+
11
+ var i, priceId, elementTemp, elementFloatingTemp;
12
+
13
+ for (i = 0; i < $prices.length; i++ ) {
14
+ priceId = ( $prices[i].id != '' && $prices[i].id != null && $prices[i].id != 'undefined' ) ? $prices[i].id : $prices[i].parentNode.id;
15
+ elementTemp = document.getElementById(priceId);
16
+ elementFloatingTemp = document.getElementById(priceId + '-floating');
17
+
18
+ if ( ( typeof(elementTemp) !== undefined && elementTemp !== null ) &&
19
+ ( typeof(elementFloatingTemp) !== undefined && elementFloatingTemp !== null ) ){
20
+
21
+ elementTemp.addEventListener("DOMSubtreeModified", function (e) {
22
+ if( this.innerHTML !== null && this.innerHTML !== '' ){
23
+ var temp = document.getElementById(this.id+'-floating');
24
+ if( typeof(temp) !== undefined && temp !== null ){
25
+ temp.innerHTML = this.innerHTML;
26
+ }
27
+ }
28
+ }, false);
29
+
30
+ }
31
+
32
+ }
33
+
34
+ var hideShowBuyFloatingButton = function()
35
+ {
36
+ var elementTop;
37
+ var doc = document.documentElement;
38
+ var scroll = ( window.pageYOffset || doc.scrollTop ) - ( doc.clientTop || 0 );
39
+ var element = document.getElementsByClassName('btn-cart')[0];
40
+ var box = $addToCartFloating;
41
+ var rect = element.getBoundingClientRect();
42
+ var scrollTop = document.documentElement.scrollTop?
43
+ document.documentElement.scrollTop:document.body.scrollTop;
44
+ elementTop = rect.top+scrollTop;
45
+
46
+ if( scroll >= elementTop -50 ){
47
+ box.style.display = 'block';
48
+ }else{
49
+ box.style.display = 'none';
50
+ }
51
+ }
52
+ hideShowBuyFloatingButton();
53
+ window.onscroll = function(){ hideShowBuyFloatingButton(); }
54
+
55
+ if ( typeof($btnOpenCloseBox) !== undefined && $btnOpenCloseBox !== null ){
56
+ $btnOpenCloseBox.onclick = function()
57
+ {
58
+ var $box = $addToCartFloating;
59
+
60
+ if ( $box.className.search(/\badd-to-cart-floating-closed\b/gi) !== -1 ){
61
+ $box.className = $box.className.replace(/\badd-to-cart-floating-closed\b/gi, '');
62
+ }else{
63
+ $box.className += ' add-to-cart-floating-closed ';
64
+ }
65
+ }
66
+ }
67
+ }
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>leonambernini_buyfloatingbutton</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/academic.php">Academic Free License 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Buy Floating Button extension for magento</summary>
10
+ <description>Buy button floating, the best way to get the attention of the User to complete a purchase.</description>
11
+ <notes>The first version stable</notes>
12
+ <authors><author><name>Leonam Bernini</name><user>leonambernini</user><email>leonam.b@hotmail.com</email></author></authors>
13
+ <date>2014-11-10</date>
14
+ <time>18:35:24</time>
15
+ <contents><target name="magecommunity"><dir name="LeonamBernini"><dir name="BuyFloatingButton"><dir name="Block"><file name="Buyfloatingbutton.php" hash="3dd3cc5ba83541fa72b7559a6f65736e"/></dir><dir name="Helper"><file name="Data.php" hash="d9627807c9cfe2b0ae96fedd8334992f"/></dir><dir name="etc"><file name="config.xml" hash="6e3a025d18728cbd6efa48fefb70259f"/><file name="system.xml" hash="d963ae8356aafab3cd03fe2d913ef683"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="leonambernini"><file name="buyfloatingbutton.xml" hash="ad4a7ddbdf23af47768214f0fd3f56a0"/></dir></dir><dir name="template"><dir name="leonambernini"><dir name="buyfloatingbutton"><file name="addtocart.phtml" hash="502ad9e23c7657d08f1a423d997b3ff3"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LeonamBernini_BuyFloatingButton.xml" hash="4be22dd5e4c852a1b45bd454382f114f"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="leonam_bernini"><dir name="buyfloatingbutton"><dir name="css"><file name="buybutton.css" hash="20e5f479841a5f91ef1cdbac917ee2a4"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="LeonamBernini_BuyFloatingButton.csv" hash="f6759fc8a4fa0f5486641a375e176d92"/></dir><dir name="pt_BR"><file name="LeonamBernini_BuyFloatingButton.csv" hash="b1c4c878138e86162d79f784e9e381bd"/></dir></dir></target><target name="mage"><dir name="js"><dir name="leonam_bernini"><dir name="buyfloatingbutton"><file name="buybutton.js" hash="239ea7d168aff720f356099386335a29"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/leonam_bernini/buyfloatingbutton/css/buybutton.css ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Created on : 06/11/2014, 04:35:27
3
+ Author : Leonam Bernini (leonamb19@gmail.com)
4
+ */
5
+
6
+ .add-to-cart-floating,
7
+ .add-to-cart-floating-closed,
8
+ .add-to-cart-floating #open-close-box-floating:before,
9
+ #add-to-cart-floating .add-to-cart-buttons,
10
+ #add-to-cart-floating .add-to-cart-buttons .button{
11
+ -webkit-box-sizing: border-box;
12
+ -moz-box-sizing: border-box;
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ .add-to-cart-floating{
17
+ background-color: #f7f7f7;
18
+ border-right: 3px solid #d4d4d4;
19
+ border-radius: 0 0 0 4px;
20
+ display: none;
21
+ padding: 20px;
22
+ position: fixed;
23
+ right: 0;
24
+ top: 10%;
25
+ width: 200px;
26
+ z-index: 99998;
27
+ -webkit-transition: 150ms all linear 0s; -moz-transition: 150ms all linear 0s; -o-transition: 150ms all linear 0s; transition: 150ms all linear 0s;
28
+ }
29
+ .add-to-cart-floating-closed{
30
+ right: -200px;
31
+ -webkit-transition: 150ms all linear 0s; -moz-transition: 150ms all linear 0s; -o-transition: 150ms all linear 0s; transition: 150ms all linear 0s;
32
+ }
33
+ .add-to-cart-floating #open-close-box-floating:before{
34
+ background-color: #f0f0f0;
35
+ border-bottom: 2px solid #d4d4d4;
36
+ border-radius: 4px 0 0 4px;
37
+ content: "˃";
38
+ color: #2a2a2a;
39
+ cursor: pointer;
40
+ display: block;
41
+ font: 700 15px/24px Arial, sans-serif;
42
+ height: 25px;
43
+ left: -25px;
44
+ position: absolute;
45
+ text-align: center;
46
+ top: 0;
47
+ width: 25px;
48
+ z-index: 99999;
49
+ -webkit-transition: 150ms all linear 0s; -moz-transition: 150ms all linear 0s; -o-transition: 150ms all linear 0s; transition: 150ms all linear 0s;
50
+ }
51
+ .add-to-cart-floating #open-close-box-floating:hover:before,
52
+ .add-to-cart-floating-closed #open-close-box-floating:before{
53
+ display: block;
54
+ background-color: #009609;
55
+ border-bottom: 2px solid #002e02;
56
+ color: #fff;
57
+ -webkit-transition: 150ms all linear 0s; -moz-transition: 150ms all linear 0s; -o-transition: 150ms all linear 0s; transition: 150ms all linear 0s;
58
+ }
59
+ .add-to-cart-floating-closed #open-close-box-floating:before{
60
+ content: "<";
61
+ }
62
+
63
+ #add-to-cart-floating .price-info,
64
+ #add-to-cart-floating .price-box{ display: block; float: none; max-width: 100%; margin: 0; padding: 0; text-align: left; width: 100%; }
65
+ #add-to-cart-floating .old-price,
66
+ #add-to-cart-floating .special-price{ display: block; text-align: left; padding: 3px 0; }
67
+ #add-to-cart-floating .old-price{ color: #d4d4d4; font-size: 12px; line-height: 15px; text-decoration: line-through; }
68
+ #add-to-cart-floating .special-price{ color: #2a2a2a; font-size: 18px; line-height: 22px; }
69
+ #add-to-cart-floating .special-price .price{ font-weight: 700; }
70
+
71
+ #add-to-cart-floating .add-to-cart-buttons{
72
+ border-top: 1px solid #f7f7f7;
73
+ display: block;
74
+ float: none;
75
+ margin-top: 10%;
76
+ padding-top: 10px;
77
+ text-align: center;
78
+ }
79
+ #add-to-cart-floating .add-to-cart-buttons .button{
80
+ display: block;
81
+ float: none;
82
+ width: 100%;
83
+ }