Announcement

Collapse
No announcement yet.

Adding two product prices

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

  • mstella1
    replied
    Perfect!

    HTML Code:
    <mvt:do name="l.formatted_total_price" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, l.price_total )" />
    <p>Total Price: <mvt:eval expr="l.formatted_total_price" /></p>

    Leave a comment:


  • Nick
    replied
    mstella1 you can do something like this:

    https://docs.miva.com/developer/addi...rrency-format/

    Let me know if you have trouble getting it implemented.

    Leave a comment:


  • mstella1
    replied
    That worked! Thank you.

    Is there a way to display the formatted price so the 0 doesn't drop off of the end? This one comes out to $1.10 but displays as 1.1

    Leave a comment:


  • Nick
    replied
    mstella1 try this:

    Code:
    <mvt:do name="l.product_mmergemagnet" file="g.Module_Library_DB" value="Product_Load_Code('MMERGEMAGNET', l.settings:mmergemagnet)" />
    <mvt:do name="l.product_env_9_fom" file="g.Module_Library_DB" value="Product_Load_Code('ENV_9_FOM', l.settings:env_9_fom)" />
    <mvt:assign name="l.price_total" value="l.settings:mmergemagnet:price + l.settings:env_9_fom:price" />
    <p>Total Price: <mvt:eval expr="l.price_total" /></p>

    Leave a comment:


  • mstella1
    replied
    I was messing with this again and getting a 0 for the total. I did confirm the item code and they both have a price.

    Am I loading these incorrectly?

    HTML Code:
    <mvt:do name="l.product_mmergemagnet" file="g.Module_Library_DB" value="Product_Load_Code('MMERGEMAGNET', l.settings:product)" />
    <mvt:do name="l.product_env_9_fom" file="g.Module_Library_DB" value="Product_Load_Code('ENV_9_FOM', l.settings:product)" />
    
    <mvt:assign name="l.price_mmergemagnet" value="l.product_mmergemagnet:price" />
    <mvt:assign name="l.price_env_9_fom" value="l.product_env_9_fom:price" />
    <mvt:assign name="l.price_total" value="l.price_mmergemagnet + l.price_env_9_fom" />
    
    <p>Total Price: <mvt:eval expr="l.price_total" /></p>

    Leave a comment:


  • mstella1
    replied
    LOL! Serves me right trying to take a shortcut with AI. I'll start over and see how far I get. Sometimes tasks like this that I thought would take no time consume me :)

    Leave a comment:


  • ids
    replied
    Assumed this is MivaScript and not template code, you need to change MvtDo to MvDo. There appears to be other syntax errors too.

    If you're in template code, look up the MVT: for example:
    Code:
    <mvt:assign name...
    Scott

    Leave a comment:


  • mstella1
    started a topic Adding two product prices

    Adding two product prices

    Looking for a little help with the script below.

    Just trying to add two products prices together to display on a page ultimately saving me countless hours of changes whenever the post office does their price increases every 6 months.

    The two product codes are below. TIA!

    HTML Code:
    <MvASSIGN NAME="l.product_code1" VALUE="'MMERGEMAGNET'">
    <MvASSIGN NAME="l.product_code2" VALUE="'ENV_9_FOM'">
    
    <MvtDO NAME="l.return" FILE="g.Module_Library_DB" VALUE="Product_Load_Code(l.product_code1, l.settings:product)">
    <MvASSIGN NAME="l.product1_price" VALUE="l.return:price">
    
    <MvtDO NAME="l.return" FILE="g.Module_Library_DB" VALUE="Product_Load_Code(l.product_code2, l.settings:product)">
    <MvASSIGN NAME="l.product2_price" VALUE="l.return:price">
    
    <MvASSIGN NAME="l.total_price" VALUE="l.product1_price + l.product2_price">
    
    Total Price: $<MvEVAL EXPR="l.total_price">
Working...
X