skip to Main Content

Im using an ajax (live-search) by vqmod.
I have enabled my SEO and product links works well. But when i click on a product via the search function its taking me to the old link which is:

index.php?route=product/product/&product_id=123

My current SEO links looks like this

shop/Datorkomponenter/Chassi/Aerocool-DS-Cube-Devil-Red

I’ve searched in the .XML file for the Vqmod and I found this code and maybe its connecting to the old link.

select: function(event, ui) {
   if(ui.item.value){
   location = 'index.php?route=product/product/&product_id='+ui.item.value;
     }else{
   $('.button-search').trigger('click');
     }
   return false;
}

Is there anyway to change it or modify it? Maybe redirect from .htaccess?

2

Answers


  1. You can check with following .htaccess code.

    Options +FollowSymlinks
    
    # Prevent Directoy listing 
    Options -Indexes
    
    # Prevent Direct Access to files
    <FilesMatch "(?i)((.tpl|.ini|.log|(?<!robots).txt))">
     Order deny,allow
     Deny from all
    </FilesMatch>
    
    # SEO URL Settings
    RewriteEngine On
    # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/  
    
    RewriteBase /yourshopfolder/
    RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
    RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
    RewriteRule ^system/download/(.*) /index.php?route=error/not_found [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*.(ico|gif|jpg|jpeg|png|js|css)
    RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
    

    Create you own htaccess file on root folder and put above code on that. It will work.

    I have checked it in open-cart version 2.0.2.0 +

    Login or Signup to reply.
  2. The possible ways to handle this would be (in order of decreasing desirableness):

    1. return the seo url with the ajax results
    2. do a second ajax request to get the seo url
    3. redirect once the product page is loaded

    In all those scenarios you’ll want to use the core Opencart url class like this:

    $url = $this->url->link('product/product', 'product_id=' . $product_id);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search