Version Notes
none
Download this release
Release Info
Developer | Wyomind |
Extension | Wyomind_QtySwitcher |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Wyomind/Qtyswitcher/etc/config.xml +18 -0
- app/design/frontend/default/default/layout/qtyswitcher.xml +20 -0
- app/design/frontend/default/default/template/qtyswitcher/qtyswitcher.phtml +32 -0
- app/etc/modules/Wyomind_Qtyswitcher.xml +17 -0
- package.xml +23 -0
- skin/frontend/default/default/qtyswitcher/css/qtyswitcher.css +67 -0
- skin/frontend/default/default/qtyswitcher/images/less-2.gif +0 -0
- skin/frontend/default/default/qtyswitcher/images/less.gif +0 -0
- skin/frontend/default/default/qtyswitcher/images/more-2.gif +0 -0
- skin/frontend/default/default/qtyswitcher/images/more.gif +0 -0
- skin/frontend/default/default/qtyswitcher/js/qtyswitcher.js +42 -0
app/code/community/Wyomind/Qtyswitcher/etc/config.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Wyomind_Qtyswitcher>
|
6 |
+
<version>0.1.0</version>
|
7 |
+
</Wyomind_Qtyswitcher>
|
8 |
+
</modules>
|
9 |
+
<frontend>
|
10 |
+
<layout>
|
11 |
+
<updates>
|
12 |
+
<qtyswitcher>
|
13 |
+
<file>qtyswitcher.xml</file>
|
14 |
+
</qtyswitcher>
|
15 |
+
</updates>
|
16 |
+
</layout>
|
17 |
+
</frontend>
|
18 |
+
</config>
|
app/design/frontend/default/default/layout/qtyswitcher.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<catalog_product_view>
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addItem"><type>skin_js</type><name>qtyswitcher/js/qtyswitcher.js</name></action>
|
7 |
+
<action method="addItem"><type>skin_css</type><name>qtyswitcher/css/qtyswitcher.css</name></action>
|
8 |
+
</reference>
|
9 |
+
|
10 |
+
<reference name="content">
|
11 |
+
<reference name="product.info">
|
12 |
+
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="qtyswitcher/qtyswitcher.phtml"/>
|
13 |
+
<reference name="product.info.options.wrapper.bottom">
|
14 |
+
<action method="append"><block>product.info.addtocart</block></action>
|
15 |
+
</reference>
|
16 |
+
</reference>
|
17 |
+
</reference>
|
18 |
+
|
19 |
+
</catalog_product_view>
|
20 |
+
</layout>
|
app/design/frontend/default/default/template/qtyswitcher/qtyswitcher.phtml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
<?php $_product = $this->getProduct() ?>
|
4 |
+
|
5 |
+
<?php if($_product->isSaleable()): ?>
|
6 |
+
<fieldset class="qtyswitcher-add-to-cart-box ">
|
7 |
+
<div class="qtyswitcher-qty">
|
8 |
+
<?php if(!$_product->isGrouped()): ?>
|
9 |
+
<span id="qtyswitcher-qty-box"><label for="qty"><?php echo $this->__('Qty') ?></label></span>
|
10 |
+
<input type='button' id="qtyswitcher-oneless" class='qtyswitcher.btn' onclick="qtyswitcher.removeOne('qtyswitcher-qty','qtyswitcher-clone-qty')"/>
|
11 |
+
|
12 |
+
<?php if(!is_numeric($this->getMinimalQty($_product))) : $qty= 1; ?>
|
13 |
+
<?php else : $qty=$this->getMinimalQty($_product);?>
|
14 |
+
<?php endif; ?>
|
15 |
+
|
16 |
+
<input type="text" class="input-text clone-qty" id="qtyswitcher-clone-qty" maxlength="12" value="<?php echo $qty;?>" disabled='true' />
|
17 |
+
<input type="hidden" name="qty" id="qtyswitcher-qty" value="<?php echo $qty;?>"/>
|
18 |
+
<input type='button' id="qtyswitcher-onemore" class='qtyswitcher.btn' onclick="qtyswitcher.addOne('qtyswitcher-qty','qtyswitcher-clone-qty');"/>
|
19 |
+
</div>
|
20 |
+
<?php else :?>
|
21 |
+
|
22 |
+
<script language="javascript">qtyswitcher.groupedInit("<?php //echo $this->__("Quantity"); ?>")</script>
|
23 |
+
<?php endif; ?>
|
24 |
+
|
25 |
+
<br /><br />
|
26 |
+
|
27 |
+
<div id="qtyswitcher-btn-picto">
|
28 |
+
<!-- <input type="button" id="qtyswitcher-form-btn-products" onclick="productAddToCartForm.submit()" value="<?php /** echo $this->__('Add to Cart') */ ?>" /> -->
|
29 |
+
<input type="image" id="qtyswitcher-form-btn-products" src="<?php echo $this->getSkinUrl('images/btn-addtocart.png') ?>">
|
30 |
+
</div>
|
31 |
+
</fieldset>
|
32 |
+
<?php endif; ?>
|
app/etc/modules/Wyomind_Qtyswitcher.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Felix
|
5 |
+
* @package Felix_Izycart
|
6 |
+
* @author ModuleCreator
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Wyomind_Qtyswitcher>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</Wyomind_Qtyswitcher>
|
16 |
+
</modules>
|
17 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Wyomind_QtySwitcher</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Add a +/- button in the product pages that gives the customers the ability to change the quantity of product in their shopping cart.
|
10 |
+

