Version Notes
Version 1.2.2:
* Fixes JSON is error response
* Fix IE9 Compatability
* Conform to the HTML specification
Download this release
Release Info
Developer | stockinchannel |
Extension | Sinch_Tonerconfigurator |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.2.2
- app/code/local/Sinch/Tonerconfigurator/controllers/AjaxController.php +3 -3
- app/code/local/Sinch/Tonerconfigurator/etc/config.xml +1 -13
- app/code/local/Sinch/Tonerconfigurator/etc/widget.xml +1 -1
- app/design/frontend/default/default/template/tonerconfigurator/configuratorscript.phtml +16 -6
- package.xml +8 -6
app/code/local/Sinch/Tonerconfigurator/controllers/AjaxController.php
CHANGED
@@ -6,15 +6,15 @@ class Sinch_Tonerconfigurator_AjaxController extends Mage_Core_Controller_Front_
|
|
6 |
$catid = $this->getRequest()->getParam('catid', null);
|
7 |
$lastlevel = $this->getRequest()->getParam('lastlevel', 0);
|
8 |
if(!$catid){
|
9 |
-
$this->getResponse()->setBody(
|
10 |
return;
|
11 |
}
|
12 |
$category = Mage::getModel('catalog/category')->load($catid);
|
13 |
if(!$category->hasChildren()){
|
14 |
-
$this->getResponse()->setBody(
|
15 |
return;
|
16 |
}
|
17 |
-
$children = $category->getChildrenCategories();
|
18 |
$response = array();
|
19 |
$response['success'] = false;
|
20 |
$response['subcategories'] = array();
|
6 |
$catid = $this->getRequest()->getParam('catid', null);
|
7 |
$lastlevel = $this->getRequest()->getParam('lastlevel', 0);
|
8 |
if(!$catid){
|
9 |
+
$this->getResponse()->setBody('{ "success": false, "subcategories": [] }');
|
10 |
return;
|
11 |
}
|
12 |
$category = Mage::getModel('catalog/category')->load($catid);
|
13 |
if(!$category->hasChildren()){
|
14 |
+
$this->getResponse()->setBody('{ "success": false, "subcategories": [] }');
|
15 |
return;
|
16 |
}
|
17 |
+
$children = (Mage::getSingleton('tonerconfigurator/category')->isRootCategory($catid) ? Mage::getSingleton('tonerconfigurator/category')->getRootSubcatColl() : $category->getChildrenCategories());
|
18 |
$response = array();
|
19 |
$response['success'] = false;
|
20 |
$response['subcategories'] = array();
|
app/code/local/Sinch/Tonerconfigurator/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Sinch_Tonerconfigurator>
|
5 |
-
<version>1.
|
6 |
</Sinch_Tonerconfigurator>
|
7 |
</modules>
|
8 |
|
@@ -16,13 +16,6 @@
|
|
16 |
</args>
|
17 |
</tonerconfigurator>
|
18 |
</routers>
|
19 |
-
<!--<layout>
|
20 |
-
<updates>
|
21 |
-
<tonerconfigurator>
|
22 |
-
<file>tonerconfigurator.xml</file>
|
23 |
-
</tonerconfigurator>
|
24 |
-
</updates>
|
25 |
-
</layout>-->
|
26 |
</frontend>
|
27 |
|
28 |
<global>
|
@@ -35,11 +28,6 @@
|
|
35 |
<tonerconfigurator>
|
36 |
<class>Sinch_Tonerconfigurator_Helper</class>
|
37 |
</tonerconfigurator>
|
38 |
-
<catalog>
|
39 |
-
<rewrite>
|
40 |
-
<category>Sinch_Tonerconfigurator_Helper_Category</category>
|
41 |
-
</rewrite>
|
42 |
-
</catalog>
|
43 |
</helpers>
|
44 |
<models>
|
45 |
<tonerconfigurator>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Sinch_Tonerconfigurator>
|
5 |
+
<version>1.2.2</version>
|
6 |
</Sinch_Tonerconfigurator>
|
7 |
</modules>
|
8 |
|
16 |
</args>
|
17 |
</tonerconfigurator>
|
18 |
</routers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</frontend>
|
20 |
|
21 |
<global>
|
28 |
<tonerconfigurator>
|
29 |
<class>Sinch_Tonerconfigurator_Helper</class>
|
30 |
</tonerconfigurator>
|
|
|
|
|
|
|
|
|
|
|
31 |
</helpers>
|
32 |
<models>
|
33 |
<tonerconfigurator>
|
app/code/local/Sinch/Tonerconfigurator/etc/widget.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<widgets>
|
3 |
<tonerconfigurator_configurator type="tonerconfigurator/configurator">
|
4 |
<name>StockInTheChannel - Toner Configurator</name>
|
5 |
-
<description type="desc">Adds the StockInTheChannel Toner Configurator - Coded By
|
6 |
<parameters>
|
7 |
<title translate="label">
|
8 |
<label>Title</label>
|
2 |
<widgets>
|
3 |
<tonerconfigurator_configurator type="tonerconfigurator/configurator">
|
4 |
<name>StockInTheChannel - Toner Configurator</name>
|
5 |
+
<description type="desc">Adds the StockInTheChannel Toner Configurator - Coded By Sinch</description>
|
6 |
<parameters>
|
7 |
<title translate="label">
|
8 |
<label>Title</label>
|
app/design/frontend/default/default/template/tonerconfigurator/configuratorscript.phtml
CHANGED
@@ -6,6 +6,8 @@ if(val == null || val == "")return;
|
|
6 |
var reloadurl = '<?php echo $this->getUrl('tonerconfigurator/ajax/loadDropdown') ?>';
|
7 |
if(maxtonerlevel == level){
|
8 |
window.location.href = val;
|
|
|
|
|
9 |
}
|
10 |
loadMask(true, configurator);
|
11 |
var inputs = configurator.getElementsByTagName('select');
|
@@ -21,18 +23,26 @@ new Ajax.Request(reloadurl, {
|
|
21 |
method: 'get',
|
22 |
parameters: '',
|
23 |
onComplete: function(transport){
|
24 |
-
var newCategories =
|
25 |
-
if(!newCategories.success)alert("Somthing Went Wrong");
|
26 |
for(var i = level; i < maxtonerlevel; i++){
|
27 |
var a = configurator.getElementsByTagName('select')[i];
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
-
var
|
31 |
for(var i = 0; i < newCategories.subcategories.length; i++){
|
32 |
var data = ((newCategories.subcategories[i].id == null) ? newCategories.subcategories[i].URL : newCategories.subcategories[i].id);
|
33 |
-
|
|
|
|
|
|
|
34 |
}
|
35 |
-
configurator.getElementsByTagName('select')[level].innerHTML += newSelect;
|
36 |
var inputs = configurator.getElementsByTagName('select');
|
37 |
for (var i = 0; i < newLevel; i++) {
|
38 |
inputs[i].disabled = false;
|
6 |
var reloadurl = '<?php echo $this->getUrl('tonerconfigurator/ajax/loadDropdown') ?>';
|
7 |
if(maxtonerlevel == level){
|
8 |
window.location.href = val;
|
9 |
+
loadMask(true, configurator);
|
10 |
+
return;
|
11 |
}
|
12 |
loadMask(true, configurator);
|
13 |
var inputs = configurator.getElementsByTagName('select');
|
23 |
method: 'get',
|
24 |
parameters: '',
|
25 |
onComplete: function(transport){
|
26 |
+
var newCategories = transport.responseJSON;
|
27 |
+
if(!newCategories || !newCategories.success)alert("Somthing Went Wrong");
|
28 |
for(var i = level; i < maxtonerlevel; i++){
|
29 |
var a = configurator.getElementsByTagName('select')[i];
|
30 |
+
for(var j = 0; j < a.options.length; j++){
|
31 |
+
a.remove(j);
|
32 |
+
}
|
33 |
+
var o = document.createElement('option');
|
34 |
+
o.text = a.getAttribute('data-tonertitle'); //Implicitly sets label as well
|
35 |
+
o.selected = true;
|
36 |
+
a.add(o, null); //Null param is for pre-HTML5 and pre-gecko7 support
|
37 |
}
|
38 |
+
var modifiedSelect = configurator.getElementsByTagName('select')[level];
|
39 |
for(var i = 0; i < newCategories.subcategories.length; i++){
|
40 |
var data = ((newCategories.subcategories[i].id == null) ? newCategories.subcategories[i].URL : newCategories.subcategories[i].id);
|
41 |
+
var o = document.createElement('option');
|
42 |
+
o.text = newCategories.subcategories[i].name;
|
43 |
+
o.value = data;
|
44 |
+
modifiedSelect.add(o, null);
|
45 |
}
|
|
|
46 |
var inputs = configurator.getElementsByTagName('select');
|
47 |
for (var i = 0; i < newLevel; i++) {
|
48 |
inputs[i].disabled = false;
|
package.xml
CHANGED
@@ -1,19 +1,21 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sinch_Tonerconfigurator</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Stockinthechannel.com's Toner Configurator</summary>
|
10 |
<description>Toner Configurator for use with Stockinthechannel.com's Toner Feed Export</description>
|
11 |
-
<notes>Version 1.
|
12 |
-
*
|
|
|
|
|
13 |
<authors><author><name>stockinchannel</name><user>stockinchannel</user><email>support@stockinthechannel.com</email></author><author><name>Nick Anstee</name><user>nicka101</user><email>nick@stockinthechannel.com</email></author></authors>
|
14 |
-
<date>2013-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magelocal"><dir name="Sinch"><dir name="Tonerconfigurator"><dir name="Block"><file name="Configurator.php" hash="aa540c9a2bbc7bbdbfa52bd996c40967"/><file name="Configuratordropdowns.php" hash="b71cd48c7afd90c1a85f3379875480c3"/></dir><dir name="Helper"><file name="Category.php" hash="4ae090a183e13b2b6f88669bcb7f00ef"/><file name="Data.php" hash="963744c7c85b3179d7a8287d253c17ac"/></dir><dir name="Model"><file name="Category.php" hash="ca8a3711f4e10fcbb87b45466bf33dc0"/></dir><dir name="controllers"><file name="AjaxController.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sinch_Tonerconfigurator</name>
|
4 |
+
<version>1.2.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Stockinthechannel.com's Toner Configurator</summary>
|
10 |
<description>Toner Configurator for use with Stockinthechannel.com's Toner Feed Export</description>
|
11 |
+
<notes>Version 1.2.2:
|
12 |
+
* Fixes JSON is error response
|
13 |
+
* Fix IE9 Compatability
|
14 |
+
* Conform to the HTML specification</notes>
|
15 |
<authors><author><name>stockinchannel</name><user>stockinchannel</user><email>support@stockinthechannel.com</email></author><author><name>Nick Anstee</name><user>nicka101</user><email>nick@stockinthechannel.com</email></author></authors>
|
16 |
+
<date>2013-11-22</date>
|
17 |
+
<time>17:37:47</time>
|
18 |
+
<contents><target name="magelocal"><dir name="Sinch"><dir name="Tonerconfigurator"><dir name="Block"><file name="Configurator.php" hash="aa540c9a2bbc7bbdbfa52bd996c40967"/><file name="Configuratordropdowns.php" hash="b71cd48c7afd90c1a85f3379875480c3"/></dir><dir name="Helper"><file name="Category.php" hash="4ae090a183e13b2b6f88669bcb7f00ef"/><file name="Data.php" hash="963744c7c85b3179d7a8287d253c17ac"/></dir><dir name="Model"><file name="Category.php" hash="ca8a3711f4e10fcbb87b45466bf33dc0"/></dir><dir name="controllers"><file name="AjaxController.php" hash="05ec5f6fc5cfb950ede11fff4a7f1d63"/></dir><dir name="etc"><file name="config.xml" hash="4f9eb45054d82fdb8ae2f98fee941e95"/><file name="widget.xml" hash="6cd08f045ee8517d267d5d1c4e64990a"/></dir><dir name="sql"><file name="mysql4-install-0.1.0.php" hash="3b052403649a5970bcaf8264ae06cd8e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sinch_Tonerconfigurator.xml" hash="27db1fe889731da93159361df23dcd45"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="tonerconfigurator"><file name="configurator.phtml" hash="8a8863f441cfb008fcb4c0e5673d35ca"/><file name="configuratordropdowns.phtml" hash="a3cf9439915387af3382c65b2422c765"/><file name="configuratorscript.phtml" hash="97c0906802690f04455b89b7ed530255"/></dir></dir><dir name="layout"><file name="tonerconfigurator.xml" hash="212a8975fa16dea8516740c013e352d1"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="tonerconfigurator"><file name="custom.css" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="default-noback.css" hash="8cc8540b73809ad6d3e41fb263e6afb3"/><file name="default.css" hash="e4244af2f6e0c5341d30824d050fdd5b"/><file name="inline-noback.css" hash="089a41d0fdb9f61ce83c7af7c6766599"/><file name="inline.css" hash="c9586ceccebc9c928df0deaa96fbf31b"/></dir></dir><dir name="js"><dir name="tonerconfigurator"><file name="spin.js" hash="a0a33607d171b0b3a1935e45c6a96de9"/></dir></dir></dir></dir></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
21 |
</package>
|