Extension:YJShopping

MediaWiki extensions manual
YJShopping
Release status: stable
Implementation Tag
Description generate item link via Yahoo! JAPAN API
Author(s) Kimagurenote (Corytalk)
Latest version 1.3.2
MediaWiki
PHP 5.4.0+
Database changes No
License BSD 3-clause "Modified" License
Download https://kimagurenote.net/kn/YJShopping#Download
https://kimagurenote.net/kn/YJShopping#History
Example https://kimagurenote.net/kn/YJShopping#%E8%A8%98%E8%BF%B0%E4%BE%8B_Usage
‎<yjshopping>

The YJShopping extension provides a way to embed shopping link for some shopping sites via Yahoo! JAPAN Item Search API into wiki pages.

Installation

edit
  • At first, you must get Yahoo! JAPAN API ID (Japanese).
  • You can use some affiliate program. If you want to use it, you must get those IDs from ValueCommerce or LinkShare.
  • Download zip file from author's website, unzip it and place the file(s) in a directory called YJShopping in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    /* Extension:YJShopping */
    require_once "$IP/extensions/YJShopping/YJShopping.php";
    $wgYJShoppingAppID = '★';
    $wgYJShoppingPlus['yahoo']['sid'] = '※';
    $wgYJShoppingPlus['yahoo']['pid'] = '※';
    $wgYJShoppingPlus['amazon'] = '◆';
    #$wgYJShoppingPlus['amazon']['sid'] = '※';
    #$wgYJShoppingPlus['amazon']['pid'] = '※';
    $wgYJShoppingPlus['rakuten'] = '▲';
    #$wgYJShoppingPlus['rakuten']['lsid'] = '●';
    #$wgYJShoppingPlus['rakuten']['sid'] = '※';
    #$wgYJShoppingPlus['rakuten']['pid'] = '※';
    $wgYJShoppingPlus['sofmap']['lsid'] = '●';
    $wgYJShoppingPlus['sofmapused']['lsid'] = '●';
    $wgYJShoppingPlus['naturum']['lsid'] = '●';
    $wgYJShoppingPlus['honto']['sid'] = '※';
    $wgYJShoppingPlus['honto']['pid'] = '※';
    $wgYJShoppingPlus['7net']['sid'] = '※';
    $wgYJShoppingPlus['7net']['pid'] = '※';
    $wgYJShoppingPlus['wowma']['lsid'] = '●';
    $wgYJShoppingPlus['nttxstore']['a8mat'] = '△';
    $wgYJShoppingPlus['qoo10']['sid'] = '※';
    $wgYJShoppingPlus['qoo10']['pid'] = '※';
    $wgYJShoppingPlus['anker']['sid'] = '※';
    $wgYJShoppingPlus['anker']['pid'] = '※';
    $wgYJShoppingPlus['mercari'] = '☆';
    $wgYJShoppingPlus['kakakucom'] = true;
    
    /* (option) */
    $wgYJShoppingDefaultButtons = [ 'yahoo', 'amazon', 'rakuten', 'mercari' ];
    $wgYJShoppingBookButtons = [ 'yahoo', 'amazon', 'rakuten', 'honto', 'ebookjapan', '7net', 'mercari' ];
    $wgYJShoppingMatchAddbtn = [ "anker" => "anker wowma" ];
    
    /* (option) Link target */
    $wgYJShoppingTarget = '_blank';
    
    /* (option) Lazy loading */
    $wgNativeImageLazyLoading = true;
    
  • 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:YJShopping */
DIV.yjshopping {
	clear: both;
	width: 100%;
	min-height: 180px;
	margin: 0 auto;
	padding: 0.5em;
	border: 1px solid #444;
	overflow: hidden;
}
DIV.yjshopping IMG.yjshoppingimg {
	float: left;
	margin: 0.1em 1em 0.1em 0.1em;
}
DIV.yjshopping P.yjshoppingname {
	margin: 0;
	font-size: 90%;
	text-indent: 0;
}
DIV.yjshopping P.yjshoppingstore::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.yjshopping P.yjshoppingstore {
	margin: 0;
	font-size: 80%;
	text-indent: 0;
}
DIV.yjshopping UL {
	margin: 0;
}
DIV.yjshopping UL LI {
	display: inline-block;
	text-align: center;
	list-style: none;
	font-size: 85%;
	width: 10em;
	margin: 0.2em;
	padding: 0.2em 0.5em 0.2em 0.5em;
	border-radius: 0.5em;
	white-space: nowrap;
}
DIV.yjshopping UL LI A {
	color: #fff;
}
DIV.yjshopping UL LI.shoplinkyahoo {
	background-color: #f55;
}
DIV.yjshopping UL LI.shoplinkamazon {
	background-color: #f90;
}
DIV.yjshopping UL LI.shoplinkrakuten {
	background-color: #c00;
}
DIV.yjshopping UL LI.shoplinksofmap {
	background-color: #16f;
}
DIV.yjshopping UL LI.shoplinksofmapused {
	background-color: #3ba;
}
DIV.yjshopping UL LI.shoplinknaturum {
	background-color: #084;
}
DIV.yjshopping UL LI.shoplinkhonto {
	background-color: #4af;
}
DIV.yjshopping UL LI.shoplink7net {
	background-color: #153;
}
DIV.yjshopping UL LI.shoplinkwowma {
	background-color: #f71;
}
DIV.yjshopping UL LI.shoplinknttxstore {
	background-color: #06a;
}
DIV.yjshopping UL LI.shoplinkqoo10 {
	background-color: #5af;
}
DIV.yjshopping UL LI.shoplinkanker {
	background-color: #2ae;
}
DIV.yjshopping UL LI.shoplinkmercari {
	background-color: #f00;
}
DIV.yjshopping UL LI.shoplinkkakakucom {
	background-color: #02d;
}
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage

edit
<yjshopping>search keyword(s)</yjshopping>

Put item links about "fruits". For example:

<yjshopping>fruits</yjshopping>

Put book links about "MediaWiki". For example:

<yjshopping querytype="book">MediaWiki</yjshopping>

Put item links about "Type-C charger" sell from AnkerDirect and addbtn to Anker. (v1.3.0+) For example:

<yjshopping seller_id="ankerdirect" addbtn="anker">Type-C charger</yjshopping>

You can specify some parameters(*). For example:

<yjshopping genre_category_id="10604">MediaWiki</yjshopping>

(*) Details see here (Japanese).

You can set ISBN or JAN(EAN) code directly. For example:

<yjshopping querytype="isbn">978-4-04-072421-8</yjshopping>
<yjshopping querytype="jan">4988003561802</yjshopping>

If you get no result, this extension met some error(s) to call API.

Notice

edit

Yahoo! JAPAN shopping search API v3 available only in Japan.

Additional information please see author's site (written in Japanese).

See also

edit