.. include:: _include.rst .. highlight:: bbcode .. _shortcodes_asa2: ##################### [asa2] ##################### .. include:: _include_local_toc.rst ************ Introduction ************ With the shortcode ``[asa2]`` you can display single products. With the option ``tpl`` you can set the template that will be used for the display. Otherwise the template defined as default will be used. *********** Basic usage *********** For Amazon product you can use the ASIN inside the the shortcode tags. .. code:: [asa2]ASIN[/asa2] The better and newer variant is to address the products by ID, provided that the product is stored in the |repo| section. .. code:: [asa2 id="42" /] // Using a template different from the default: [asa2 id="42" tpl="Flat_box_vertical" /] .. _shortcodes_asa2_options: ******* Options ******* ajax ~~~~ If you deactivate AJAX globally in the options, you can decide to load single products via AJAX by using the ``ajax`` option. .. code:: [asa2 ajax="1"]B0094J2BZ0[/asa2] .. _shortcodes_asa2_associate_id_set: associate_id_set ~~~~~~~~~~~~~~~~~ Defines which Associate ID set to use for internationalized products. The Associate ID of the product's country code will be used if it was found in the set. .. note:: Option ``tracking_id`` is dominant, meaning that if you set ``tracking_id``, this ID will be used and ``associate_id_set`` will be ignored. .. code:: [asa2 associate_id_set="my-i18n-ids"]B0094J2BZ0[/asa2] country_code ~~~~~~~~~~~~ With the option ``country_code`` you can define the Amazon country store you want to embed the product from. .. note:: You can use different stores on the same page. Supported country codes are: |stores|. .. code:: [asa2 country_code="BR"]B00BGA9WK2[/asa2] [asa2 country_code="CA"]B00BGA9WK2[/asa2] [asa2 country_code="CN"]B00RQ25LQI[/asa2] [asa2 country_code="DE"]B00BIYAO3K[/asa2] [asa2 country_code="ES"]B00BIYAO3K[/asa2] [asa2 country_code="FR"]B00BIYAO3K[/asa2] [asa2 country_code="IN"]B00BIYAO3K[/asa2] [asa2 country_code="IT"]B00BIYAO3K[/asa2] [asa2 country_code="JP"]B00O0Y0LR4[/asa2] [asa2 country_code="MX"]B00O0Y0LR4[/asa2] [asa2 country_code="UK"]B00BE4HOIM[/asa2] [asa2 country_code="US"]B00BGA9WK2[/asa2] custom_rating ~~~~~~~~~~~~~ Can be used to display the rating stars image with a custom rating. Place it in a template with placeholder {{ CustomRating }}. Allowed values are: 0, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5 Examples: .. code:: [asa2 custom_rating="4"]B0094J2BZ0[/asa2] [asa2 custom_rating="3.5"]B0094J2BZ0[/asa2] disabled ~~~~~~~~ If you want to hide a product temporarily but not to delete the whole shortcode, you can use option ``disabled``. If it is set to 1, the shortcode will not be rendered. .. code:: [asa2 disabled="1"]B0094J2BZ0[/asa2] .. _shortcodes_asa2_opt_img: id ~~~~~~~ With this option, connect the shortcode to the product. The advantage is that the displayed product will change if you should change the article in your |repo| section, e.g. if the original product is no longer available. If it is an Amazon product, specifying an ASIN is no longer necessary. .. code:: [asa2 id="1404" /] img ~~~ With the option "img" you can specify an alternative main image. This only works if the product has multiple images. The value must be a number. 0 stands for the standard image, from 1 the alternative images start. .. code:: [asa2 img="1"]B07QPVNPB3[/asa2] .. _shortcodes_asa2_tpl: mobile_tpl ~~~~~~~~~~ With option ``mobile_tpl`` you can define a template which will be used on mobile devices (Smartphones). Note that option :ref:`options_templates_mobile` has to be activated before this will work. .. code:: [asa2 tpl="my_desktop_template" mobile_tpl="my_template_for_smartphones"]ASIN[/asa2] more_info_button ~~~~~~~~~~~~~~~~ With this option you can explicitly disable the :ref:`create_amazon_product_more_info_url` button for a template that supports it. .. code:: [asa2 tpl="Robust" more_info_button="0"]ASIN[/asa2] no_cache ~~~~~~~~ The ``no_cache`` option will prevent the product from being loaded from cache. This is useful if you want to test template updates in the frontend. In production you should not use it. .. code:: [asa2 no_cache="1"]B0094J2BZ0[/asa2] official_cart_button_img ~~~~~~~~~~~~~~~~~~~~~~~~ If you use the official cart buttons, you can overwrite which button image to use with this shortcode option. Available button images are "buy1.gif", "buy2.gif", "buy3.gif", "buy4.gif", "buy5.gif", "buy6.gif". For more details, see option :ref:`option_cart_button_image` short_url ~~~~~~~~~ Use the option ``short_url`` to transform the Amazon page URL into a shorter format. .. code:: [asa2 short_url="1"]B0094J2BZ0[/asa2] // results in: http://www.amazon.de/exec/obidos/ASIN/B0094J2BZ0/tracking-id This may be combined with a custom tracking ID of course: .. code:: [asa2 short_url="1" tracking_id="other-id"]B0094J2BZ0[/asa2] // results in: http://www.amazon.de/exec/obidos/ASIN/B0094J2BZ0/other-id .. _shortcodes_asa2_opt_tpl: title ~~~~~~ With the option ``title`` you can define a custom title to display in a product box. This can be useful if you want to test whether another title generates more clicks. It can be used like this: .. code:: [asa2 id=123 title="One time used product title" /] tpl ~~~ If you want to define a template by its name, use the ``tpl`` option. .. code:: [asa2 tpl="my_awsome_template"]B0094J2BZ0[/asa2] .. _shortcodes_asa2_tplid: tplid ~~~~~ If you want to define a template by its ID, use the ``tplid`` option. You can find the ID in the first column of the template table. Using the template ID allows you to change the template's name afterwards. .. code:: [asa2 tplid="16"]B0094J2BZ0[/asa2] .. image:: _static/templates_col_id.jpg :height: 267px :width: 527px :scale: 100% :alt: Templates table column ID tracking_id ~~~~~~~~~~~ Custom Associate ID .. code:: [asa2 tracking_id="other-id"]B0094J2BZ0[/asa2] value ~~~~~ Instead of a template, just a single value of the product can be rendered by using the option ``value``. A value can be any of the available :ref:`placeholders` **without** the placeholder delimiter {{ }}. This example shortcode would display the product title: .. code:: [asa2 value="Title"]B0094J2BZ0[/asa2] You can combine the value with :ref:`template_filters`. For example, to display the release date of a product in a custom date format, use this shortcode: .. code:: [asa2 value="ReleaseDate|date('m/d/Y')"]B0094J2BZ0[/asa2] The :ref:`product_picker` supports the ``value`` option. On tab "Shortcode", choose "Single value" and select the placeholder from the drop down menu. .. image:: _static/shortcode_asa2_value_picker.png :height: 516px :width: 552px :scale: 100% :alt: Product Picker value selection ************* Custom Values ************* Additionally to the shortcode options, you can also define custom values to use as placeholders in templates. It is very easy. Just define a unique shortcode option with a value and use the exact same option name as placeholder in a template. .. code:: [asa2 my_custom_text="Banana!"]B0094J2BZ0[/asa2] # use placeholder {{ my_custom_text }} in your template