Jump to content



Photo
* * * * * 1 votes

Ultimate SEO URLS5


  • Please log in to reply
7 replies to this topic

#1   mcmannehan

mcmannehan
  • Members
  • 136 posts
  • Real Name:Manfred Wedel
  • Gender:Male
  • Location:Thailand

Posted 12 March 2017 - 06:54

I find out that Ultimate SEO URLS5 have an issue with product links.

 

If a product have Products Attributes than there create a link in the navbar modules shoping cart like this:

catalog/product_info.php?products_id=160{4}31

After you click on it, a 404 error appears.

 

We only need a product link like catalog/product_info.php?products_id=160

So i did the follow:

open

catalog/includes/modules/navbar_modules/templates/shopping_cart.php

Find:

foreach ($products as $k => $v) {
  echo '<li>' . sprintf(MODULE_NAVBAR_SHOPPING_CART_PRODUCT, $v['id'], $v['quantity'], $v['name']) . '</li>';
} 

and add the preg_replace

foreach ($products as $k => $v) {
  $v['id'] = preg_replace('~(.*){[^{]+$~', '\\1', $v['id']);
  echo '<li>' . sprintf(MODULE_NAVBAR_SHOPPING_CART_PRODUCT, $v['id'], $v['quantity'], $v['name']) . '</li>';
} 

The preg_replace will delete all characters after the { and the { itself.

May be this REGEX its a atomic bomb on a small bird and may be there is a more easy solution.

But this works. Tested in osC 2.3.x.

 

 

 

 

 


- The clever one learn from everything and from everybody.

- The normal one learn from his experience.

- The silly one knows everything better.

[Socrates, 412 before Christ]

 

Computers help us with the problems we wouldn't have without them!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0


#2   mcmannehan

mcmannehan
  • Members
  • 136 posts
  • Real Name:Manfred Wedel
  • Gender:Male
  • Location:Thailand

Posted 12 March 2017 - 08:30

error in my preg_replace

 

have to change to:

$v['id'] = preg_replace('~[{](.*)+$~', '', $v['id'], 1);

this works perfect, also if product have more products attributes


- The clever one learn from everything and from everybody.

- The normal one learn from his experience.

- The silly one knows everything better.

[Socrates, 412 before Christ]

 

Computers help us with the problems we wouldn't have without them!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0


#3   MrPhil

MrPhil
  • Members
  • 7,016 posts
  • Real Name:Phil
  • Gender:Male

Posted 15 March 2017 - 00:56

{ and } in a URL Query String are a known problem, and have been discussed quite a bit. Curly braces are banned by a number of hosts as some sort of security issue. I don't know what the official replacement will be for this syntax.



#4   mcmannehan

mcmannehan
  • Members
  • 136 posts
  • Real Name:Manfred Wedel
  • Gender:Male
  • Location:Thailand

Posted 15 March 2017 - 03:49

@ MrPhil

I don't know why the URL link is created with the curly braces. So i remove them.


- The clever one learn from everything and from everybody.

- The normal one learn from his experience.

- The silly one knows everything better.

[Socrates, 412 before Christ]

 

Computers help us with the problems we wouldn't have without them!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0


#5   activeebiz

activeebiz
  • Community Sponsor
  • 4 posts
  • Real Name:Nick
  • Gender:Male

Posted 15 March 2017 - 04:00

@ MrPhil

I don't know why the URL link is created with the curly braces. So i remove them.

 

its for options/attributes , when you use the link to return to the product the options choosen and shown in the cart product will be auto selected on the product info page.



#6   mcmannehan

mcmannehan
  • Members
  • 136 posts
  • Real Name:Manfred Wedel
  • Gender:Male
  • Location:Thailand

Posted 25 March 2017 - 11:50

@ activeebiz

 

its for options/attributes , when you use the link to return to the product the options choosen and shown in the cart product will be auto selected on the product info page.

 
I think this isn't necessary. Curly braces in the link are banned by a lot of hosters.


Edited by mcmannehan, 25 March 2017 - 11:51.

- The clever one learn from everything and from everybody.

- The normal one learn from his experience.

- The silly one knows everything better.

[Socrates, 412 before Christ]

 

Computers help us with the problems we wouldn't have without them!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0


#7   MrPhil

MrPhil
  • Members
  • 7,016 posts
  • Real Name:Phil
  • Gender:Male

Posted 26 March 2017 - 13:56

Well, yeah. Some time ago, someone chose the syntax "{nn}" for options and attributes in osC. Later, hackers found they could abuse systems by using "{nn}" syntax, so many hosts banned (disabled) the use of braces in Query Strings. Unfortunately, this creates a problem for osC stores that use options and attributes, and the syntax will have to be changed to fix the problem.

 

If you are seeing "{nn}" in your Query Strings, it means you are using options and/or attributes. Simply filtering them out is going to break your system in some way, hopefully minor (such as not having options preselected when returning to the cart). It would be better to fix the underlying problem (change the syntax).



#8   mcmannehan

mcmannehan
  • Members
  • 136 posts
  • Real Name:Manfred Wedel
  • Gender:Male
  • Location:Thailand

Posted 12 April 2017 - 10:13

@MrPhil

 

Well, yeah. Some time ago, someone chose the syntax "{nn}" for options and attributes in osC. Later, hackers found they could abuse systems by using "{nn}" syntax, so many hosts banned (disabled) the use of braces in Query Strings. Unfortunately, this creates a problem for osC stores that use options and attributes, and the syntax will have to be changed to fix the problem.
 
If you are seeing "{nn}" in your Query Strings, it means you are using options and/or attributes. Simply filtering them out is going to break your system in some way, hopefully minor (such as not having options preselected when returning to the cart). It would be better to fix the underlying problem (change the syntax).

 
Since i filter them out, my system is still running very well, nothing breaks. I filter them out only in the product link of the cart modul in the header here: catalog/includes/modules/navbar_modules/templates/shopping_cart.php


Edited by mcmannehan, 12 April 2017 - 10:15.

- The clever one learn from everything and from everybody.

- The normal one learn from his experience.

- The silly one knows everything better.

[Socrates, 412 before Christ]

 

Computers help us with the problems we wouldn't have without them!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0