1

I am trying to change the persistence message that shows in the header when a customer logs out.

(Not Mr Foo?)

I've tried changing it via translation file:

"Not %s?","Log In / Register"

I've also tried rewriting the block class:

class Mycompany_Persistent_Block_Header_Additional extends Mage_Persistent_Block_Header_Additional
{
    /**
     * Render additional header html
     *
     * @return string
     */
    protected function _toHtml()
    {
        $text = $this->__('Log In / Register');

        $this->setAnchorText($text);
        $this->setHref($this->getUrl('persistent/index/unsetCookie'));

        return parent::_toHtml();
    }
} 

The above doesn't have an effect on changing the link as it still displays as if the rewrite doesn't exist even though I can see the my class is being loaded.

Has anyone managed to change this bit of text? All i want to do is replace it with Log In / Register

Many thanks

1

So the reason that the rewrite does not work even though your class is being call is because you call your change and then still call the original function.

If you remove the call to the parent::_toHtml() then you should have the system working as desired. I think you still need to call the later _toHtml functions in this case though.

class Mycompany_Persistent_Block_Header_Additional extends Mage_Persistent_Block_Header_Additional
{
    /**
     * Render additional header html
     *
     * @return string
     */
    protected function _toHtml()
    {
        $text = $this->__('Log In / Register');

        $this->setAnchorText($text);
        $this->setHref($this->getUrl('persistent/index/unsetCookie'));
    }
} 

I would suggest going with the changing of the translation if possible. I think the string you need would look as follows.

"(Not %s?)","Log In / Register"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.