1

I want to change the categories & sub-categories according to region. e.g. I have category FOOD for US & category ELECTRONICS for UK so when I select US it should display FOOD & vice versa. Please suggest me any extension or any idea how t do it. Thanks in advance!!

5
  • 1
    you should be able to use different store-views for your different countries and then you can set your different categories enabled/disabled by store-view in category-management May 28, 2014 at 9:51
  • I am new in magneto how to use store-views can u explain?
    – swash_nam
    May 28, 2014 at 10:00
  • you get a good idea on whole structur directly from the magento knowledge-base and also practical video for setup: magentocommerce.com/knowledge-base/entry/… May 28, 2014 at 10:04
  • 2
    Stefan, you should give this as an answer! May 28, 2014 at 10:47
  • at your service :) May 28, 2014 at 12:21

3 Answers 3

1

Here is an idea. I don't have a fully functional code for it.
First you need to add an attribute to the category entity.
The attribute should be a dropdown and include all the countries your have (and an 'All' option in case you want to include the category in all the countries).

Then you have to change the observer that adds the categories to the top menu.

For this you need to override the method Mage_Catalog_Model_Observer::_addCategoriesToMenu()

The method starts like this:

foreach ($categories as $category) {
    if (!$category->getIsActive()) {
        continue;
    }
....

You just need to add an other condition there after the first if to check if the category is available for your desired country.

$currentCountry = ...some logic here to get the current country
if ($category->getYourAttributeCodeHere() != $currentCountry && $category->getYourAttributeCodeHere() != 0  ) { //0 is the value of the 'All' option. It may be different depending on how you implemented it.
    continue;
}
0
1

Magento has three store levels (System > Manage Stores):

  1. website -- it's possible to assign different prices;
  2. store -- it's possible to assign different categories trees;
  3. store view -- it's possible to assign different locales;

Of course the store level functionality provides much, much more, but the items above are the most notable ones.

Basically what you want to do is to assign different regions to different stores, which allows you to assign independent product trees (root categories) for them. This is Magento built in functionality, available out of box.

0

You can get a good idea about whole magento structur directly from the magento knowledge-base and also practical video for setup:

http://www.magentocommerce.com/knowledge-base/entry/overview-how-multiple-websites-stores-work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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