PharmacyWire shortcodes

Shortcodes are a feature of WordPress that allows a tag to be inserted into post content to embed some functionality in that content. The PharmacyWire WordPress plugin features several shortcodes that can be used as follows:

Search Form Shortcode

[PharmacyWire searchform="search"]

Displays the default search form for customers to search for products. As with most WordPress shortcodes this can be used in PHP in conjunction with do_shortcode():

<?php echo do_shortcode('[PharmacyWire searchform="search"]'); ?>

Search Shortcode

[PharmacyWire search="<search term>" {filter="brand|generic"} {rxrequired="yes|no|both"} {country="ISO"} {strength=<strength>} {match=<regex>} {tier=<lt|le|gt|ge> #} {template=<template name>} {ingredients=<ingredient list>} {dosageform=<dosage form>}]

Embeds a list of products that match the <search term>, and any other products that have the same active ingredient. Each product package listed will have a ‘Buy’ link using the site theme to add the product to their cart.

Additional parameters can be used to filter the results even further:

  • search – search for products by  <search term>. The search term can be the drug name or partial name which will return all matching drug names. Or for more specific searches you can use the drug ID (eg. D-1111) or drug package ID (eg. DP-11111). Multiple Drug ID / Drug Package ID can be used in a comma separated list.
  • filter – this keyword will limit the results to either brand or generic drugs only
  • rxrequired – can show only prescription items; only OTC items; or both (the default when this keyword is not used)
  • strength – limit the results to only the strength indicated – ex. ‘5mg’, ‘100u/mL’, etc.
  • match – in some cases, matching ingredient results are too broad, so the match keyword is used to filter the results to more accurately represent what the content writer wishes to display. This is a regular expression field, so please contact us if you need additional help configuring these
  • tier – this is useful in particular with the new drug package ID search, or other cases where you might only want to show a certain number of tiers in a custom template.  It can handle: gt, ge, lt, le (greater than, greater than or equal to, less than, less than or equal to), no operator assumes ‘equal to’. For example, [PharmacyWire drug="DP-2342" tier="1"] will show the first tier of product pricing. [PharmacyWire drug="DP-2342" tier="le 3"] would show up to 3 tiers of pricing that are setup on a package in PharmacyWire.
  • template – To use a custom template on a shortcode in lieue of the default plugin/theme templates, you can define the template within the shortcode <template name> and place the PHTML template within your {Theme Name}/pharmacywire/templates/ directory. Shortcode example: [PharmacyWire Search="DP-13411" template="page_search_topseller"] points to a template file: {Theme Name}/pharmacywire/templates/page_search_topseller.phtml.
    To add a custom empty result template for display if the custom search template returns no result, you would name the template the same as the custom template with _empty on the end. Eg. {Theme Name}/pharmacywire/templates/page_search_topseller_empty.phtml

Example: [PharmacyWire drug="zocor"]

Ingredient Shortcode

[PharmacyWire ingredient="<drug ingredients>"]

Embeds a list of products that use the <drug ingredients> ingredient in the drug composition. Each product package listed will have a ‘Buy’ link using the site theme to add the product to their cart if all products have identical ingredient compositions. If the drugs have different ingredient compositions, some of which use the specified <drugname>, then the drugs will be listed with links to the appropriate products.

Example: [PharmacyWire ingredient="Janumet"]

Dosage Form Shortcode

[PharmacyWire ingredient="<drug ingredient list>" dosageform="<dosage form list>"]

Embeds a list of products that use the <drug ingredients> and that match the dosage form (exactly) as entered in PharmacyWire.

Example: [PharmacyWire ingredient="Janumet" dosageform="Pill; Oral"]

Can also be used with the standard search.

Example:[PharmacyWire search="premarin" dosageform="Pill; Oral"]

Condition Shortcode

[PharmacyWire condition="<condition>" {related="<drugname>" limit="<number>"}]

Generates a list of links to all products that can be used to treat the <condition> specified.

Use the ‘related’ keyword to show all drugs of ‘condition’ that are related to the specified ‘drugname’. Provides the ability to link to other drugs of a similar type to the one being described on a specific page and ensure that the drug on the page is not included on the list. By adding ‘limit’, only the ‘number’ of drugs will be shown.

Example: [PharmacyWire condition="cholesterol"]

Pharmacy Store Info Shortcode

[PharmacyWire storeinfo="<keyword>"]

Display one of the store parameters configured with the PharmacyWire plugin. This short code is used to ensure consistent use of the store name, address, phone and other contact information throughout the site. Allowed keywords are as follows:

  • name – store name
  • pharmacy – name of the pharmacy of record
  • license – pharmacy license number for the pharmacy of record
  • address – mailing address of the store
  • city – city of the store
  • province – province of the store (may also use ‘state’ for this keyword)
  • country – country where the store is located
  • postalcode – postal code of the store mailing address
  • phone_area – area code of the primary contact phone number
  • phone – primary contact phone number
  • fax_area – area code of the primary contact fax number
  • fax – primary contact fax number
  • email – email address to use to contact customer service

Example: [PharmacyWire storeinfo="name"]

User Info Shortcode

[PharmacyWire userinfo="<keyword>"]

Display one of the values associated with the currently logged in user. This can be used to customize a given page for logged in users, and should be combined with the [PharmacyWire unlessuser=”<url>”] tag to ensure that anonymous users are not presented with text that has gaps because the user information is not present. Allowed keywords are as follows:

  • username – username of the logged in user
  • name – user’s full name
  • firstname – user’s first name(s)
  • lastname – user’s last name
  • address1 – first address field
  • address2 – second address field
  • address3 – third address field
  • city – city the user;s primary billing address
  • province – province of the user’s billing address (may also use ‘state’ for this keyword)
  • country – country for the user
  • postalcode – postal code of the user billing address
  • phone_area – area code of the primary contact phone number
  • phone – primary contact phone number
  • email – email address to use to contact customer service

Example: [PharmacyWire userinfo="name"]

User Conditional Shortcodes

[PharmacyWire ifuser="<url>"]
[PharmacyWire unlessuser="<url>"]

Provides a simple mechanism for a non-programmer to show different pages to logged in users versus anonymous users. In the first case, if there is a user logged in, the page will redirect to the given <url>, while anonymous users will be shown the content on the page. In the second case, logged in users will be shown the content on the page, while anonymous users will be redirected to the given <url>.

Example: [PharmacyWire ifuser="/refill-order/"]

[PharmacyWire login="<true>"]

Provide a page to show the standard login form for a user. Note that the login form is automatically part of the checkout process, so this page is not strictly necessary, but many sites prefer to have this available for users to login to check their profile, and see their order status.

Example: [PharmacyWire login="true"]

[PharmacyWire logout="<true>"]

Once the user wants to end their session, they will typically look for a logout page. By providing a link to a page that contains this shortcode, you will be able to provide a mechanism for them to abandon their session.

Example: [PharmacyWire logout="true"]

Widget Shortcodes

The use of the PharmacyWire Block Widgets is highly recommended as they are the ones that will receive updates and new features in the future. They can be incorporated within specified sidebar areas using the WordPress Widgets page, and other block areas.

For PHP templates via, they can be added using their namespace:

PharmacyWire Cart (Summary Block)

$content = '<!-- wp:wp-pharmacywire/pw-cart /-->';
echo apply_filters('the_content', $content);

PharmacyWire Account Tools (Block)

$content = '<!-- wp:wp-pharmacywire/pw-account-tools /-->';
echo apply_filters('the_content', $content);

Legacy Widgets (deprecated):

These are still supported, but may be removed in the near future.

[PharmacyWire widget="account tools" options="<options">]

Shortcode to display the ‘Ajax Account Tools’ widget. This displays the account menu (Create account/account, login/logout, & the cart link with item count) after the page has finished loading via ajax as well as after an order is submitted it will update to show that you are now logged in & cart empty. Elements can be shown/hidden within the options and the menu displayed as vertical or horizontal. Available options: hide_heading, vertical_menu, hide_account, hide_login, hide_cart.

Multiple options may be set using a semicolon as the delimiter.

Example with options:

[PharmacyWire widget="account tools" options="hide_heading;hide_cart"]

[PharmacyWire widget="shopping cart"]

‘Ajax Shopping Cart’ widget shortcode. Displays the cart details after the page has finished loading via ajax.