alfared Posted October 1, 2013 Share Posted October 1, 2013 Hello, I am writing for the English - speaking stream. I need make the module to display the items in alphabetical order.Its maybe free version or take the code from the paid version. I found one, but not free.I newbie in PrestaShop. An example of the display products in alphabetical order: http://www.papirus.com.ua/ Example pay-module: http://addons.prestashop.com/en/search-filters-prestashop-modules/3608-alphabetical-product-search.html Here I found a self conclusion http://www.prestashop.com/forums/topic/273293-solved-how-to-show-items-in-alphabetical-order/ Help! Very necessary That's what I was able to take on the demo site with a paid module. Links to the demo site: http://addons.prestashop.com/demo/FO2279.html How to integrate it into PrestaShop - Module? HTML-block of alphabetic order <div id="" class="block alphabet_search"> <h4>Alphabet Search</h4> <div class="srchbox"> <table border="0" cellpadding="2" cellspacing="2" width="100%" class="alfasrch"> <tbody><tr> <td><input type="button" value="A" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="B" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="C" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="D" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="E" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="F" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="G" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="H" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="I" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> </tr> <tr> <td><input type="button" value="J" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="K" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="L" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="M" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="N" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="O" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="P" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="Q" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="R" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> </tr> <tr> <td><input type="button" value="S" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="T" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="U" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="V" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="W" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="X" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="Y" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="Z" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> <td><input type="button" value="#" class="alpha_btn" id="1" onclick="getProdList(this.value,this.id)"></td> </tr> </tbody></table> </div> <div id="products" class="block_content">No Products</div> <div id="imgDiv"><img src="modules/alphabetsearch/images/ajax-loader.gif" alt="Loading"></div> </div> AJAX-response.Output list of products function getProdList(id,langid) { var xmlHttp=initXMLHTTPRequest(); //console.log(xmlHttp); var str = "value="+id+"&langid="+langid; var span=""; var url = "modules/alphabetsearch/php/searchDetails.php?"; document.getElementById('imgDiv').style.display = 'block'; xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4 ) { document.getElementById('imgDiv').style.display = 'none'; span=span+"<ul style='padding-bottom:20px;'><li><b>"+id+"</b></li>"; var xmldata=xmlHttp.responseXML; var xmlObj = xmldata.getElementsByTagName("ProductDetails")[0]; var menusize=xmlObj.childNodes[0].childNodes[0].childNodes[0].nodeValue; var xmlObjlength = xmlObj.childNodes.length; for(var i=1;i<xmlObjlength;i++) { var ProductName=xmlObj.childNodes[i].childNodes[0].childNodes[0].nodeValue; var productId=xmlObj.childNodes[i].childNodes[1].childNodes[0].nodeValue; span=span+"<li style='line-height:20px;display:block;height:20px;list-style:none;border-bottom:1px solid #666666;'><a href='product.php?id_product="+productId+"'><div>"+ProductName+"</div></a></li>" } if(xmlObjlength==1) { document.getElementById("products").innerHTML=""; document.getElementById("products").innerHTML="Sorry No Products Under this Alphabet"; } else { document.getElementById("products").innerHTML=""; span=span+"</ul>"; document.getElementById("products").innerHTML=span; } } }; xmlHttp.open("POST",url,true); xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.setRequestHeader("Content-length", str.length); xmlHttp.setRequestHeader("Connection", "close"); xmlHttp.send(str); } Help me! Link to comment Share on other sites More sharing options...
Recommended Posts