Extension:AmazonSearch
Release status: beta |
|
---|---|
Implementation | Tag |
Description | embed item link searched by Amazon |
Author(s) | Kimagurenote (Corytalk) |
Latest version | Continuous updates |
MediaWiki | |
PHP | 5.4.0+ |
Database changes | No |
License | Apache License 2.0 |
Download | https://kimagurenote.net/kn/AmazonSearch#Download https://kimagurenote.net/kn/AmazonSearch#History |
<amazon> |
|
The AmazonSearch extension provides a way to embed shopping link to Amazon.ae/com.au/com.br/ca/de/es/fr/in/it/co.jp/com.mx/sg/com.tr/co.uk/com(us) into wiki pages.
Installation
[edit]- At first, you must get Amazon associate tag, Product Advertising API (PA-API) key(★) and secret(◆) from Amazon. From US, UK or other region where you want to use it.
- Download zip file from author's website, unzip it and place the file(s) in a directory called
AmazonSearch
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
require_once "$IP/extensions/AmazonSearch/AmazonSearch.php"; $wgAmazonSearchDefaultMerchantId = 'All'; $wgAmazonSearchDefaultRegion = 'us'; $wgAmazonSearchAPIKey['us'] = '★'; $wgAmazonSearchAPISecret['us'] = '◆'; $wgAmazonSearchAssociateTag['us'] = 'yourtag-20'; $wgAmazonSearchAPIKey['uk'] = '☆'; $wgAmazonSearchAPISecret['uk'] = '◇'; $wgAmazonSearchAssociateTag['uk'] = 'yourtag-21'; $wgAmazonSearchAPIKey['jp'] = '☆'; $wgAmazonSearchAPISecret['jp'] = '◇'; $wgAmazonSearchAssociateTag['jp'] = 'yourtag-22'; ...
- If you use MediaWiki 1.32 or above, you will need some permissions. please see: MediaWiki_1.32/interface-admin.
- Add the following code at the bottom of your MediaWiki:Common.css. You can fully customize it.
/* Extension:AmazonSearch */
DIV.amazonsearch {
clear: both;
width: 100%;
margin: 0 auto;
padding: 0.5em;
border: 1px solid #444;
overflow: hidden;
}
DIV.amazonsearch IMG.amazonsearchimg {
float: left;
margin: 0.1em 1em 0.1em 0.1em;
}
DIV.amazonsearch P.amazonsearchname {
margin: 0;
font-size: 90%;
text-indent: 0;
}
DIV.amazonsearch P.amazonsearchname::before {
background-color: #bbb;
border-radius: 10%;
color: #fff;
font-size: smaller;
padding: 0 0.5em 0 0.5em;
margin-right: 0.5em;
content: "Ad";
}
DIV.amazonsearch P.amazonsearchauthor {
margin: 0;
font-size: 80%;
text-indent: 0;
}
DIV.amazonsearch UL {
margin: 0;
}
DIV.amazonsearch UL LI {
display: inline-block;
text-align: center;
list-style: none;
font-size: 90%;
width: 12em;
margin: 0.2em;
padding: 0.2em 0.5em 0.2em 0.5em;
border-radius: 0.5em;
white-space: nowrap;
}
DIV.amazonsearch UL LI A {
color: #fff;
}
DIV.amazonsearch UL LI.shoplinkamazon {
background-color: #f90;
}
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Usage
[edit]<amazon>search keyword(s)</amazon>
You can put a link for the top item about "MediaWiki" by Amazon on a wiki page. For example:
<amazon>MediaWiki</amazon>
You can specify some parameters(*). For example:
<amazon SearchIndex="Books">MediaWiki</amazon>
(*) Actor, Artist, Author, Brand, BrowseNodeId, Condition, DeliveryFlags, MaxPrice, Merchant, MinPrice, MinReviewsRating, MinSavingPercent, SearchIndex and SortBy are available. Details see here.
You can put a link to other (non-default) region of Amazon if you get PA-API key and secret of this region and set it. For example:
<amazon region="uk">MediaWiki</amazon>
If this extension put no result, you can find an error message in the source of html. Generally press Ctrl+U to view a source. For example:
<!-- amazon>API call failure.</amazon -->
If you meet Amazon PA-API limit, you will get "API call failure".
PA-API v5
[edit]It was supported new PA-API v5 since Mar 02, 2020 (at v1.1.0).
Former PA-API v4 will been discontinued soon. Please update to new code but you may not need to change any configuration (LocalSettings.php).
If it not work fine with PA-API v5, try to use new Scratchpad, and renew your AccessKey and SecretKey.
See details, Migration Guide.
Beta
[edit]The author tested it and worked fine with Amazon.co.jp (Amazon Japan) on MediaWiki 1.32. But I can't test it for other region because I can't get PA-API key and secret.
If you want to use Amazon PA-API, you must offer 3 or more sales in this region with official linking tools via your Associate tag, and you must pass to review your website by Amazon.
Please test it in other region if you can. Thank you.
Notice
[edit]Limit of the Amazon PA-API is so hard(T_T)
You will unable to use Amazon PA-API someday if you can't make sales continuously. [1]
If you want to use it in Japan, you can use YJShopping extension instead.
See also
[edit]- AmazonSearch (author site, written in Japanese)
- Extension:YJShopping - embed multi links by Yahoo! JAPAN API
- Amazon Product Advertising API (PA-API)