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


          #5
          Many thanks Dan. Apologies for the delay, but I have been out of town or otherwise unavailable.

          I just tried your code and it has made no difference. The results are exactly the same.

          Some background: GST must be included in the displayed RRP, unlike sales tax in the US, which is added later. Most of our customers are charged the GST inclusive price but some are not. In Miva, GST is charged in the checkout so we use the cost field as a token, ie for displaying the GST inclusive price and the price field is the GST exclusive price. Note that both the product cost and product price fields are entered at the time a product is added i.e. product cost is not a function of product price i.e. is just a token. For specials, we only change the product price to the new lower GST exclusive price. We leave the product cost as originally entered, so this shows the original price including GST. In the checkout, Miva calculates the new lower GST just as it calculates GST for all other products, based on the new lower product price field.

          On the Specials page, we show or should show the product cost field as the regular price, we calculate the new lower displayed price (i.e. Sale Price) by multiplying the product price variable by 1.1 (GST is 10%). Then, in the code, we deduct the new lower price inc GST (Sale Price) from the product cost variable (which remains unchanged from the initial input to the store) (Regular Price) to calculate the saving (You Save).

          The product cost is already correctly formatted in Miva at 2 decimal places and so is the product price. Our problem comes from the GST calculation on this Specials page because it now calculates to 3 decimal places, a feature which is/was never required or wanted.


          Comment

          Working...
          X