Miva Variables?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeffwo
    Mivite Lite

    • Jun 2012
    • 5

    #1

    Miva Variables?

    Can anyone please help me?

    enter:<input type="text" name="Amount" />
    <input type="hidden" name="Quantity" value="if the user entered 8 in the textbox, what do I put here to assign that numerical Amount to the variable "Quantity"/>

    am i totally off here? newbie here.
    thanks,
    jeff
  • Brennan
    Super Moderator









    • Jun 2009
    • 3481

    #2
    Re: Miva Variables?

    Hey Jeff -

    If both of those inputs are on the same page, the only way to copy the input from what the customer entered into your hidden input is though JavaScript. If you wanted to print the value of the input on the page the form was submitted to you could use the miva variable to access the input for amount.

    It would be &mvte:global:amount;

    All inputs from a form submit automatically become global variables in Miva.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    • Bruce - PhosphorMedia
      Developer Partner











      • Mar 2006
      • 11257

      #3
      Re: Miva Variables?

      ..or maybe just re-label the "Quantity" text box to "Amount". If you need to do this for a specific product, say a gift certificate, and the product code was GiftCert, you would use:

      <mvt:if expr="g.Product_Code EQ 'GiftCert'">
      Enter Amount: <input type="text" name="Quantity" value="&mvte:global:quantity;">
      <mvt:else>
      Quantity: <input type="text" name="Quantity" value="&mvte:global:quantity;">
      </mvt:if>

      (BTW: Its often best to describe what you want to accomplish rather that what you are trying to do.)
      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

      • jeffwo
        Mivite Lite

        • Jun 2012
        • 5

        #4
        Re: Miva Variables?

        Thanks Guys,

        Just for clarification, I am trying to tweak the Category Page, Category Product List Layout Template. Because the store sells hard wood flooring by the carton, I need to take the users input in text box in square feet and figure how many cartons they need if there were 22 square feet in one carton. e.g. 228/22=10 with the remainder 8, so I will need 11 cartons.

        I want to add a a text box that requires customer to enter a number in total square feet. After the number is entered it will be stored in variable "Amount", I want to perform some calculation on variable "Amount" by dividing by 22 and the result entered into another variable say "Cartons" and then perform "Amount" MOD 22. If there is a remainder greater than 0, than I would add 1 to the variable "Cartons" and then use "Cartons" as the VALUE for the hidden input name variable "Quantity"

        I am guessing all this is done after the post to BASK page. I have put XXXX marks above and below where I think the code should be.

        As a result I am thinking that the Basket Page will be prepopulated with the number assigned to the variable "Quantity" in the hidden input with the value of the contents of "Carton"

        Hope this is more clear. Will I need javascript to do this? Thanks! Newbie Jeff

        <div class="expanded">
        <mvt:foreach iterator="product" array="category_listing:products">
        <div class="product-item" style="width:50%">
        <div class="padding">
        <div class="product-details">
        <div class="product-thumbnail">
        <mvt:if expr="NOT ISNULL l.settings:product:thumbnail"><a href="&mvte:product:link;"><img src="&mvte:product:thumbnail;" alt="&mvte:product:name;" /><mvt:else><a class="thumbnail-not-available" href="&mvte:product:link;" title="&mvte:product:name;"></mvt:if></a>
        </div>
        <div class="product-name"><a href="&mvte:product:link;">&mvt:product:name;</a></div>
        <div class="product-price">Price: <span class="bold">&mvt:product:formatted_price;</span></div>
        <mvt:if expr="l.settings:product:inv_active">
        &mvt:product:inv_long;<br />
        </mvt:if>

        </div>
        <mvt:if expr="l.settings:product:inv_level NE 'out'">
        <div class="purchase-buttons">
        <form method="post" action="&mvte:global:sessionurl;Screen=BASK">
        <input type="hidden" name="Old_Screen" value="&mvte:global:Screen;" />
        <input type="hidden" name="Old_Search" value="&mvte:global:Search;" />
        <input type="hidden" name="Action" value="ADPR" />
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX
        <input type="text" name="Amount" />
        "Amount" / 22="Cartons"
        "Amount mod 22 ="Remainder"
        if "Remainder" > 0
        Cartons=Cartons + 1

        <input type="hidden" name="Quantity" value="Cartons"
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX
        <input type="hidden" name="Quantity" value="1" /> " I want to change value 1 to the variable "Cartons"
        <input type="hidden" name="Attributes" value="Yes" />
        <input type="hidden" name="Store_Code" value="&mvte:store:code;" />
        <input type="hidden" name="Product_Code" value="&mvte:product:code;" />
        <input type="hidden" name="Current_Product_Code" value="&mvte:global:Product_Code;" />
        <input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;" />
        <input type="hidden" name="Offset" value="&mvte:global:CatListingOffset;" />
        <input type="hidden" name="AllOffset" value="&mvte:global:AllOffset;" />
        <input type="hidden" name="CatListingOffset" value="&mvte:global:CatListingOffset;" />
        <input type="hidden" name="RelatedOffset" value="&mvte:global:RelatedOffset;" />
        <input type="hidden" name="SearchOffset" value="&mvte:global:SearchOffset;" />
        <mvt:item name="buttons" param="AddToBasketE" />
        </form>
        <form method="post" action="&mvte:global:secure_sessionurl;Screen=OINF ">
        <input type="hidden" name="Old_Screen" value="&mvte:global:Screen;" />
        <input type="hidden" name="Old_Search" value="&mvte:global:Search;" />
        <input type="hidden" name="Action" value="ADPR" />
        <input type="hidden" name="Quantity" value="1" />
        <input type="hidden" name="Attributes" value="Yes" />
        <input type="hidden" name="Store_Code" value="&mvte:store:code;" />
        Last edited by jeffwo; 07-17-12, 10:57 PM.

        Comment

        Working...
        X