Jump to content

pchelpwebshop

Members
  • Content count

    8
  • Joined

  • Last visited

Posts posted by pchelpwebshop


  1. @@Jack

    Sloppy on my part. Yes I was talking about duplicate title tags and duplicate meta descriptions.for the categories.

    Whilst I was correcting the code I tweeked it so that it redirects all incorrect category urls which I hope some may find useful.

    Thank you for pointing out the Header Tags SEO.

     

    The code in question dates back to 2010, but has been in every subsequent release. I agree that code should not be altered needlessly, and changes kept to a minimum. I feel discouraged from making any more posts.

     

    I am about to start restructing some of my categories, which i can now do with the knowledge that the category redirects are comprehensive.

     

    Many Thanks


  2. I`ve been looking at some duplicate content on google that should have been redirected. I was also curious about why sub-categories always send a redirect for the parent before the correct one.
     
    This lead me to the check_direct function in seo_class.php and I'm amazed that it works at all.There are simple mistakes like:
    $path = substr(string, start, end)   instead of   $path = substr(string, start, length);
    and
    substr_replace(string,newstring, start, strlen(start))   instead of   substr_replace(string,newstring, start, strlen(oldstring))
     
    This is what I ended up with, but it needs tidying up and more thorough testing. I havent tried the category_id=0 section.

     

            function check_redirect(){
                    $this->need_redirect = false;
                    $this->path_info = is_numeric(strpos(ltrim(getenv('PATH_INFO'), '/') , '/')) ? ltrim(getenv('PATH_INFO'), '/') : NULL;
                    $this->uri = ltrim( basename($_SERVER['REQUEST_URI']), '/' );
                    $this->real_uri = ltrim( basename($_SERVER['SCRIPT_NAME']) . '?' . $_SERVER['QUERY_STRING'], '/' );
                    $this->uri_parsed = $this->not_null( $this->path_info )
                                                                    ?        parse_url(basename($_SERVER['SCRIPT_NAME']) . '?' . $this->parse_path($this->path_info) )
                                                                    :        parse_url(basename($_SERVER['REQUEST_URI']));                        
                    $this->attributes['SEO_REDIRECT']['PATH_INFO'] = $this->path_info;                        
                    $this->attributes['SEO_REDIRECT']['URI'] = $this->uri;
                    $this->attributes['SEO_REDIRECT']['REAL_URI'] = $this->real_uri;                        
                    $this->attributes['SEO_REDIRECT']['URI_PARSED'] = $this->uri_parsed;    

     
                    /**** redirect child path to full path - i.e., -c-3782.html to -c-28_3782.html, when applicable ****/
                    if (strpos($this->attributes['SEO_REDIRECT']['URI_PARSED']['path'], '.html') !== FALSE) {
                        $u1 = $this->attributes['SEO_REDIRECT']['URI_PARSED']['path'];
                   
                        if (($pStart = strrpos($u1, "-c-")) !== FALSE) {  //using strrpos - might help when -c- is used in the name by mistake
                           if (($pStop = strpos($u1, ".html")) !== FALSE) {
                              //$path = substr($u1, $pStart, $pStop); // wrong syntax         
                                $actualID = substr($u1, $pStart + 3, $pStop - $pStart - 3);
                              //if (($pStart = strpos($path, "-")) !== FALSE) {
                                  //if (($pStop = strpos($path, ".html")) !== FALSE) {
                                      /**** GET THE ID's AND PATH's ****/
                                      //$actualID = substr($path, $pStart + 3, $pStop - 3); // wrong syntax
                                      //$fullID = $this->get_full_cPath($actualID, $actualID);  
                                      
                                      // get_full_cPath only returns the correct fullID if given the child on its own
                                      // but it always returns the child (by reference), so we can run it twice
                                      $fullID = $this->get_full_cPath($actualID, $childID);
                                      $fullID = $this->get_full_cPath($childID, $childID);
                                      $actualPath = $actualID . '.html';        //save a few instructions
                                      
                                      /**** REPLACE THE PARTIAL ID IN THE URL's WITH THE FULL ONE ****/
                                      $idPos = strpos($this->attributes['SEO_REDIRECT']['REAL_URI'], $actualID);            
                                    //$this->attributes['SEO_REDIRECT']['REAL_URI'] = substr_replace($this->attributes['SEO_REDIRECT']['REAL_URI'], $fullID, $idPos, strlen($idPos));
                                      $this->attributes['SEO_REDIRECT']['REAL_URI'] = substr_replace($this->attributes['SEO_REDIRECT']['REAL_URI'], $fullID, $idPos, strlen($actualID));
                                      $idPos = strpos($this->attributes['SEO_REDIRECT']['URI'], $actualID);  
                                    //$this->attributes['SEO_REDIRECT']['URI'] = substr_replace($this->attributes['SEO_REDIRECT']['URI'], $fullID, $idPos, strlen($idPos));
                                      $this->attributes['SEO_REDIRECT']['URI'] = substr_replace($this->attributes['SEO_REDIRECT']['URI'], $fullID, $idPos, strlen($actualID));
                                      if (strpos($this->attributes['SEO_REDIRECT']['URI_PARSED']['path'], '-c-'.$actualPath) !== FALSE) { //this is the actual url
                                        //if ($fullID != $actualID && strpos($fullID.'.html', $actualPath) !== FALSE) { //enteed url is child of full path
                                          if ($fullID != $actualID) { //enteed url is child of full path
                                              $url = $this->make_url($page, $this->get_category_name($actualID), 'cPath', $fullID, '.html');
                                              $this->uri_parsed['path'] = $url; //reset the url
                                              $this->need_redirect = true;
                                              $this->is_seopage = true;  
                                              if ( $this->need_redirect && $this->is_seopage && $this->attributes['USE_SEO_REDIRECT'] == 'true') $this->do_redirect();
                                          }
                                      }  
                                  //}  
                              //}
                           }
                        }
                    }
            
            
                    /**** redirect for special case of cat ID = 0 ****/
                    if (strpos($this->attributes['SEO_REDIRECT']['URI_PARSED']['path'], '.html') !== FALSE) {
                        $u1 = $this->attributes['SEO_REDIRECT']['URI_PARSED']['path'];
                   
                        if (($pStart = strpos($u1, "-c-")) !== FALSE) {         //start isolating the ID - only for categories
                           if (($pStop = strpos($u1, ".html")) !== FALSE) {
                              //$path = substr($u1, $pStart, $pStop + 5);             //will be something like -c-34.html

                              //if (($pStart = strpos($path, "-")) !== FALSE) {   //isolate to the number
                                  //if (($pStop = strpos($path, ".html")) !== FALSE) {
                                  
                                      /**** GET THE ID's AND PATH's ****/
                                      //$actualID = substr($path, $pStart + 3, $pStop - 3); //will be something like 34
                                        $actualID = substr($u1, $pStart + 3, $pStop - $pStart - 3);
                                      if ($actualID == 0) {
                                          $actualPath = $actualID . '.html';        //save a few instructions
                                          
                                          /**** REPLACE THE PARTIAL ID IN THE URL's WITH THE FULL ONE ****/
                                          $this->attributes['SEO_REDIRECT']['REAL_URI'] = 'index.php';
                                          $this->attributes['SEO_REDIRECT']['URI'] = '';
                                          
                                          if (strpos($this->attributes['SEO_REDIRECT']['URI_PARSED']['path'], '-c-'.$actualPath) !== FALSE) { //this is the actual url
                                              if (0 == $actualID && strpos($actualID.'.html', $actualPath) !== FALSE) { //enteed url is child of full path
                                                  $url = 'index.php';
                                                  $this->uri_parsed['path'] = $url; //reset the url
                                                  $this->need_redirect = true;
                                                  $this->is_seopage = true;  
                                                  if ( $this->need_redirect && $this->is_seopage && $this->attributes['USE_SEO_REDIRECT'] == 'true') {
                                                      header("HTTP/1.0 404 not found");
                                                      header("Location: $url"); // redirect...bye bye  
                                                  }
                                              }
                                          }  
                                      }
                                  //}  
                              //}
                           }
                        }
                    }           

                          
                    $this->need_redirect();
                    $this->check_seo_page();  
                    if ( $this->need_redirect && $this->is_seopage && $this->attributes['USE_SEO_REDIRECT'] == 'true') $this->do_redirect();                        
            } # end function
     

     


  3.  

    If you are using one of my versions, you need to update your installation since that code was changed years ago.

    Hi Jack

    I'm installing the latest 2-2-2d-14a, released by roaddoctor in January.

    I had a browse through the history and it first occured in your release 2-2-2d-6 back in 2010.

    Most of them are fine, just those odd 5.

     

    Its obviously not causing to many problems, but worth changing on the next release.

     

    Many thanks


  4. In the SEO_URL_INSTALLER function (line 257) in seo.class.php there are five instances where the configuration_id is set to '' instead of NULL.

     

    Not a problem for everyone but in some mysql configurations this causes a reinstall on every single page.

    It keeps trying to load the missing configurations!

     

    'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('',   .......
     

    should be (5 places)

     

    'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES (NULL,  .......

     

    Many thanks for the great support.


  5. I have recently tried to upgrade from paypal standard contribution to the paypal_ipn. (2.3.4.7).

    The standard module is working fine but I wanted to deal with the issues of customers not returning.

     

    Everything is working fine except for:

    "Please provide an amount and click update totals" on paypal.

    Everything else, including the carriage and the returns are fine.

     

    Reading the forum it appears to be a recurring theme, but I cant find a solution.

    I've double checked my currency settings.

     

    At present I'm studying the two contributions side by side, but I freely admit to being out of my depth.

     

    Could somebody point me in the right direction.

     

    many thanks

     

     

    Hi I think I just solved my problem

    I was using the agregate setting with tax rolled up.

    The Itemised setting works.

     

    WARNING - TREAT THE AGREGATE SETTING WITH CAUTION, IT MAY BE BROKEN

    or it could be an quirk in my setup?


  6. I have recently tried to upgrade from paypal standard contribution to the paypal_ipn. (2.3.4.7).

    The standard module is working fine but I wanted to deal with the issues of customers not returning.

     

    Everything is working fine except for:

    "Please provide an amount and click update totals" on paypal.

    Everything else, including the carriage and the returns are fine.

     

    Reading the forum it appears to be a recurring theme, but I cant find a solution.

    I've double checked my currency settings.

     

    At present I'm studying the two contributions side by side, but I freely admit to being out of my depth.

     

    Could somebody point me in the right direction.

     

    many thanks


  7. I have recently tried to upgrade from paypal standard contribution to the paypal_ipn. (2.3.4.7).

    The standard module is working fine but I wanted to deal with the issues of customers not returning.

     

    Everything is working fine except for:

    "Please provide an amount and click update totals" on paypal.

    Everything else, including the carriage and the returns are fine.

     

    Reading the forum it appears to be a recurring theme, but I cant find a solution.

    I've double checked my currency settings.

     

    At present I'm studying the two contributions side by side, but I freely admit to being out of my depth.

     

    Could somebody point me in the right direction.

     

    many thanks

×