4

I'm using a category widget to generate a link to a category. However, the store code is appended to the URL. How do I prevent this.

{{widget type="catalog/category_widget_link" anchor_text="Mobile" title="Mobile" template="catalog/category/widget/link/link_inline.phtml" id_path="category/368"}}

And the URL which Magento generates:

http://www.domain.com/path/to/category.html?__store=store_view_code

Any help will be appreciated.

UPDATE

I didn't set Add store codes to Url in backend. Backend settings

  • Are you aware of the backend setting which appends store codes to the url? – pspahn Jan 13 '15 at 8:10
3

This is pretty annoying as it tends to invalidate FPC implementations. We 'solved' this by rewriting Mage_Catalog_Block_Product_Widget_Link::getHref and removing the following section:

if(strpos($this->_href, "___store") === false){
    $symbol = (strpos($this->_href, "?") === false) ? "?" : "&";
    $this->_href = $this->_href . $symbol . "___store=" . $store->getCode();
}
0

I have an alternative solution that worked well too.

Copy app/code/core/Mage/Catalog/Block/Widget/Link.php to app/code/local/Mage/Catalog/Block/Widget/Link.php

Search for (line 91 in Magento 1.7.x / line 100 in Magento 1.9.x)

$this->_href = $this->_href . $symbol . "___store=" . $store->getCode();

And modify to

$this->_href = $this->_href;

Upload and save your changes and you'll now not have your widget (dynamically) inserted links getting appended with ?___store=default.

Credit: DesignHaven

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.