Search code examples
joomlajoomla2.5virtuemart

joomla virtuemart search slash error


i am currently developing one joomla site which contains virtuemart and my written component which is working quite well, but the problem shows up when i try to search for products using virtuemart search in example when i search for 12/4 name it replaces 12/4 name with 124 name and displays no results.

So the question is where is that sql-query that loads those items so i can modify it? or is there another plug-in or something that works with / or is there somekind of fix to this problem?


Solution

  • So after a while i finnaly fixed this issue. My fix is not weary good beacose i didn't find where exactly virtuemart component removes slash from search query so i just did like this......

    As frontend uses modules who are located at admin/components/com_virtuemart/modules i had to edit module named product. And in the function named sortSearchListQuery2 i added some code

     if ($useCore) {
    //      if ( $this->keyword !== "0" and $group ===false) {
                if (!empty($this->keyword) and $this->keyword !== '' and $group === FALSE) {
                    $this->setKeyWord($_GET['keyword']);//Added this line!
                            //$keyword = trim(preg_replace('/\s+/', '%', $keyword), '%');
                    $keyword = '"%' . $this->_db->getEscaped ($this->keyword, TRUE) . '%"';
                    //var_dump($keyword,$this->keyword,$_GET['keyword']); debug_zval_dump($keyword); debug_print_backtrace(); die();
    

    And on frontend view named Category in view.html.php i replaced $keyword=vmRequest::uword('keyword', '', ' ') with $keyword = $_GET['keyword']

    And that is my approach to fix this problem!