Page 5 of 506 FirstFirst ... 345671555105505 ... LastLast
Results 41 to 50 of 5054
  1. #41
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Simple SEO URL [support thread]

    I think you are in the wrong support thread, this thread is not for ultimate seo url.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  2. #42
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Simple SEO URL [support thread]

    I want to know if we are all okie with the current link structure, it will be hard to change things later:

    http://demo.rubikintegration.com/zencart/

    Otherwise we will stick with it.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  3. #43
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Re: Simple SEO URL [support thread]

    Quote Originally Posted by yellow1912 View Post
    I want to know if we are all okie with the current link structure, it will be hard to change things later:

    http://demo.rubikintegration.com/zencart/

    Otherwise we will stick with it.
    I like yourr suggestion in post #37. The link above does not seem to be using the shorter version at this point.

  4. #44
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Simple SEO URL [support thread]

    Check again, see if you like something like this:

    Code:
    http://demo.rubikintegration.com/zencart/product_info/c-big-linked-22/p-a-bug-s-life-multi-pak-special-2003-collectors-edition-34
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  5. #45
    Join Date
    Dec 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Simple SEO URL [support thread]

    Great work yellow1912!

    I am posting three changes in case they could be of any help:

    1. I changed .htaccess to avoid passing the variable MR which is failing on some servers:

    Code:
    #### BOF SSU
    RewriteEngine On
    RewriteBase /site/
    
    # Deny access from .htaccess
    RewriteRule ^\.htaccess$ - [F]
    
    # Existing files shouldn't get rewritten
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    
    # The rest can go to ZC
    RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L]
    #### EOF SSU
    2. I changed the URL parsing function so it can handle whatever file extension that the user sets. In init_ssu.php:

    PHP Code:
    function parse_url($debug=false){
        
    $link $_SERVER['REQUEST_URI'];

        
    // taking care of the shop catalog
        
    $catalog_dir = (isset($_SERVER['HTTPS']) || $_SERVER['SERVER_PORT']==443) ? DIR_WS_HTTPS_CATALOG DIR_WS_CATALOG;
        
    $link str_replace($catalog_dir'' $link);

        
    // taking care of file extension
        
    $link str_replace('.'.SSU_FILE_EXTENSION'' $link);

        
    // taking care of parameters
        
    $mr_parts explode('/'current(explode('?'$link)));
        
    $mr_parts_count count($mr_parts);
                
        
    // first element is always main_page
        // even if this is a "static" page, assigning first element to 
        
    $_GET['main_page'] = $mr_parts[0];
        for(
    $i1$i $mr_parts_count$i $i 2){
            if(isset(
    $mr_parts[($i 1)])){
                
    $_GET[$mr_parts[$i]] = $mr_parts[($i 1)];
            }
            else{
            
    $_GET[$mr_parts[$i]] = '';
            }
        }
        unset(
    $mr_parts$mr_parts_count);
            
        
    // taking care of product and category name
        
    if(isset($_GET['products_id'])){
            
    $products_id explode(SSU_ID_DELIMITER,$_GET['products_id']);
            
    $_GET['products_id'] = $products_id[count($products_id)-1];
        }
        if(isset(
    $_GET['cPath'])){
            
    $cPath explode('-',$_GET['cPath']);
            
    $_GET['cPath'] = $cPath[count($cPath)-1];
        }

        if(
    $debug)
            
    print_r($_GET);

    3. Finally, the category three was not preserved (for example, clicking a top category would open its sub-category tree, but clicking on a sub-category would close the whole tree). In init_ssu.php:

    PHP Code:
        function get_category_name($cPath){
            global 
    $db;
            if(empty(
    $cPath)) return '';
            
    $category_id explode('_',$cPath);
            
    $category_id $category_id[count($category_id)-1];
            
            
    $file_name $this->build_category_filename($category_id);
            if((
    $content file_get_contents($this->cache_folder.$file_name)) !== false)
                return 
    $content;    

            return 
    $this->set_category_name($cPath$category_id);
        }
        
        function 
    set_category_name($cPath$category_id){
            
    $file_name $this->build_category_filename($cPath);
            
    $sql_query 'SELECT categories_name FROM '.TABLE_CATEGORIES_DESCRIPTION.' WHERE categories_id ='.$category_id.' LIMIT 1';
            return 
    $this->_get_name($file_name,$sql_query,'categories_name',$cPath);
        }
        
        function 
    build_category_filename($category_id){
             return 
    "c$category_id";
        } 

  6. #46
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Simple SEO URL [support thread]

    You are right, I made some stupid changes and didnt keep the category tree, will fix that.

    As for part 2, that's better than having to change the htaccess file, good job
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  7. #47
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Simple SEO URL [support thread]

    New version updated to make changes suggested by skaimauve.

    @skaimauve: we cant use str_replace to replace the catalog_dir because is is possible that somewhere in the url contains a string that is exactly the same with catalog_dir and will be replaced as well.

    I used preg_replace to limit the replacement to 1 only.


    Next update will cover:
    1. ezpage link is not created the way it should be, will fix that
    2. Allow store owner to stack more than 1 category names into the links, and allow store owner to limit the number of category names on the links as well.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  8. #48
    Join Date
    Dec 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Simple SEO URL [support thread]

    Oups...

    Code:
    D    Simple_SEO_URL/admin/includes/module_installation/install.sql

  9. #49
    Join Date
    Dec 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Simple SEO URL [support thread]

    Good work on the update code yellow1912!

    Wow , we have a winner. This feature is nicely implemeted!

  10. #50
    Join Date
    Dec 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Simple SEO URL [support thread]

    How about creating links on this format?

    http://host/store/product_info/c2-vinyl/p4-led-zep

    Again, if this is of any help. In init_ssu.php:

    1. Change what is inside the loop:

    PHP Code:
        function parse_url($debug=false){
            global 
    $request_type;
            
    // attempt to check current protocol being used
            // This check is not perfect, but should work most of the time
            
    if ($request_type == 'SSL'
                
    $catalog_dir DIR_WS_CATALOG;
            else
                
    $catalog_dir DIR_WS_HTTPS_CATALOG;
            
    $extension trim(SSU_FILE_EXTENSION);
            
    // we want to remove $catalog_dir and 
            
    $mr_parts explode('/'trim(current(explode('?', ($catalog_dir=='/' && empty($extension)) ? getenv('REQUEST_URI') : preg_replace(array($catalog_dir,'/\.'.$extension.'/'),'',getenv('REQUEST_URI'), 1))), '/'));
            
    $mr_parts_count count($mr_parts);
            
    // first element is always main_page
            // even if this is a "static" page, assigning first element to 
            
    $_GET['main_page'] = $mr_parts[0];
            for(
    $i1$i $mr_parts_count$i++){
    >            
    $file_name current(explode(SSU_ID_DELIMITER$mr_parts[$i],2));
                
    // TODO: an more efficient way to do this?
    >            if($file_name[0] == 'c') {
    >              if(
    file_get_contents($this->cache_folder.$file_name) !== false)
    >                    
    $_GET['cPath'] = substr($file_name,1);                     
                }
    >            elseif(
    $file_name[0] == 'p') {
    >              if(
    file_get_contents($this->cache_folder.$file_name) !== false)
    >                    
    $_GET['products_id'] = substr($file_name,1);                     
                }
                elseif(isset(
    $mr_parts[($i 1)])){
                    
    $_GET[$mr_parts[$i]] = $mr_parts[($i 1)];
                    
    $i++;
                }
                else{
                    
    $_GET[$mr_parts[$i]] = '';
                    
    $i++;
                }
            }
            unset(
    $mr_parts$mr_parts_count);
            if(
    $debug)
                
    print_r($_GET);
        } 
    And two lines here

    PHP Code:
            // Appending category name and product name into the link
            
    if(strstr($parameters,'cPath')!==false || strstr($parameters,'products_id')!==false || $page ==''){
                
    $parameters explode('/',$parameters);
                
                for(
    $i=0$i count($parameters); $i++){
                    if(
    $parameters[$i]=='cPath'){
    >                    
    $parameters[$i] = 'c'.$this->get_category_name($parameters[$i+1]);
                        unset(
    $parameters[$i+1]);
                    }
                    elseif(
    $parameters[$i]=='products_id'){
    >                    
    $parameters[$i] = 'p'.$this->get_product_name($parameters[$i+1]);
                        unset(
    $parameters[$i+1]);
                    }
                    elseif(
    $parameters[$i]=='main_page'){
                        
    $page $parameters[$i+1];
                        unset(
    $parameters[$i]);
                        unset(
    $parameters[$i+1]);
                    }
                }
                
    //print_r($parameters);
                
    $this->array_clean_up($parameters);
                
    $parameters implode('/',$parameters);
            } 
    And one line here:

    PHP Code:
        function _get_name($file_name$sql_query$field_name$original_value){
            global 
    $db;
            
    $result $original_value;
            
    $sql_result $db->Execute($sql_query);
            if(
    $sql_result->RecordCount() > 0){
                
    // remove non alphanumeric
                
    $result preg_replace("/[^a-zA-Z0-9s]/"SSU_NAME_DELIMITER$sql_result->fields[$field_name]);
                
    // remove excess underscore
                
    $result preg_replace('/'.SSU_NAME_DELIMITER.SSU_NAME_DELIMITER.'+/'SSU_NAME_DELIMITER$result);
                
    // remove trailing _
                
    $result strtolower(trim($resultSSU_NAME_DELIMITER));
                
    // now prepend the id
    >            $result $original_value.SSU_ID_DELIMITER.$result;
                 
    // write into file. Cant use file_put_contents since it's not in php4
                
    if($handle = @fopen($this->cache_folder.$file_name"w")){
                    if (
    fwrite($handle$result) === FALSE) {
                        
    // TODO: sound the alarm
                    
    }
                    
    fclose($handle);
                }
                else{
                    
    // TODO: sound the alarm here
                
    }
            }
            return 
    $result;
        } 

 

 
Page 5 of 506 FirstFirst ... 345671555105505 ... LastLast

Similar Threads

  1. v151 Simple SEO URLs for ZC 1.5.x [Support Thread]
    By cvhainb in forum All Other Contributions/Addons
    Replies: 46
    Last Post: 8 Jun 2022, 09:42 AM
  2. Simple SEO URL, Ultimate SEO URLs, Ceon URI Mapping SEO
    By pizza392 in forum All Other Contributions/Addons
    Replies: 13
    Last Post: 21 Jan 2015, 10:49 AM
  3. How do I tell what version my Simple SEO URL addon mod, and others, are?
    By kevinmc3 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 6 May 2010, 01:32 AM
  4. Can't create new thread in Simple SEO URL forum
    By gseiber in forum General Questions
    Replies: 1
    Last Post: 3 Apr 2010, 01:56 PM
  5. Re: Simple SEO URL [support thread]
    By creamcrackers in forum General Questions
    Replies: 2
    Last Post: 16 Aug 2009, 03:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR