ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

grabbing a field entry value and modifying it for a different purpose

February 13, 2013 9:59pm

Subscribe [2]
  • #1 / Feb 13, 2013 9:59pm

    ralph.m

    225 posts

    I have some fields that feed into a PayPal form, one being {price}. Now the need is to create a second form on the same page with a different price, which is always a certain amout greater than the original price (e.g. $10 more).

    The aim is to make use of the original {price} to create the new price, rather than having to go through all entries (hundreds of them) adding in a new value in a new field.

    I’m no programmer, but all I could think of was to create a PHP variable from the {price} field, then add the extra amount and output the variable in a new form. I couldn’t get it to work, though. I set the PHP to run on output, but it still baulked at the EE code. E.g. it rejected the { here:

    <?php $newPrice = {price} + 10; ?>

    Does anyone know a way to create a new value based on what’s already in {price}?

  • #2 / Feb 14, 2013 1:08am

    ahmad saad

    364 posts

    give a look to http://www.eec.ms/add-ons/mx-calculator and http://www.eec.ms/index.php/eecms2/add-ons/mx-jumper

    i think this two addons will help u.

  • #3 / Feb 14, 2013 1:39am

    ralph.m

    225 posts

    Thanks ahmad. They look interesting, but I wasn’t able to see how they might help with this issue.

  • #4 / Feb 14, 2013 2:17am

    ahmad saad

    364 posts

    mx-jumper for definea variable and ms-clculator to do the math thing you want.

  • #5 / Feb 14, 2013 2:38am

    ralph.m

    225 posts

    Ah, I see, both together. Unfortunately, the docs are the usual arcane developer stuff with no explanation.

    “mx-jumper for define a variable”

    How?

  • #6 / Feb 14, 2013 3:34am

    ahmad saad

    364 posts

    you can find a full doc here http://www.eec.ms/user_guide/mx-jumper/tags.html#lv19

    simply if you want to get a val from a channel entries loop you must use {exp:mx_jumper:put_groupt} like this:

    {exp:mx_jumper:put_groupt}
    {exp:channel:entries channel="widgets" limit="1"}
    {exp:mx_jumper:put name="news_title"}{title}{/exp:mx_jumper:put}
    {/exp:channel:entries }
    The news title is {news_title}.
    {/exp:mx_jumper:put_groupt}
  • #7 / Feb 14, 2013 3:49am

    ralph.m

    225 posts

    Thanks ahmad. I don’t really need to use the new value outside the channel tags, so perhaps I just need mx-calculator. I’m not sure how to use it to add 10 to {price}, though. Any tips on doing that?

    “you can find a full doc here”

    Indeed, but you have to be a developer to understand that sort of thing, as it’s just a list of functions with no explanation. (I wish developers could appreciate that. Then the EE docs might be of some real use, too!)

  • #8 / Feb 14, 2013 6:18am

    ahmad saad

    364 posts

    I don’t use this addons befor but I think you can use it simply by:

    {exp:mx_calc expression="sum({price} ,10)"}  
    or
    {exp:mx_calc expression="{price} +10"}
  • #9 / Feb 14, 2013 7:59am

    ralph.m

    225 posts

    Ah, thanks very much ahmad. I’ll give that a go. I really appreciate your assistance. 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases