From e3f744a31811632128c82a2ddcdf2573e39ef781 Mon Sep 17 00:00:00 2001
From: Mek <michael.karpeles@gmail.com>
Date: Wed, 20 Jan 2021 19:53:35 -0800
Subject: [PATCH 1/2] consolidating vendors back to core group

consolidating vendors #3069
---
 openlibrary/macros/AffiliateLinks.html | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/openlibrary/macros/AffiliateLinks.html b/openlibrary/macros/AffiliateLinks.html
index a33b05f6105..46c376dfcb6 100644
--- a/openlibrary/macros/AffiliateLinks.html
+++ b/openlibrary/macros/AffiliateLinks.html
@@ -23,13 +23,6 @@
     'link': 'https://www.amazon.com/dp/%s/?tag=%s' % (asin or isbn, affiliate_id('amazon')),
   } if (asin or isbn) else None
 
-  bookshop = {
-    'key': 'bookshop-org',
-    'analytics_key': 'BookshopOrg',
-    'name': _('Bookshop.org'),
-    'link': 'https://bookshop.org/a/%s/%s' % (affiliate_id('bookshop-org'), isbn),
-  } if isbn else None
-
   # Fetch price data
   if not is_bot() and prices and isbn:
     bwb_metadata = get_betterworldbooks_metadata(isbn)
@@ -40,7 +33,7 @@
       amz_metadata = get_amazon_metadata(isbn, resources='prices')
       amazon['price'] = amz_metadata and amz_metadata.get('price')
 
-  stores = [store for store in [bwb, amazon, bookshop] if store]
+  stores = [store for store in [bwb, amazon] if store]
 
 $def affiliate_link(key, analytics_key, name, link, price='', price_note=''):
   <li class="prices-$key">

From e19e08f61ad0f3e41e3f27890a498877ef18a911 Mon Sep 17 00:00:00 2001
From: Drini Cami <cdrini@gmail.com>
Date: Tue, 26 Jan 2021 14:22:02 -0500
Subject: [PATCH 2/2] Add more stores link + link to bookshop

---
 openlibrary/macros/AffiliateLinks.html | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/openlibrary/macros/AffiliateLinks.html b/openlibrary/macros/AffiliateLinks.html
index 46c376dfcb6..79c5ee198e1 100644
--- a/openlibrary/macros/AffiliateLinks.html
+++ b/openlibrary/macros/AffiliateLinks.html
@@ -23,6 +23,13 @@
     'link': 'https://www.amazon.com/dp/%s/?tag=%s' % (asin or isbn, affiliate_id('amazon')),
   } if (asin or isbn) else None
 
+  bookshop = {
+    'key': 'bookshop-org',
+    'analytics_key': 'BookshopOrg',
+    'name': _('Bookshop.org'),
+    'link': 'https://bookshop.org/a/%s/%s' % (affiliate_id('bookshop-org'), isbn),
+  } if isbn else None
+
   # Fetch price data
   if not is_bot() and prices and isbn:
     bwb_metadata = get_betterworldbooks_metadata(isbn)
@@ -33,7 +40,8 @@
       amz_metadata = get_amazon_metadata(isbn, resources='prices')
       amazon['price'] = amz_metadata and amz_metadata.get('price')
 
-  stores = [store for store in [bwb, amazon] if store]
+  primary_stores = [store for store in [bwb, amazon] if store]
+  more_stores = [store for store in [bookshop] if store]
 
 $def affiliate_link(key, analytics_key, name, link, price='', price_note=''):
   <li class="prices-$key">
@@ -48,6 +56,12 @@
   </li>
 
 <ul class="buy-options-table">
-    $for store in stores:
+    $for store in primary_stores:
       $:affiliate_link(store['key'], store['analytics_key'], store['name'], store['link'], store.get('price', ''), store.get('price_note', ''))
+    $if more_stores:
+      <details>
+        <summary>$_('More')</summary>
+        $for store in more_stores:
+          $:affiliate_link(store['key'], store['analytics_key'], store['name'], store['link'], store.get('price', ''), store.get('price_note', ''))
+      </details>
 </ul>