Site Menu

Miva Merchant Precision Price Display Problem and How To Fix It

The Miva Merchant 10.11.01 update adds precision pricing for those who need it... and for those who don't. Here's how to fix your price display until the next update.

The new precision weight/pricing feature for Miva Merchant is a good thing if you're selling screws and need to show smaller than .01 prices. The problem is that precision pricing is affecting everyone who uses discounts, not just people using precision weight.

by Scot Ranney

Precision prices are creating quite the problem for discount price display after Miva Merchant 10.11.01 update for a lot of store owners.

Discounts are showing prices like $12.330123 instead of $12.33 on the CTGY, PROD, SRCH  and possibly INVC and some email templates, among others.

So how do we fix this? One way is to create a readytheme content section that will adjust the formatted price which is used to display the price.

Step 1. Make a New Readytheme Content Section

Go to:

USER INTERFACE > THEME COMPONENTS > CONTENT SECTIONS

Click the blue button, Add Content Section

Name: Function: Price Format for 2 Decimal Places

Code: function_price_format

Content:

<mvt:if expr="l.settings:product:price">
	<mvt:do file="g.Module_Store_Module_Currency" name="l.settings:product:formatted_price" value="CurrencyModule_AddFormatting(l.settings:module, (l.settings:product:price ROUND 2))" />
</mvt:if>

Wrap In a DIV Tag: OFF

Step 2: Using this in a Page

The code below refers to the Shadows framework but will work in any Miva Merchant framework.

Usually the product price variable is l.settings:product:price however there may be cases when it's in some other variable. If this happens the condition above can easily be updated to include other price variables. If you need help with this let us know. 

The code below works on the PROD, CTGY, and SRCH templates. The precision bug appears to affect discounted prices so find the <s> tag and use this function there. 

.....

	<mvt:if expr="l.settings:product:base_price GT l.settings:product:price">
		<span class="x-product-list__price u-color-gray-30"><s>&mvt:product:formatted_base_price;</s></span>
<mvt:comment>
#
# fixes decimal problem
#
</mvt:comment>
		<mvt:item name="readytheme" param="contentsection( 'function_price_format' )" />

		<span class="x-product-list__price u-color-red">&mvt:product:formatted_price;</span>
	<mvt:else>	
		<span class="x-product-list__price">&mvt:product:formatted_price;</span>
	</mvt:if>

.....

Related Articles

These articles might be interesting for you as well:

This page might use cookies if your analytics vendor requires them.