Extension:YJShopping

From mediawiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
YJShopping
Release status: stable
Implementation Tag
Description generate item link via Yahoo! JAPAN API
Author(s) Kimagurenote (Corytalk)
Latest version 1.2.0
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>
Check usage and version matrix.

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:
    require_once "$IP/extensions/YJShopping/YJShopping.php";
    $wgYJShoppingAppID = '★';
    $wgYJShoppingPlus['yahoo']['sid'] = '※';
    $wgYJShoppingPlus['yahoo']['pid'] = '※';
    $wgYJShoppingPlus['paypaymall']['sid'] = '※';
    $wgYJShoppingPlus['paypaymall']['pid'] = '※';
    $wgYJShoppingPlus['amazon'] = '◆';
    #$wgYJShoppingPlus['amazon']['sid'] = '※';
    #$wgYJShoppingPlus['amazon']['pid'] = '※';
    $wgYJShoppingPlus['rakuten'] = '▲';
    #$wgYJShoppingPlus['rakuten']['lsid'] = '●';
    #$wgYJShoppingPlus['rakuten']['sid'] = '※';
    #$wgYJShoppingPlus['rakuten']['pid'] = '※';
    $wgYJShoppingPlus['biccamera']['lsid'] = '●';
    $wgYJShoppingPlus['biccamera']['bids'] = '111111.1';
    $wgYJShoppingPlus['sofmap']['lsid'] = '●';
    $wgYJShoppingPlus['sofmap']['bids'] = '111111.1';
    $wgYJShoppingPlus['sofmapused']['lsid'] = '●';
    $wgYJShoppingPlus['sofmapused']['bids'] = '111111.1';
    $wgYJShoppingPlus['naturum']['lsid'] = '●';
    $wgYJShoppingPlus['naturum']['bids'] = '111111.1';
    $wgYJShoppingPlus['honto']['sid'] = '※';
    $wgYJShoppingPlus['honto']['pid'] = '※';
    $wgYJShoppingPlus['7net']['sid'] = '※';
    $wgYJShoppingPlus['7net']['pid'] = '※';
    $wgYJShoppingPlus['iyec']['sid'] = '※';
    $wgYJShoppingPlus['iyec']['pid'] = '※';
    $wgYJShoppingPlus['wowma']['sid'] = '※';
    $wgYJShoppingPlus['wowma']['pid'] = '※';
    $wgYJShoppingPlus['kakakucom'] = true;
    $wgYJShoppingAcceptParams = array( 'image_size', 'genre_category_id', 'brand_id', 'seller_id', 'start', 'shipping', 'payment', 'delivery_area', 'delivery_day', 'delivery_deadline', 'sort', 'condition' );
    $wgYJShoppingTarget = '_blank';
    
  • 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%;
	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 {
	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: 9em;
	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.shoplinkpaypaymall {
	background-color: #982;
}
DIV.yjshopping UL LI.shoplinkamazon {
	background-color: #f90;
}
DIV.yjshopping UL LI.shoplinkrakuten {
	background-color: #c00;
}
DIV.yjshopping UL LI.shoplinkbiccamera {
	background-color: #e01;
}
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.shoplinkiyec {
	background-color: #153;
}
DIV.yjshopping UL LI.shoplinkwowma {
	background-color: #f71;
}
DIV.yjshopping UL LI.shoplinkkakakucom {
	background-color: #02d;
}
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage[edit]

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

You can put a link for the top item about "MediaWiki" via Yahoo! JAPAN API on a wiki page. For example:

<yjshopping>MediaWiki</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.

See also[edit]