6

I like to have core Country of Manufacture attribute displayed in the layered navigation but it seems simply selecting one of the "Filterable" options in Use In Layered Navigation field is not outputting anything. Is that possible with this core attribute or best to just create a new attribute and manage the country of manufacture data from there?

  • 1
    Your idea to add and manage a new attribute to call country of manufacture data is probably the fastest/easiest option. Issues with country_of_manufacture and layered navigation stem from how country_of_manufacture pulls a list of countries and doesn't have options related directly to the attribute (if you manage Label/Options of the attribute nothing shows). This behavior likely causes conflict with how layered navigation loops through options for display. (mostly speculation - haven't dug into this code in a while) – Reid Blomquist May 28 '14 at 17:21
  • Thanks for chiming in @ReidBlomquist I figured the latter idea is better. – monocat May 28 '14 at 22:42
4

It currently can't be done without rewriting Magento code.

That attribute on the backend has a specific model it uses

Databse

The model is located here: Mage_Catalog_Model_Product_Attribute_Source_Countryofmanufacture

Model

Looking at the logic in the model, it doesn't even call or mention what products are in that specific category. Going further into the Abstract, the Abstract contains no logic for layered navigation.

You can change it to be "filterable (with no results)" but that will only list the all the countries available.

I'm going to tinker with the logic to see if I can get it working, but it wouldnt be a quick fix.

[EDIT]:
Here is a link to a pull request from the Magento bugathon that implemented the required changes in the country of manufacturer and also the boolean source model.
Unfortunately it didn't get merged into the core because the original issue was related to a different source model (the table type).
The fix however will resolve your issues. https://github.com/magento/bugathon_march_2013/pull/256

Here is the link to a patch containing only source model changes (not the tests): https://gist.github.com/Vinai/bb1928021811f247c331

  • 1
    Thanks for looking into this @kab8609 Looks like whoever decided to make this specific attribute as part of the core package, didn't think far enough. :P – monocat May 28 '14 at 22:45
  • 1
    Added link to patch resolving the issue. Just realized the patch contains the tests, too. I'll sort that out, one moment please. – Vinai May 29 '14 at 5:38
  • 1
    Vinai is a coding machine! – kab8609 May 29 '14 at 5:57
0

"Going further into the Abstract, the Abstract contains no logic for layered navigation." - should an attribute source model contain logics for layered navigation ?

There are some reasons why it's not possible to use the attribute in Layered Navigation:

The country_on_manufacture is not indexed by magento in incatalog_product_index_eav as an int attribute. That's why the method getCount of Dmx_FixLayer_Model_Resource_Layer_Filter_Attribute always gets 0 products for every option of the attribute.

Try out my solution of the problem https://github.com/dimonixx/dmx-fixlayer.git .

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.