Shortcodes

Single Product Shortcodes

Single product shortcodes are intended for the Loop section of the Advanced Widget. The Loop runs for each product that will be displayed in your widget. This means all products from all PCU ID's from all of the custom fields you enter into the "Custom Field for Unit ID" field. Since each time the Loop section is triggered it references a single product, the shortcodes within this section will return information from a single product as well.

[cpc_logo_url] - URL for the merchant's logo (you need to add your own img tag to display the logo as an image)
[cpc_merchant_name] - Merchant name
[cpc_affiliate_url] - URL for the product's affiliate link
[cpc_product_name] - Product name
[cpc_product_price] - Price of product (number only). Optional parameter: decimal - number of decimal places to round off to (default 2).
[cpc_first_line] - This is a conditional shortcode used for any code you wish to be displayed only on the first product in the loop (for instance if you would like to style the cheapest product differently from the rest). To use this shortcode, simply place the code that is meant just for the first line in between [cpc_first_line] and [/cpc_first_line].

Product Aggregate Shortcodes

Product aggregate shortcodes are intended for use in the areas that surround the Loop in the Advanced Widget (HTML Before, HTML Before Unit, HTML After & HTML After Unit) or in the body of your post.

Since the shortcode is based on multiple products, the output will depend on where you call place it:

HTML Before & HTML After - these two fields are executed once per widget and represent an aggregation of the entire widget. Therefore, by defualt the output of the shortcode will be based on all of the products that appear in the widget (even it the widget contains multiple units).

HTML Before Unit & HTML After Unit - these two fields are executed for each of the custom fields you define for the widget. Therefore, by default the output of a shortcode placed in these fields are limited to the products contained in the current unit.

Content of Post - by default the output of a shortcode placed within the content of a post (or page) is based on the PCU ID's contained in the 'pcuid' custom field.

Overriding Defaults - If you would like to all an aggregate shortcode and base the output on a different set of products, you can ovverride the default scope by using the 'custom_field' and 'pcuid' parameters. For instance to display the number of products based on a custom field named 'alt_pcuid', use [cpc_unit_count custom_field=alt_pcuid]. You can also enter multiple values such as [cpc_unit_count pcuid=alt_pcuid,other_pcuid]. Please note, the pcuid parameter has precedence over the custom_field parameter in case both are entered.

[cpc_unit_count] - Number of merchants\products available.
[cpc_unit_title] - The CompariPress Unit Display Name for the PCU
[cpc_max_price] - Price of the highest priced product
[cpc_min_price] - Price of the lowest priced product
[cpc_max_affiliate_url] - Affiliate URL for the highest priced product
[cpc_min_affiliate_url] - Affiliate URL for the lowest priced product
[cpc_max_merchant_name] - Merchant name for the highest priced product
[cpc_min_merchant_name] - Merchant name for the lowest priced product
[cpc_max_logo_url] - URL for the merchant's logo of the highest priced product
[cpc_min_logo_url] - URL for the merchant's logo of the lowest priced product

OfficeFolders theme by Themocracy