web design, England, Britain, UK, belgium
 
Ulti Clocks content

VirtueMart 1.1 Alpha Numeric search module

sand An A to Z, 0 to 9 (Alpha-numeric) search/listing module for VirtueMart. Search for VirtueMart products by first letter or number and display the results in the standard VirtueMart search results page.
search, product, php, virtuemart, module, letter, classes, like, case, main, limiter, urls, change, parameter, break, searchstring, work, needed, queries, use, leave, version, file, class, strlen, style, browse, keyword, text, number, shop, switch, commercial, download, small, line, page, results, standard, html

Home Joomla - VirtueMart VirtueMart A-Z search

Sam

28.


An A to Z, 0 to 9 (Alpha-numeric) search/listing module for VirtueMart.


Search for VirtueMart products by first letter or number and display the results in the standard VirtueMart search results page.
If only one result is found it redirects to the product page.
You can try it here - Demo ... and download it here - Download

How it works -

It just utilises the standard Virtuemart search but filters it by product name and 1st letter or number.
It needs the installation of this module and two very small hacks in classes/ps_main.php and html/shop_browse_queries.php

The module installs as normal and publish it somewhere.
The only only parameters are pre and post text and module classes.
It's simply a list of search urls and is very simple to style differently directly in the mod_az_virtuemart.php file or with css.

VirtueMart 1.1 Alpha Numeric search module parameters

Styling

Give the module a class then style the resulting menu class
a.mainlevel-az {
padding-left:5px;
text-decoration:none;
}
... An image for each letter would be even better.

Source Changes Needed

The change needed to html/shop_browse_queries.php is to make a new $search_limiter parameter so it only searches for the 1st letter.
around line 110 insert after switch($search_limiter) {
case "az":
$sq .= "\n `#__{vm}_product`.`product_name` LIKE '$searchstring%' ";
break;
so it looks like
switch($search_limiter) {
case "az":
$sq .= "\n `#__{vm}_product`.`product_name` LIKE '$searchstring%' ";
break;
case "name":
$sq .= "\n `#__{vm}_product`.`product_name` LIKE '%$searchstring%' ";
break;
In the file classes/ps_main.php the function "vmGetCleanArrayFromKeyword" ignores the search unless there's more than 2 letters.
I change this to 1 letter to get it to work.
I tried to use a different keyword parameter e.g. keyword3 but I couldn't get it to work but this would be a "nicer" way to do it rather than hook in to the already used parameter.
Perhaps someone can achieve this?

So in classes/ps_main.php around the line 1260 change the
if( $strlen > 2 ) {
to
if( $strlen > 0 ) {

Paypal Donation

If you use this module on your site please donate a small amount.
Any donation amount appreciated.

Updates!


Version 0.2
Code re-written so that the urls are formed by php, a smaller package now (ver0.2)

Version 0.3
Fixed problem with search urls and SEF components

If you have any comments, suggestions or need any help please leave a comment below.

If you use it on a commercial site (if it's Virtuemart I guess it's got to be commercial Wink ) please leave a small donation.
Thanks.


Add this page to your favorite Social Bookmarking websites
Digg! Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! Slashdot! Technorati! StumbleUpon! Spurl! Newsvine! Furl! Fark! Yahoo! Netvouz! Mister-Wong! RawSugar! Ma.gnolia! Squidoo! DZone! Swik!
Zuletzt aktualisiert am Samstag, 12. Dezember 2009 um 12:20 Uhr Read : 8989 times
 
Comments (5)
@Rodolfo Murrieta
5 Donnerstag, 06. Mai 2010 um 07:51 Uhr
GJC (admin)
Thanks Rodolfo, works perfectly! Mr. Green
Added to the download as mod_az_virtuemart_1.1.2.j15.ver0.4

Regards and thanks for the donation!
Almost perfect,
4 Donnerstag, 06. Mai 2010 um 00:58 Uhr
Rodolfo Murrieta
A very valuable piece of code!
HOwever, it lacks the generation of the proper ItemId for Joomla.
Inserting
$parentmenu = JSite::getMenu()->getActive()->tree[0];
and changing URLS to
...."&option=com_virtuemart&Itemid=".$parentmenu."'>"....
Do the trick
Thank!


// changed while running a function
$cart = $_SESSION["cart"];
$auth = $_SESSION["auth"];
$parentmenu = JSite::getMenu()->getActive()->tree[0];
?>






for($i="A";$i.$i." \n";
}
@MIchael
3 Donnerstag, 01. April 2010 um 18:55 Uhr
GJC
This requires one off coding to achieve.
If your interested drop me a mail from the contact page..
apha search within a category
2 Donnerstag, 01. April 2010 um 17:11 Uhr
MIchael
I need to have alpha search within each category, i saw your category demo, how do i set that up
THANKS!
1 Sonntag, 14. März 2010 um 14:34 Uhr
SKY
THANKS! Smile

Add your comment

BoldItalicUnderlineStrikethroughSubscriptSuperscriptEmailImageHyperlinkOrdered listUnordered listQuoteCodeHyperlink to the Article by its id
Very HappySmileWinkSadSurprisedShockedConfusedCoolLaughingMadRazzEmbarrassedCrying or Very SadEvil or Very MadTwisted EvilRolling EyesExclamationQuestionIdeaArrowNeutralMr. GreenGeekUber Geek
Your name:
Titel:
Comment:

Our Recommended Reading

For those interested in extending their knowledge of Joomla! & VirtueMart, Packt Publishing has an excellent range of help & how to books.
Listed below are some I can recommend.
Simply click on the images to be taken directly to their web shop.

Joomla! Web Security
Joomla! Web Security
by Tom Canavan.
Joomla! Template Design: Create your own professional-quality templates with this fast, friendly guide
Joomla! Template Design:
Create your own professional-quality
templates with this fast, friendly guide
by Tessa Blakeley Silver.
Magento: Beginner's Guide
Magento: Beginner's Guide by William Rice
is a must for anyone trying the
open-source e-Commerce solution.

Read the review
object-oriented-javascript-applications-libraries
Object-Oriented JavaScript by Stoyan Stefanov
gives you a very comprehensive
grounding in the latest Javascript techniques.

Read the review

Showcase

  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow
  • An Image Slideshow

Paypal Donation

If you use this module on your site please donate a small amount.
Any donation amount appreciated.

VM Live Product Search

Latest Joomla & VirtueMart Tips

See all tips & examples

VirtueMart A-Z Module

Use the letters C or S as there's not many products in the test shop!
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9

Letter D will return one result i.e. the product page.



VirtueMart 1.1 Alpha Numeric search module



An A to Z, 0 to 9 (Alpha-numeric) search/listing module for VirtueMart. Search for VirtueMart products by first letter or number and display the results in the standard VirtueMart search results page.


search, product, php, virtuemart, module, letter, classes, like, case, main, limiter, urls, change, parameter, break, searchstring, work, needed, queries, use, leave, version, file, class, strlen, style, browse, keyword, text, number, shop, switch, commercial, download, small, line, page, results, standard, html