Attribute problem after updating

Permalink
Hi,

I've made a template that uses a page attribute to show or hide a certain image or text.

After updating C5 to 5.4.1.1 this function isn't working anymore.

The attribute is a selection. There are three options, the content will change along with the selected option.

echo $c->getAttribute('my_handle_name');

The result is: 'option1'

But...
if ($c->getAttribute('my_handle_name') == 'option1') { echo 'text'; }

This doens't work! Apparently the if statement doesn't get the right value.
When I var_dump $c->getAttribute('my_handle_name') I get a full object with the value I need in it.

The code in the template worked fine, but after updating it's broken...

Does anyone have any idea?

Regards,

Corretje

DeWebmakers
 
olsgreen replied on at Permalink Reply
olsgreen
Strange! I have themes doing the same thing and no problems ...

Have you tried grabbing a fresh instance of the current page object? (not that you should have to) I'm using:

$page = Page::getCurrentPage();
if($page->getAttribute("colour_swatch")) {
    $swatch = strtolower($page->getAttribute("colour_swatch"));
}
DeWebmakers replied on at Permalink Reply
DeWebmakers
Thanks for the answer. Sadly creating a fresh instance isn't the solution....

I've noticed that the problem spreads through out the other instances to.

I've installed e-Commerce Addon and in the notification mails after ordering the attribute values of the products are also shown as "Object" instead of a real value. When I echo the value it works fine...

Anyone with the same issue?