Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Aiheen aloitti: fshagan - syyskuu 23, 2007, 02:14:50 IP

Otsikko: Amazon Widget - Quick Linker -> BBCode Mod
Kirjoitti: fshagan - syyskuu 23, 2007, 02:14:50 IP
For Amazon Associates, having the ability for readers to create a link to an Amazon search page with their affiliate code already embedded would be fantastic.  Amazon now has a "widget" that allows simple HTML markup to do this for bloggers.  I think it could be adapted to SMF with BBCode.

Here's how the Amazon widget works "out of the box".  First, javascript is added to the header of the webpage.  Then, the text is marked up similar to any link:


    * <a type="amzn" >Harry Potter</a>
          o Links to Amazon.com search results page for "Harry Potter".
    * <a type="amzn" search="Harry Potter">My favorite hero</a>
          o The link reads "My favorite hero" and points to a search results page for the phrase"Harry Potter".
    * <a type="amzn" search="Harry Potter" category="books">My favorite hero</a>
          o Links to a search results page for the phrase "Harry Potter", but only in the Books category.
          o View a list of valid Amazon.com category attributes
    * <a type="amzn" asin="B000012345">I love this item</a>
          o The link reads "I love this item" and links directly to the specific Amazon product with Amazon id (ASIN) "B000012345"


Changing that to a simplified BBCode version might look like:



[amazon="Harry Potter"]Harry Potter Books at Amazon[/amazon]
- Displays a link "Harry Potter Books at Amazon" and takes reader to a search page with all results for "Harry Potter"

[amazon]Harry Potter[/amazon]
- As above, but link reads "Harry Potter"

[amazon="1234567890"]Harry Potter Book[/amazon]
- searches Amazon for the ISBN, same as their "asin=" search, with the link text "Harry Potter Book"



I have hard coded new BBCodes for phpBB, but since switching to SMF, I have only used mods that work from the Admin center (much easier to update).  But I don't know how to write a mod.

I think this one would be very useful!
Otsikko: Re: Amazon Widget - Quick Linker -> BBCode Mod
Kirjoitti: karlbenson - syyskuu 23, 2007, 04:30:03 IP
Maybe something like
http://custom.simplemachines.org/mods/index.php?mod=898
Otsikko: Re: Amazon Widget - Quick Linker -> BBCode Mod
Kirjoitti: fshagan - syyskuu 23, 2007, 05:52:14 IP
That's close, but the functionality of the new Widget is that you don't have to have the URL to a specific Amazon page, or the ISBN number.  You can put in any search term, book title, etc., and it will open a page with that as the search item on Amazon.

I may take a look at how that mod is coded; maybe adapting it would work.