Closed (fixed)
Project:
Amazon Store
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
5 Dec 2010 at 16:12 UTC
Updated:
10 Mar 2011 at 13:01 UTC
Jump to comment: Most recent file
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.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 989680_amazon_store_getsearchindexpulldown.patch | 818 bytes | pancho |
| #5 | fix_changing_locale.patch | 7.38 KB | pancho |
Comments
Comment #1
rfayHere are the warnings when set to 'uk'
Comment #2
rfayAnd when set to 'jp':
Comment #3
rfayThis is an Amazon store #fail. Will fail in D7 as well, I imagine.
Comment #4
panchoSame in 7.x-1.x. I'll take care.
Comment #5
panchoOkay, 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.
Comment #6
rfayThis looks like good work.
But I think the core of the problem is
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
Comment #7
panchoHmm, 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.
Comment #8
rfayWorks 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
Comment #9
panchoOkay, 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