Announcement

Collapse
No announcement yet.

Toolbelt and Precision Pricing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Toolbelt and Precision Pricing

    Many, many years ago (at least 15) I created a "Specials" page here: https://www.abbeyarchery.com.au/c/adha/SPECIALS.html
    in the form of: Regular Price, Sale Price, You Save.

    It all worked great until recently. Now, the pricing displays three decimal places e.g:

    Regular Price: $2,399.95
    Sale Price: $1,999.954
    You Save: $399.996

    We want the pricing format to be "standard" i.e. to 2 decimal places (as it was since inception) i.e

    Regular Price: $2,399.95
    Sale Price: $1,999.95
    You Save: $400.00

    This problem seems to coincide with the implementation of precision pricing. I tried to uninstall precision pricing but it seems I can't (and I probably don't want to).

    I created that page using Toolbelt. The Toolbelt instructions seem to have disappeared and it is many years since I looked at them anyway. So, I am stuck.

    Here is the code from the Specials page:

    <mvt:item name="ry_toolbelt" param="currencyformat|g.regprice|l.all_settings:pr od:cost" />
    Regular Price: <s>&mvt:global:regprice;</s><br>
    <mvt:item name="ry_toolbelt" param="assign|g.specincgst|l.all_settings:prod:pri ce * 1.1" />
    <mvt:item name="ry_toolbelt" param="currencyformat|g.specincgstf|g.specincgst" />
    Sale Price: &mvt:global:specincgstf; incl. GST <br>
    <mvt:item name="ry_toolbelt" param="assign|g.regprice|l.all_settings:prod:cost" />
    <mvt:item name="ry_toolbelt" param="currencyformat|g.saving|g.regprice - g.specincgst" />
    <span class="blue">You Save: &mvt:global:saving; </span>

    I would have thought that "currencyformat" would have ensured this calculation was to two decimal places, but it seems not.

    Any suggestions on how to fix this issue would be appreciated.

    In case it is not clear, this is just a marketing issue i.e. the "Sale Price" is the changed retail price, in Miva, and this is what the customer is charged. The You Save calculation is just marketing, to show customers how much they are saving on the old price.



    Pete

    #2
    Pete McNamara Precision Pricing is not a module that can be uninstalled as it is apart of the core software.

    The currency format function that the module is using is probably using something like this, https://docs.miva.com/developer/addi...rrency-format/, which just formats the price to have the currency symbol that the store is setup for and does not round the price.

    As a workaround you can use the Round_Item_Total function that was added with Precision Pricing: https://docs.miva.com/developer/deve...ng-adjustments

    You should be able to do something like this to get the values rounded:

    <mvt:do file="g.Module_Library_Utilities" name="l.settings:item:price_rounded" value="Round_Item_Total( l.all_settings:prod:cost )" />
    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      Overnight, the Toolbelt instructions seemed to reappear so I first tried using the Toolbelt ROUND function in the Assign expression but could not get it to work.

      I then tried the code you suggested above but it had no effect. Obviously I am doing something wrong or not doing something that is required. Where, in the above code, should I insert your code?

      Comment


        #4
        Hi Pete,

        You should be able to do this without the Toolbelt.

        It looks like you're using the cost field as a token-holder (the good old days).

        Let me know if it works or if you need any help.


        Code:
        <mvt:do file="g.module_library_utilities" name="g.regprice" value="Round_Item_Total(l.settings:prod:cost)" />
        <mvt:do name="g.formatted_regprice" file="g.module_store_module_currency" value="CurrencyModule_AddFormatting( g.module_store_module_currency, g.regprice )" />
        Regular Price: <s>&mvt:global:formatted_regprice;</s><br>
        <mvt:do file="g.module_library_utilities" name="g.specincgstf" value="Round_Item_Total(l.settings:prod:price * 1.1)" />
        <mvt:do name="g.formatted_specincgstf" file="g.module_store_module_currency" value="CurrencyModule_AddFormatting( g.module_store_module_currency, g.specincgstf )" />
        Sale Price: &mvt:global:formatted_specincgstf; incl. GST <br>
        <mvt:assign name="g.saving" value="g.regprice - g.specincgst" />
        <mvt:do name="g.formatted_saving" file="g.module_store_module_currency" value="CurrencyModule_AddFormatting( g.module_store_module_currency, g.saving )" />
        <span class="blue">You Save: &mvt:global:formatted_saving; </span>

        http://www.alphabetsigns.com/

        Comment

        Working...
        X