Skip to content

Usage ​

ASA1 (legacy)

This page documents ASA1, the predecessor of ASA2. ASA1 only receives security fixes and Amazon API updates. Looking for the current plugin? See the ASA2 documentation.

ASA1 Shortcodes ​

asa ​

shortcode_asa_1

To embed products from Amazon into your post with Affiliate Super Assistent (ASA1), easily use shortcodes like this:

[asa]ASIN[/asa]

where ASIN is the Amazon ASIN number you can find on each product’s site, like:

[asa]B07WRK2696[/asa]

Custom template ​

Furthermmore you can declare an individual template file within the first asa shortcode, like:

[asa tpl="mytemplate"]ASIN[/asa]

(notice the space after asa!)

You can create multiple template files and put them into the “tpl” folder in the plugin directory. Template files are simple HTML files with placeholders. See the Step by Step Guide for more info. Template files must have the extension “.htm” or “.html”. Use the filename without the extension for declaration within the asa shortcode. If you do not declare a template file, AmazonSimpleAdmin uses the default template (tpl/default.htm).

asa_collection ​

For embedding a whole collection of Amazon products into your post, use the collection shortcodes:

[asa_collection]my_collection[/asa_collection]

where “my_collection” between the tags stands for the collection label you have created in the collections section.

Custom template ​

Like with the simple ASIN shortcodes before, you can also use templates for collections. Declare your template file in the asa_collection tag, like this:

[asa_collection tpl="my_template"]my_collection[/asa_collection]

Collections options ​

KeyValue
limit(integer) How many collection items you want to display
typeThe type of display: - “latest”: Only the last added collection item (1 item) - “random”: Randomly ordered items - “all”: All collection items (Default)

You can combine these options, like:

[asa_collection tpl="my_template" limit=3 type="random"]my_collection[/asa_collection]

This example would display three random collection item.

ASA1 PHP functions ​

If you are looking for a highly customizable Amazon plugin for WordPress, take a look at ASA2 and ASA2’s PHP functions API.

ASA1 features the following functions, which can be used in your sidebar file or everywhere else in PHP code.

asa_item ​

void asa_item ( $asin [, string [$tpl]] )

Displays one item defined by $asin

  • asin Stands for the amazon ASIN
  • tpl
    Defines your template file. Default is “sidebar_item”

asa_get_item ​

string asa_get_item ( $asin [, string [$tpl]] )

Returns the rendered template.

  • asin Stands for the amazon ASIN
  • tpl
    Defines your template file. Default is “sidebar_item”

asa_collection ​

Displays one or more collection items.

void asa_collection ( $label [, string [$type], string [$tpl]] )
  • label
    The collection label
  • **type
    **Available options: all, latest
    “all” lists all collection items sorted by time of adding whereas “latest” only displays the latest added item. Default is “all”
  • **tpl
    **Defines your template file. Default is “collection_sidebar_default”

asa_get_collection ​

Returns the rendered collection.

string asa_get_collection ( $label [, string [$type], string [$tpl]] )
  • label
    The collection label
  • **type
    **Available options: all, latest
    “all” lists all collection items sorted by time of adding whereas “latest” only displays the latest added item. Default is “all”
  • **tpl
    **Defines your template file. Default is “collection_sidebar_default”

Custom Fields ​

You can easily combine ASA with WordPress’ custom field feature.

Custom page template ​

This is a simple example to give you an idea of the concept. It uses a custom page template. It is very easy to create a custom page for your theme. Refer to the WordPress codex if you are new to page templates: http://codex.wordpress.org/Page_Templates

For this example I call my custom page “ASA Custom Field”:

* Template Name: ASA Custom Field

Then I create a new page and select my new template:

custom_field_page_template

Below the page editor I enter a new custom field with name “ASIN”. The value is the ASIN of the product I want to include on this page.

custom_field

If you do not have this “Custom Fields” section on your page, you have to activate it in your screen option on top of the page:

custom_field_screen_options

Finally I have to include a PHP code snippet in my custom page template where I want to display the Amazon product:

<?php 
echo asa_get_item(get_post_meta($post->ID, 'ASIN', true), 'default');

The important part here is ‘ASIN’. This has to match the custom field’s name. If you want to use a custom ASA template, easily change ‘default’ to the filename of your template.

That’s it. Now the product will be shown where you included the PHP code. You can extend this example by adding more custom fields, custom ASA templates, PHP code conditions etc. Let your creativity run wild! 🙂

For a better flexibility when working with custom fields I recommend the plugin “ Advanced Custom Fields “.

ASA2 - The Amazon Affiliate Plugin for WordPress