Extension:AmazonSearch

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
AmazonSearch
Release status: beta
Amazon.com-Logo.svg
Implementation Tag
Description embed item link searched by Amazon
Author(s) Kimagurenote (Corytalk)
Latest version Continuous updates
PHP 5.4.0+
Database changes No
License BSD 3-clause "Modified" License
Download https://kimagurenote.net/kn/AmazonSearch#Download
https://kimagurenote.net/kn/AmazonSearch#History (Japanese)
<amazon>
Translate the AmazonSearch extension if it is available at translatewiki.net
Check usage and version matrix.

The AmazonSearch extension provides a way to embed shopping link to Amazon.ca/de/fr/co.jp/co.uk/com(us) into wiki pages.

Installation[edit]

  • Add the following code at the bottom of your LocalSettings.php:
    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.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;
}
  • Yes 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, AudienceRating, Author, Brand, BrowseNode, Composer, Condition, Conductor, Director, Manufacturer, MaximumPrice, MerchantId, MinimumPrice, Orchestra, Publisher, SearchIndex and Sort 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".

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 alternatively.

See also[edit]