It looks like Amazon may have dropped some items from the search indexes in the latest schema. If set to 'de', these warnings appear on admin/settings/amazon/api:

    * notice: Undefined index: GourmetFood in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Industrial in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: MusicalInstruments in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: PetSupplies in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Shoes in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: SilverMerchants in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Wireless in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: WirelessAccessories in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.

Comments

rfay’s picture

Title: Warnings when locale == 'de' » Warnings when locale is not 'us'

Here are the warnings when set to 'uk'

    * notice: Undefined index: Automotive in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: GourmetFood in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Industrial in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: MusicalInstruments in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: PCHardware in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: PetSupplies in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Photo in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Shoes in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: SilverMerchants in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Wireless in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: WirelessAccessories in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
rfay’s picture

And when set to 'jp':

    * notice: Undefined index: Automotive in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: GourmetFood in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: HomeGarden in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Industrial in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Kitchen in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: MusicalInstruments in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: OfficeProducts in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: OutdoorLiving in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: PCHardware in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: PetSupplies in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Photo in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Shoes in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: SilverMerchants in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Tools in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: Wireless in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.
    * notice: Undefined index: WirelessAccessories in /home/rfay/workspace/d6git/sites/all/modules/amazon_store/searchindexes.inc on line 70.

rfay’s picture

Project: Amazon Product Advertisement API » Amazon Store
Version: 6.x-1.x-dev » 6.x-2.x-dev

This is an Amazon store #fail. Will fail in D7 as well, I imagine.

pancho’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Assigned: Unassigned » pancho
Priority: Normal » Critical

Same in 7.x-1.x. I'll take care.

pancho’s picture

Status: Active » Needs review
StatusFileSize
new7.38 KB

Okay, here is a first take on this. Not at all elegant, it just works.

I'm creating a hook in amazon.module that calls out right after the locale has been changed.
amazon_store takes it up resetting the locale-dependent configuration settings.

As we need to create a replacement SearchIndexes object fed with the new locale file, the names of the respective locale functions needs to be specified. Otherwise we'd include two functions with the same name within the same bootstrap which would cause a WSOD.
Please test and think about whether a more elegant solution is possible...

Note that this patch goes across both projects.

rfay’s picture

This looks like good work.

But I think the core of the problem is

  function getSearchIndexPulldown($exclude_all_searchindex = FALSE) {
    $categories = variable_get('amazon_store_include_categories', $GLOBALS['amazon_store_search_indexes']->getRecommendedCategories());
    $categories = array_filter($categories);

    $rv = array();
    foreach ($categories as $name) {
      $rv[$name] = $this->searchIndexPulldown[$name];
    }

Where it goes through the amazon_store_include_categories and assumes that they'll all be in the SearchIndexes (and of course Amazon doesn't support all of them in all countries).

I think this should probably be

if (!empty($this->searchIndexPulldown[$name])) {
        $rv[$name] = $this->searchIndexPulldown[$name];
}
pancho’s picture

Status: Needs review » Needs work

Hmm, while I see that you fixed in one line what I needed tens of lines for, I wouldn't agree that this is the core of the problem. Rather - and please don't feel offended - you're curing the mere symptom of the problem.
Core of the problem is IMHO that after switching the locale, the configuration data becomes inconsistent resp. nonapplicable. Usually this shows up regarding the 'include categories', but it may also show up as an invalid 'search index' option or an invalid browsenode.
This may affect custom modules depending on the Amazon API, so I think offering a hook for this action is necessary anyway.

In the end the question is, whether it is just enough to fix the symptoms at least in the legacy versions, and rewrite it for 7.x-2. I would actually agree that it is. So when I'm home again, I'm probably gonna test your fix and merge it with mine, in order to have all symptoms fixed, but not such a massive reorganisation of the locale includes. Sounds good?

In 7.x-2 we'll be faced with the reasonable feature request of having a multi-locale setup (see #396554: Allow dynamic amazon locale choice), which would anyway require a major rewrite. Also, I think that the locale support is something to be offered by the basic Amazon API and not just by the store extension.

rfay’s picture

Works for me.

Yeah, the whole locale thing is actually pretty fragile, largely because it requires understanding an incredible maze of weird rules from the Amazon Product API. I'm sure there are many inaccuracies in there that never get reported.

Thanks!
-Randy

pancho’s picture

Status: Needs work » Fixed
StatusFileSize
new818 bytes

Okay, I'm now gonna take your fix from #6 and leave everything more generic and sophisticated to the 7.x-2 branch. Finally this needs to be fixed at all.
For some reason this doesn't seem to affect the 6.x version - this fact could use some further research.
However, it's now committed to 7.x-1: http://drupal.org/cvs?commit=504772

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.