2

I'm on Magento Version Enterprise 1.13.1.0 and trying to change a product to have the URL key as default value. This is because I'm gonna have same url key for both of my stores.

I got 2 stores UK and AU which got to share same URL key for this product (I have many products already doing it), but every time I select "Use Default" and save, product get saved but URL key remains the same as what I had before at store level. And "Use Default" check box get unchecked automatically.

Current values for URL keys are some thing like below,

Default Value  : lunch-bag-red
AU Store Value : lunch-bag-red
UK Store Value : lunch-bag-red-temp

Result I'm After is,

Default Value  : lunch-bag-red
AU Store Value : Use Default
UK Store Value : Use Default

I looked at the URL re-writes section and tried to do the above after deleting any URL re-writes available for that product, but no luck.

Ran URL re-indexer at different occasions, in deferent sequences, nothing helped me to change the product to use default.

But one more thing, in my AU store URL key was same as default URL Key with "Use Default" unchecked. I'm not sure how it had happen when duplicate URLs aren't possible in magento.

I'm trying to fix this for more than 2hrs now, unfortunately nothing really worked.

Does any one faced similar issue before? Or anyone out there know a workaround for this?

Thanu
  • 2,481
  • 8
  • 34
  • 53

1 Answers1

1

For those who might have the issue, the following block is responsible for using default values for certain attributes :

app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php:602

    if ($useDefaults = $this->getRequest()->getPost('use_default')) {
        foreach ($useDefaults as $attributeCode) {
            $product->setData($attributeCode, false);
        }
    }

I haven't tried it but I guess you can iterate through your products and do a "$product->setData('url_key', false)". Someone posted about it in the this post: Magento - Set product attribute to use default values

In our case (ee 1.13.1), we had two stores 'fr' and 'en'. We wanted only the 'en' store to fetch the default values. So we deleted directly the matching rows in the table 'catalog_product_entity_url_key'. It automatically fetches the value from "default".

Before 
store_id: 0 - product : 42 - Value : green-apple
store_id: 1 - product : 42 - Value : pomme-verte
store_id: 2 - product : 42 - Value : apple

After
store_id: 0 - product : 42 - Value : green-apple
store_id: 1 - product : 42 - Value : pomme-verte 

And we made a permanent redirection from apple to green-apple.

Edit: We also deleted the entries that were in the table catalog_product_entity_varchar for the attribute 97.

Community
  • 1
  • 1
Laila
  • 1,421
  • 3
  • 13
  • 27