Cost difference using Toolkit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kwi_sky
    Mivite

    • Feb 2010
    • 112

    #1

    Cost difference using Toolkit

    I am using Toolkit in our dev store and trying to get this feature working like it does on our live store. It is supposed to take the amount in the cost field and make it show up as savings with the word Savings in red and the Retail price crossed out. Any thoughts as to what I am doing wrong?

    <mvt:if expr="l.settings:product:cost GT l.settings:product:price">
    <mvt:item name="toolkit" param="math_subtract|difference|l.all_settings:pro duct:cost|l.all_settings:product:price" />
    <mvt:item name="toolkit" param="currencyformat|formatted_difference|savings " />
    <b>Retail Price:</b> <s>&mvt:product:formatted_cost;</s><br>
    <font color="red"><b>Savings:</b> &mvte:global:formatted_savings;</font><br>

    <mvt:else>
    Our Price: <b>&mvt:product:formatted_price;</b><br>
    </mvt:if>
    <!--<mvt:if expr="l.settings:product:weight NE 0">
    Shipping Weight: <b>&mvt:product:weight;</b> &mvt:store:wtunits;<br>
    </mvt:if>-->
    <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :Author">
    &mvt:customfield_names:customfields:Author;:
    <b>&mvt:product:customfield_values:customfields:Au thor;</b><br>
    </mvt:if>
    <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :Musician">
    &mvt:customfield_names:customfields:Musician;:
    <b>&mvt:product:customfield_values:customfields:Mu sician;</b><br>
    </mvt:if>
    <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :Speaker">
    &mvt:customfield_names:customfields:Speaker;:
    <b>&mvt:product:customfield_values:customfields:Sp eaker;</b><br>

    </mvt:if>
    <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :Retail">
    &mvt:customfield_names:customfields:Retail;:
    <b>&mvt:product:customfield_values:customfields:Re tail;</b><br>
    </mvt:if><br>

  • kayakbabe
    Mega Mivite




    • Jun 2008
    • 1520

    #2
    should these two lines share a common variable name?

    <mvt:item name="toolkit" param="math_subtract|difference|l.all_settings:pro duct:cost|l.all_settings:product:price" />
    <mvt:item name="toolkit" param="currencyformat|formatted_difference|savings " />

    Comment

    • kwi_sky
      Mivite

      • Feb 2010
      • 112

      #3
      I no clue what that means... a common variable name. All I know is that it works on our live store, using the amount in the Cost field.

      Comment

      • Bruce - PhosphorMedia
        Developer Partner











        • Mar 2006
        • 11257

        #4
        Use this:

        <mvt:if expr="l.settings:product:cost GT l.settings:product:price">
        <mvt:assign name="g.savings" value="l.settings:product:cost - l.settings:products:price"/>
        <mvt:do name="g.savingsFormatted" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, g.savings )" />
        <b>Retail Price:</b> <s>&mvt:product:formatted_cost;</s><br>
        <font color="red"><b>Savings:</b> &mvte:global:savingsFormatted;</font><br>

        <mvt:else>

        ALSO, no idea why you are using

        &mvt:customfield_names:customfields:Author;:

        You can just use:

        Author:
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment

        • kwi_sky
          Mivite

          • Feb 2010
          • 112

          #5
          Thank you SO Much! You have no idea how long I have been trying to get this to work. I went back to the original page and was trying to set up the Price Groups thinking that would show the price difference but I couldn't get that to work either.

          If I just use Author: then the word Author does not show up like this "Author: John Doe". Only the name shows up. I want the word Author to show up too.

          Hey can I use this same code other places like the storefront page and the category list page so it ends up looking something like this below?
          screenshot.JPG

          Comment

          • Bruce - PhosphorMedia
            Developer Partner











            • Mar 2006
            • 11257

            #6
            You should be able to use this anywhere, however, the actual name of the fields (l.e., l.settings:product:price) MAY be different.

            As for the custom field usage, I was referring to changing this:

            &mvt:customfield_names:customfields:Author;:
            <b>&mvt:product:customfield_values:customfields: Au thor;</b><br>

            to this:

            Author: <b>&mvt:product:customfield_values:customfields: Au thor;</b><br>

            As for:

            You have no idea how long I have been trying to get this to work.
            We actually do, that's why we encourage store owners to be store owners and let developers do development :)

            That coding took literally 30 seconds...which in the real world, might have cost about $20 to hire a developer to do. (And, for example, if you where a ongoing client of ours, probably would have been charged even less because we'd already have things like site Access and billing established.)
            Last edited by Bruce - PhosphorMedia; 03-01-17, 11:35 AM.
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment

            • kwi_sky
              Mivite

              • Feb 2010
              • 112

              #7
              Something is still not right with the code as it is not showing the difference but instead showing the retail price (Cost field) as the savings instead of subtracting from the Price field.
              screenshot.JPG

              Comment

              • kwi_sky
                Mivite

                • Feb 2010
                • 112

                #8
                This code change worked. Thanks! I changed the code for all the custom fields to this same format.


                Author: <b>&mvt:product:customfield_values:customfields: Author;</b><br>

                Comment

                • Bruce - PhosphorMedia
                  Developer Partner











                  • Mar 2006
                  • 11257

                  #9
                  sorry...typo

                  l.settings:products:price

                  should be

                  l.settings:product:price

                  Bruce Golub
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment

                  • kwi_sky
                    Mivite

                    • Feb 2010
                    • 112

                    #10
                    Awesome! Thanks! That fixed it.

                    Comment

                    Working...
                    X