Jump to content
FWR Media

ULTIMATE Seo Urls 5 - by FWR Media

Recommended Posts

On 9/18/2020 at 10:31 AM, ecartz said:

If it's that there is code that you used to add immediately after the language code, then you can just move it into the i() function.  Change


     if ( !self::$_singleton instanceof Usu_Main ) {
       self::$_singleton = new self;
     }

 

Hi @ecartz,

I finally got a free day to check this contribution. I found your solution will not work because Usu_main has to be initialized after set_session_language and before ensure_navigation_history to work. If not, links are correctly generated but $_GET variable is not updated and Phoenix redirects to index in all pages that expects parameters, like product_info.

I found its code could be placed in application.php inside the set_session_language function, or it could be loaded by creating an entry inside hooks table between those two functions (an startApplication method). But as far as I see it implies giving a non-consecutive numerical sort order to the table entry (something like _16B_start_SEO ) and it seems a bit dirty to me.

Is there a cleaner way to do it?

Another thing: I've seen fix_numeric_locale is being called twice (from a hook and inside set_session_language function. Is this needed or has the function call just been forgotten?

Files outside ROOT seems to work now; I'm into fixing the ENABLE_SSL stuff. Is there any post where the changes introduced has been explained?

 

Share this post


Link to post
Share on other sites

I think that a "non-consecutive numerical sort order" is probably the best solution.  Note that it doesn't need to be a database entry.  A hook file in includes/hooks/system would work as well. 

The closest thing to documentation is the commit notes (and the commit itself):  https://github.com/gburton/CE-Phoenix/commit/ae01e0d4d91b2e4a561735168ef4fbe6ba8e6899

Related commit:  https://github.com/gburton/CE-Phoenix/commit/d2adabebe2efbdcd28513c6057758cd25ed48fc4

I don't think that it is very complicated.  HTTP_SERVER . DIR_WS_CATALOG should always be used now, where previously it was only sometimes used (in the ENABLE_SSL false case).  For the most part, this is just simpler.  Because instead of having to check various things to determine the correct link, the code can just consistently use one thing.  The old system was complicated, as it had to try to mix SSL and non-SSL pages.  But this always uses whatever the HTTP_SERVER is configured to provide. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
11 hours ago, piernas said:

That's correct for other SEO contribution. This is Ultimate SEO 5 and it's different, it needs a lot more tweaks.

I wonder if the contribution name should be changed to avoid this kind of confusions.

So is it being developed for 1.0.7.9? That will be so cool dear.. 🤩

Share this post


Link to post
Share on other sites

Hi @ecartz,

I've found an issue with a core module (nb_shopping_cart.php).

For constructing the URI the module uses this code:

// nb_shopping_cart.php (line 19):

  echo sprintf(MODULE_NAVBAR_SHOPPING_CART_PRODUCT, $p['id'], $p['quantity'], $p['name']);

// languages/english/modules/navbar/nb_shopping_cart.php:

  define('MODULE_NAVBAR_SHOPPING_CART_PRODUCT', '<a class="dropdown-item" href="' . tep_href_link('product_info.php', 'products_id=%s') . '">%s x %s</a>');

This means tep_href_link is called by the define before executing the sprintf command, so the llink is created literally as product_info.php?products_id=%s, avoiding the URL rewriter to be able to parse it correctly.

To make it work code should at least generate the real link in the module itself instead of the language file:

// language file:
  define('MODULE_NAVBAR_SHOPPING_CART_PRODUCT', '<a class="dropdown-item" href="%s">%s x %s</a>');


// module:
        echo sprintf(MODULE_NAVBAR_SHOPPING_CART_PRODUCT, tep_href_link('product_info.php', 'products_id=' .$p['id'] ), $p['quantity'], $p['name']);

or even more logical and simpler:

// Module:

  echo '<a class="dropdown-item" href="' . tep_href_link("product_info.php", 'products_id=' .$p['id']) .  ' ">' . sprintf (MODULE_NAVBAR_SHOPPING_CART_PRODUCT, $p['quantity'], $p['name']) . "</a>'";

// Language file:
  define('MODULE_NAVBAR_SHOPPING_CART_PRODUCT', '%s x %s');

I'll still have to figure out how to modify this app to parse links with {X}Y after the product id.

 

Edited by piernas

Share this post


Link to post
Share on other sites

I've almost finished this app. Still want to make a couple of tweaks and add proper instructions but all seems to work well. I've attached it in case someone wants to test it.

No core changes, tested with Phoenix 1.0.7.10. Just upload the files and go to admin->configuration->Ultimate Seo Urls and enable the app. Feedback will be appreciated.

USU3_beta.zip

Share this post


Link to post
Share on other sites
9 minutes ago, piernas said:

I've almost finished this app. Still want to make a couple of tweaks and add proper instructions but all seems to work well. I've attached it in case someone wants to test it.

No core changes, tested with Phoenix 1.0.7.10. Just upload the files and go to admin->configuration->Ultimate Seo Urls and enable the app. Feedback will be appreciated.

USU3_beta.zip

Notice: Undefined index: languages_id in C:\xampp\htdocs\test1711\includes\classes\usu_init.php on line 21
Notice: Undefined index: language in C:\xampp\htdocs\test1711\includes\classes\usu_init.php on line 22
Notice: Undefined variable: current_code in C:\xampp\htdocs\test1711\includes\apps\ultimate_seo_urls\main\bootstrap.php on line 376

the errors will disappear after refreshing the site ...
there is core file will overwrite  ht_canonical.php , I think it was forgotten there as there is no changes in it (same as core file)

well done 


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites
2 minutes ago, Omar_one said:

Notice: Undefined index: languages_id in C:\xampp\htdocs\test1711\includes\classes\usu_init.php on line 21
Notice: Undefined index: language in C:\xampp\htdocs\test1711\includes\classes\usu_init.php on line 22
Notice: Undefined variable: current_code in C:\xampp\htdocs\test1711\includes\apps\ultimate_seo_urls\main\bootstrap.php on line 376

the errors will disappear after refreshing the site ...
there is core file will overwrite  ht_canonical.php , I think it was forgotten there as there is no changes in it (same as core file)

well done 

Thank you, I'll take a look at those errors. Does the app work?

Share this post


Link to post
Share on other sites

@omar the new ht_canonical should be slightly different. It adds canonical tags to write review (review.php) that is currently rewritten to review.html. It's not important as this page should not be indexed by spiders but I think I should also add it to noindex pages.

I want to study the new pages system to see if it's good to add rewrite rules to it, too, so / info.php?pages_id=4 would become /slug.html

 

 

Share this post


Link to post
Share on other sites

@piernas I just compare the ht_canonical from your zip file with ht_canonical from Phoenix 1.0.7.11 they are same 

image.thumb.png.447f71f6678785354311a6fffe6e38c5.png
 

10 hours ago, piernas said:

I want to study the new pages system to see if it's good to add rewrite rules to it, too, so / info.php?pages_id=4 would become /slug.html

👍


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites
1 hour ago, Omar_one said:

@piernas I just compare the ht_canonical from your zip file with ht_canonical from Phoenix 1.0.7.11 they are same

Thank you, then I uploaded the stock one. It should contain these lines, I'll fix it on the final upload:

 

        case 'write.php':
          $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link($PHP_SELF, 'products_id=' . (int)$_GET['products_id'], 'SSL', false) . '" />' . PHP_EOL, $this->group);
        break;

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×