|
11 |
+
</summary>
|
12 |
+
<description>Add a +/- button in the product pages that gives the customers the ability to change the quantity of product in their shopping cart.
|
13 |
+

|
14 |
+
Not really a big improvement for Magento, but a real improvement for a better navigation experience.
|
15 |
+
</description>
|
16 |
+
<notes>none</notes>
|
17 |
+
<authors><author><name>Wyomind</name><user>Pierre</user><email>contact@wyomind.com</email></author></authors>
|
18 |
+
<date>2012-04-10</date>
|
19 |
+
<time>13:38:42</time>
|
20 |
+
<contents><target name="magecommunity"><dir name="Wyomind"><dir name="Qtyswitcher"><dir name="etc"><file name="config.xml" hash="94b0d2003391ce41a26d1d7110b97634"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wyomind_Qtyswitcher.xml" hash="9013e5d922a0a08383be63f40e6454be"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="qtyswitcher.xml" hash="4783e143e6078629049ff7e2c0e92042"/></dir><dir name="template"><dir name="qtyswitcher"><file name="qtyswitcher.phtml" hash="20d583c767e3191a1c7c32d0248cfe76"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="qtyswitcher"><dir><dir name="css"><file name="qtyswitcher.css" hash="a263862b2adfbcea776639325f544f50"/></dir><dir name="images"><file name="less-2.gif" hash="77b8c602b547e4e2fbbe216efd08f617"/><file name="less.gif" hash="1868a0528c6fa3d532e3df073580a589"/><file name="more-2.gif" hash="89bb6914c23f1ab2caae39645440c225"/><file name="more.gif" hash="1b9db0e43571274cca8b181c389b85fb"/></dir><dir name="js"><file name="qtyswitcher.js" hash="2068dbe228ad6596e56c179bf5d4061d"/></dir></dir></dir></dir></dir></dir></target></contents>
|
21 |
+
<compatible/>
|
22 |
+
<dependencies><required><php><min>4.0.0</min><max>5.6.0</max></php></required></dependencies>
|
23 |
+
</package>
|
skin/frontend/default/default/qtyswitcher/css/qtyswitcher.css
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#qtyswitcher-oneless{
|
2 |
+
border:none;
|
3 |
+
background:white url("../images/less.gif") 50% 50% no-repeat;
|
4 |
+
width:15px;
|
5 |
+
height:20px;
|
6 |
+
cursor:pointer;
|
7 |
+
}
|
8 |
+
#qtyswitcher-onemore{
|
9 |
+
border:none;
|
10 |
+
background:white url("../images/more.gif") 50% 50% no-repeat;
|
11 |
+
width:15px;
|
12 |
+
height:20px;
|
13 |
+
cursor:pointer;
|
14 |
+
}
|
15 |
+
.qtyswitcher-qty .clone-qty{
|
16 |
+
background:none repeat scroll 0 0 white;
|
17 |
+
border:medium none;
|
18 |
+
color:#000000;
|
19 |
+
font-size:16px;
|
20 |
+
font-weight:bold;
|
21 |
+
text-align:center;
|
22 |
+
width:28px;
|
23 |
+
}
|
24 |
+
|
25 |
+
#qtyswitcher-btn-picto{
|
26 |
+
float:right;
|
27 |
+
margin-top:5px;
|
28 |
+
}
|
29 |
+
#qtyswitcher-form-btn-products{
|
30 |
+
cursor:pointer;
|
31 |
+
margin:10px 0 0;
|
32 |
+
border:none;
|
33 |
+
padding:0;
|
34 |
+
}
|
35 |
+
#qtyswitcher-qty-box LABEL{
|
36 |
+
color:#000000;
|
37 |
+
display:block;
|
38 |
+
float:left;
|
39 |
+
font-weight:bold;
|
40 |
+
margin-right:10px;
|
41 |
+
margin-top:3px;
|
42 |
+
}
|
43 |
+
.qtyswitcher-add-to-cart-box {
|
44 |
+
float:right;
|
45 |
+
margin:0;
|
46 |
+
}
|
47 |
+
|
48 |
+
.qtyswitcher-qty {
|
49 |
+
-float:right;
|
50 |
+
margin:0 5px 0 0;
|
51 |
+
}
|
52 |
+
.option-grouped{
|
53 |
+
|
54 |
+
background-color:#FFEAB0!important;
|
55 |
+
}
|
56 |
+
.option-grouped *{
|
57 |
+
display:inline;
|
58 |
+
}
|
59 |
+
.option-grouped dl{
|
60 |
+
display:block
|
61 |
+
}
|
62 |
+
.option-grouped dt{
|
63 |
+
float:left
|
64 |
+
}
|
65 |
+
.option-grouped dd{
|
66 |
+
float:right
|
67 |
+
}
|
skin/frontend/default/default/qtyswitcher/images/less-2.gif
ADDED
Binary file
|
skin/frontend/default/default/qtyswitcher/images/less.gif
ADDED
Binary file
|
skin/frontend/default/default/qtyswitcher/images/more-2.gif
ADDED
Binary file
|
skin/frontend/default/default/qtyswitcher/images/more.gif
ADDED
Binary file
|
skin/frontend/default/default/qtyswitcher/js/qtyswitcher.js
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
document.observe("dom:loaded", function() {
|
3 |
+
qtyswitcher.init();
|
4 |
+
|
5 |
+
})
|
6 |
+
|
7 |
+
qtyswitcher={
|
8 |
+
groupedInit: function(quantity){
|
9 |
+
|
10 |
+
$$('.qty').each(function(e){
|
11 |
+
qty=e.value;
|
12 |
+
name=e.name;
|
13 |
+
html ="<div class='qtyswitcher-qty'>";
|
14 |
+
html+=" <span id='qtyswitcher-qty-box'><label for='qty'>"+quantity+"</label></span>";
|
15 |
+
|
16 |
+
html+="<input type='button' id='qtyswitcher-oneless' class='qtyswitcher.btn' onclick='qtyswitcher.removeOne(\""+name+"\",\""+name+"-clone-qty\")'/>";
|
17 |
+
html+="<input type='text' class='input-text clone-qty' id='"+name+"-clone-qty' maxlength='12' value='"+qty+"' disabled='true' />";
|
18 |
+
html+="<input type='hidden' name='"+name+"' id='"+name+"' value='"+qty+"'/>";
|
19 |
+
html+="<input type='button' id='qtyswitcher-onemore' class='qtyswitcher.btn' onclick='qtyswitcher.addOne(\""+name+"\",\""+name+"-clone-qty\");'/>";
|
20 |
+
//html+="<input type='image' id='qtyswitcher-form-btn-products' src='' >"
|
21 |
+
html+="</div>"
|
22 |
+
e.replace(html);
|
23 |
+
|
24 |
+
})
|
25 |
+
|
26 |
+
},
|
27 |
+
init:function(){
|
28 |
+
|
29 |
+
},
|
30 |
+
addOne: function(id,idClone){
|
31 |
+
count=Math.round($(id).value)+1;
|
32 |
+
$(id).writeAttribute('value',count);
|
33 |
+
$(idClone).writeAttribute('value',count);
|
34 |
+
},
|
35 |
+
removeOne: function(id,idClone){
|
36 |
+
count=Math.round($(id).value)-1;
|
37 |
+
if(count<0)count=0;
|
38 |
+
$(id).writeAttribute('value',count);
|
39 |
+
$(idClone).writeAttribute('value',count);
|
40 |
+
}
|
41 |
+
|
42 |
+
};
|