Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

So examples are listed in the table below.

Parameter

Description

gold,1,0

one ounce gold bar with no markup

silver,1,0

one ounce silver bar with no markup

gold,1,0.05

one ounce gold bar with 5% markup

silver,1,0.20,0.02

one ounce silver coin with a 20% retail markup, but a 2% discount for wholesale pricing tiers.

Note

If you turn off real-time pricing for an item that is in a customer's shopping cart, the shopping cart item will retain the last know real-time price retrieved.

...

It is important to let the customer know they have a limited amount of time to complete their checkout.  Below is a snippet of Velocity code that will tell the customer how much time they have to complete their order before the pricing will be updated. 

Code Block
themeDJango

#if ($cart.getTimeUntilRealtimePriceUpdate() != "")
  The prices in your cart are good for another ${cart.getTimeUntilRealtimePriceUpdate()}.  If you do not complete your order within this amount of the prices will automatically update to the latest market prices.<br/><br/>
#end

...

You would insert this into the View Cart page of your screen branding located at:

Panel

Main Menu
Configuration
Screen Branding Themes
[edit]
Screens View Cart [edit]

Below is a screen shot of how the code looks inside of the view cart header.

...

If you want to interact directly with the real-time pricing provider you can use the Velocity object provider.  The sample code below shows how to display the current spot price of gold and silver on the website.

Code Block
themeDJango

The current spot price for gold is: $realtimePricingProviderManager.getPriceLocalized("Xignite USD", "n/a", "gold,1,0", "USD")<br/>
The current spot price for silver is: $realtimePricingProviderManager.getPriceLocalized("Xignite USD", "n/a", "silver,1,0", "USD")<br/><br/>

...

In the precious metals market there are sometimes very violent moves at any given time of day or night.  In order to protect against too fast of a moving market we can complete the current price of the gold or silver the high/low over the past 24 hours and close the store if necessary.  Below is some sample code that can be placed into the screen branding to look at the price of gold/silver and then decide to close the store.

Code Block
themeDJango

#set($shutStore = false)
#if ($realtimePricingProviderManager.getPriceMovementPercentage("Xignite USD", "n/a", "gold,1,0", "USD",86400).compareTo($formatHelper.parseBigDecimal("0.10")) >= 0)
  #set($shutStore = true)
#end
#if ($realtimePricingProviderManager.getPriceMovementPercentage("Xignite USD", "n/a", "silver,1,0", "USD",86400).compareTo($formatHelper.parseBigDecimal("0.10")) >= 0)
  #set($shutStore = true)
#end

#if ($shutStore)
  Excessive movement in gold or silver.  <br/><br/>
#else
  Movement of precious metal within tolerable range.  Store is open.<br/><br/>
#end

...

It is not a matter of if a real-time pricing provider will have issues, but when. If you code your catalog properly you can redirect the customer to a page letting them know the store is temporarily closed. To do this you want to put a small piece of Velocity code in one of your headers that looks like this:

Code Block
themeDJango

#if (!$realtimePricingProviderManager.isCachedHealthy("Xignite USD"))
  #set($redirectUrl = "/down.html")
#end

This will see if the pricing provider is healthy enough for the cached prices used by the catalog. Since the checkout is more price sensitive you can also use code like this in the screen branding header of the checkout:

Code Block
themeDJango

#if (!$realtimePricingProviderManager.isRealtimeHealthy("Xignite USD"))
  <meta http-equiv="refresh" content="0;URL='/down.html'" />
#end

...