Jump to content

Selector IS Case Sensitive


Tom.
 Share

Recommended Posts

I'm having a strange issue here where my selector is case sensitive on a default install with no modification MySQL. 

The selector is as follows: 

$vars = explode("?", $_SERVER[REQUEST_URI])[1];
$selector = implode(", ", explode("&", $vars));
echo $selector;
$variation = $page->wc_variations->get("wc_variation_value='$selector'");

This doesn't work `$selector` outputs `size=14, colour=blue` 

If I was to change the value given to `Size=14, Colour=Blue` it then finds the repeater item. 

Anyone else come across this issue before? 

 

EDIT: 
Seems like there is an inconsistency between database searches and in memory searches. I've just done an extra: 

foreach($page->wc_variations as $variation) $variation->wc_variation_value = strtolower($variation->wc_variation_value);

Before doing the selector. Not great, but it works. 

  • Like 1
Link to comment
Share on other sites

2 minutes ago, kongondo said:

There is. I've found that *= in in-memory searches works irrespective of case (IIRC).

Worked a charm - thanks! 

EDIT: 
Spoke to soon, in this case it must be = because if you have an empty selector that means that product variation doesn't exist. So selecting colour=blue isn't enough, but *= will still make a selection.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...