<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -21,16 +21,18 @@ module Netphase
             :asin =&gt; 'asin',
             :name =&gt; 'name',
             :access_key =&gt; ENV['AMAZON_ACCESS_KEY_ID'],
-            :associate_tag =&gt; ENV['AMAZON_ASSOCIATE_TAG']
+            :associate_tag =&gt; ENV['AMAZON_ASSOCIATE_TAG'],
+            :search_index =&gt; 'Books'
           }
           options = defaults.merge options
 
           Amazon::Ecs.options = {:aWS_access_key_id =&gt; options[:access_key], :associate_tag =&gt; options[:associate_tag] }
 
           write_inheritable_attribute(:amazon_asin, options[:asin])    
-          write_inheritable_attribute(:amazon_name, options[:name])    
+          write_inheritable_attribute(:amazon_name, options[:name])
+          write_inheritable_attribute(:amazon_search_index, options[:search_index])    
           write_inheritable_attribute(:amazon_associate_key, options[:associate_key])
-          class_inheritable_reader :amazon_asin, :amazon_name, :amazon_associate_key
+          class_inheritable_reader :amazon_asin, :amazon_name, :amazon_search_index, :amazon_associate_key
           
           has_one :amazon_product, :as =&gt; :amazonable   #, :dependent =&gt; :delete
           include Netphase::Acts::Amazonable::InstanceMethods
@@ -51,20 +53,21 @@ module Netphase
           if self.amazon_product.nil?
             asin = (self.respond_to?('amazon_asin')) ? self.send(self.amazon_asin) : nil
             name = (self.respond_to?('amazon_name')) ? self.send(self.amazon_name) : nil
+            search_index = (self.respond_to?('amazon_search_index')) ? self.amazon_search_index : 'Books'
             
             if !asin.nil? &amp;&amp; asin.length &gt; 0
-              #puts &quot;Looking up #{asin}&quot;
+              # puts &quot;Looking up #{asin}&quot;
               res = Amazon::Ecs.item_lookup(self.send(self.amazon_asin), :response_group =&gt; 'Medium')
               
               self.amazon_product =
                 AmazonProduct.new(:xml =&gt; res.doc.to_html, :asin =&gt; res.doc.at('asin').inner_html)
               self.amazon_product.save
             elsif !name.nil? &amp;&amp; name.length &gt; 0
-              #puts &quot;Searching for #{name}&quot;
-              res = Amazon::Ecs.item_search(self.send(self.amazon_name), :response_group =&gt; 'Medium') #, :sort =&gt; 'salesrank'
+              # puts &quot;Searching for #{name}&quot;
+              res = Amazon::Ecs.item_search(self.send(self.amazon_name), :search_index =&gt; self.amazon_search_index, :response_group =&gt; 'Medium') #, :sort =&gt; 'salesrank'
               res = res.doc.at('items/item')
               self.amazon_product =
-                AmazonProduct.new(:xml =&gt; res.to_html, :asin =&gt; res.at('itemattributes/isbn').inner_html)
+                AmazonProduct.new(:xml =&gt; res.to_html, :asin =&gt; (res.at('itemattributes/isbn').nil? ? res.at('asin').inner_html : res.at('itemattributes/isbn').inner_html))
               self.amazon_product.save
             else
               logger.error &quot;No known attributes to search by&quot;</diff>
      <filename>lib/acts_as_amazon_product.rb</filename>
    </modified>
    <modified>
      <diff>@@ -27,6 +27,11 @@ ActiveRecord::Base.connection.create_table :movies do |t|
   t.column :asin, :string
 end
 
+ActiveRecord::Base.connection.create_table :magazines do |t|
+  t.column :name, :string
+  t.column :asin, :string
+end
+
 ActiveRecord::Base.connection.create_table :amazon_products do |t|  # , :id =&gt; false
   t.column :asin, :string
   t.column :xml, :text
@@ -45,6 +50,10 @@ class Movie &lt; ActiveRecord::Base
   acts_as_amazon_product
 end
 
+class Magazine &lt; ActiveRecord::Base
+  acts_as_amazon_product :search_index =&gt; 'Magazines'
+end
+
 AmazonProduct.delete_all
 
 class ActAsAmazonProductTest &lt; Test::Unit::TestCase
@@ -55,6 +64,8 @@ class ActAsAmazonProductTest &lt; Test::Unit::TestCase
       @book_ror = Book.create(:title =&gt; 'Rails Recipes')
       @book_perl = Book.create(:title =&gt; 'Perl')
       @movie_dh = Movie.create(:name=&gt;'Live Free or Die Hard', :asin=&gt;'B000VNMMRA')
+      Magazine.delete_all
+      @mag_lci = Magazine.create(:name =&gt; 'La Cucina Italiana')
     end
     
     def test_isbn
@@ -67,6 +78,11 @@ class ActAsAmazonProductTest &lt; Test::Unit::TestCase
       assert_equal(&quot;Getting Things Done: The Art of Stress-Free Productivity&quot;, @book_gtd.amazon.title)
     end
     
+    def test_magazine
+      assert_not_nil(@mag_lci.amazon)
+      assert_equal(&quot;B00009XFML&quot;, @mag_lci.amazon.asin)
+    end
+    
     def test_small_image
       assert_not_nil(@book_gtd.amazon)
       assert_match(/4104N6ME70L\._SL75_\.jpg/, @book_gtd.amazon.small_image_url)</diff>
      <filename>test/acts_as_amazon_product_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d797ef9d7fea6f2512ee8db7c701910ca9bcaf91</id>
    </parent>
  </parents>
  <author>
    <name>Scott Nedderman</name>
    <email>scott@netphase.com</email>
  </author>
  <url>http://github.com/netphase/aaap/commit/48a80e7bedbb0d5f24a31b93278419da681207bd</url>
  <id>48a80e7bedbb0d5f24a31b93278419da681207bd</id>
  <committed-date>2008-04-24T11:47:27-07:00</committed-date>
  <authored-date>2008-04-24T11:47:27-07:00</authored-date>
  <message>Accepts search_index parameter to work better with Magazines (patch from Parker Morse)</message>
  <tree>15f76c2eabce2e6e9ceaa210fb60de04c06abc27</tree>
  <committer>
    <name>Scott Nedderman</name>
    <email>scott@netphase.com</email>
  </committer>
</commit>
