Announcement

Collapse
No announcement yet.

Using a function in a select list

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

    Using a function in a select list



    --Boundary_(ID_kUuywCPmZgu/OlkDm0hS5Q)
    Content-type: text/plain; charset=us-ascii
    Content-transfer-encoding: 7BIT

    Hi All.

    Hoping for a point in the right direction here.

    Trying to selectively replace "Quantity Box" on my product templates. It
    would be easy enough if it were a fixed replacement. However, certain
    products have different "multiples."

    So I need a value holder that I can easily manage. I am thinking of either
    the Product Header, or using OUIs Custom Product Field called QUANT. I want
    something that I can bulk import and manage through Storeman, so I would
    prefer Product Header, since I am not using it for anything.

    I came up with several variants based on the OUI docs and a previous thread
    with JMH.

    Something along the lines of:

    <input type="hidden" name="Screen" value="PROD">
    <select name="Quantity">
    <option value="%EXPR(1*%VAR(prodheader)%"
    SELECTED>%EXPR(1*%VAR(prodheader)%</option>
    </select>
    <input type="submit" value="Add to basket">

    When I use that code, I cannot get that expression to evaluate and return a
    usable value.

    Can someone clue me in as to what I am overlooking?

    Regards,

    Peter Stoermer


    --Boundary_(ID_kUuywCPmZgu/OlkDm0hS5Q)--

    #2
    Using a function in a select list



    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Pete @ Total Hosting
    > Sent: Sunday, January 02, 2005 2:28 PM
    > To: [email protected]
    > Subject: [mrc] Using a function in a select list
    >
    >
    > Hi All.
    >
    > Hoping for a point in the right direction here.
    >
    > Trying to selectively replace "Quantity Box" on my product templates. It
    > would be easy enough if it were a fixed replacement. However, certain
    > products have different "multiples."
    >
    > So I need a value holder that I can easily manage. I am thinking of either
    > the Product Header, or using OUIs Custom Product Field called QUANT. I want
    > something that I can bulk import and manage through Storeman, so I would
    > prefer Product Header, since I am not using it for anything.
    >
    > I came up with several variants based on the OUI docs and a previous thread
    > with JMH.

    Well, its more of a "OpenUI Token Coding Question and not a Merchant Coding question, but
    here's a stab:


    > Something along the lines of:
    >
    > <input type="hidden" name="Screen" value="PROD">
    > <select name="Quantity">
    > <option value="%EXPR(1*%VAR(prodheader)%"
    > SELECTED>%EXPR(1*%VAR(prodheader)%</option>
    > </select>

    I think you would need something like %VAR(g.prodheader)% or %VAR(g.OUIXProduct.d.header)%
    if the product header contains the required quantity. This would only give you "1"
    quantity value however, if you wanted mulitples quantities, i.e., 3, 6, 9, etc, you would
    need something like:
    %SET(cnt|1)%
    %WHILE(%EXPR(gettoken(g.OUIXProduct.d.header, ',', cnt)%)
    <option value="%VAR(%EXPR(gettoken(g.OUIXProduct.d.header, ',',
    cnt)%)%">%VAR(%EXPR(gettoken(g.OUIXProduct.d.heade r, ',', cnt)%)%</option>
    %ASSIGN(cnt|%EXPR(cnt + 1)%)%
    %ENDWHILE%

    (but the actuall syntax might not be correct...don't do much opentoken coding.

    BTW: Our Dynamic Attribute Pricing module provides this ability built in (although its not
    updatable by StoreMan).


    -Bruce
    ......................................
    PHOSPHOR Media
    Featuring: StoreMan - A smarter way to manage Miva Merchant(tm) Store Content.
    Download a hassle-free demo today
    <A HREF ="http://www.phosphormedia.com/go.mv?ID=listsm">http://www.phosphormedia.com/go.mv?ID=listsm</A>
    ......................................



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (<A HREF =/"http://www.grisoft.com)/">http://www.grisoft.com)</A>.
    Version: 6.0.825 / Virus Database: 563 - Release Date: 12/30/04


    Comment


      #3
      Using a function in a select list



      Hey Bruce.

      Thanks for the pointers. I will take this over to the OUI forums to hash it
      out.

      I just figured I would get a fast response here (and I was right).

      I looked at your module. Is there a way to at least import the settings? I
      would hate to have to go product-by-product. That's why I was looking at a
      way to figure the coding and use the VC template to do the heavy lifting.

      If I read the other part of your message correctly, all that could be
      extracted out of the field "prodheader" is a value of "1" (that there is
      something in the field)? What about a field like "prodcost" or something
      numeric? I want a value holder that will allow the value entered to be what
      is used in the operation.

      Pete

      -----Original Message-----
      From: [email protected] [mailto:[email protected]]
      On Behalf Of Bruce - Phosphor Media
      Sent: Sunday, January 02, 2005 6:25 PM
      To: [email protected]
      Subject: RE: [mrc] Using a function in a select list

      > -----Original Message-----
      > From: [email protected]
      > [mailto:[email protected]]On Behalf Of Pete @ Total Hosting
      > Sent: Sunday, January 02, 2005 2:28 PM
      > To: [email protected]
      > Subject: [mrc] Using a function in a select list
      >
      >
      > Hi All.
      >
      > Hoping for a point in the right direction here.
      >
      > Trying to selectively replace "Quantity Box" on my product templates. It
      > would be easy enough if it were a fixed replacement. However, certain
      > products have different "multiples."
      >
      > So I need a value holder that I can easily manage. I am thinking of either
      > the Product Header, or using OUIs Custom Product Field called QUANT. I
      want
      > something that I can bulk import and manage through Storeman, so I would
      > prefer Product Header, since I am not using it for anything.
      >
      > I came up with several variants based on the OUI docs and a previous
      thread
      > with JMH.

      Well, its more of a "OpenUI Token Coding Question and not a Merchant Coding
      question, but
      here's a stab:


      > Something along the lines of:
      >
      > <input type="hidden" name="Screen" value="PROD">
      > <select name="Quantity">
      > <option value="%EXPR(1*%VAR(prodheader)%"
      > SELECTED>%EXPR(1*%VAR(prodheader)%</option>
      > </select>

      I think you would need something like %VAR(g.prodheader)% or
      %VAR(g.OUIXProduct.d.header)%
      if the product header contains the required quantity. This would only give
      you "1"
      quantity value however, if you wanted mulitples quantities, i.e., 3, 6, 9,
      etc, you would
      need something like:
      %SET(cnt|1)%
      %WHILE(%EXPR(gettoken(g.OUIXProduct.d.header, ',', cnt)%)
      <option value="%VAR(%EXPR(gettoken(g.OUIXProduct.d.header, ',',
      cnt)%)%">%VAR(%EXPR(gettoken(g.OUIXProduct.d.heade r, ',', cnt)%)%</option>
      %ASSIGN(cnt|%EXPR(cnt + 1)%)%
      %ENDWHILE%

      (but the actuall syntax might not be correct...don't do much opentoken
      coding.

      BTW: Our Dynamic Attribute Pricing module provides this ability built in
      (although its not
      updatable by StoreMan).


      -Bruce
      ......................................
      PHOSPHOR Media
      Featuring: StoreMan - A smarter way to manage Miva Merchant(tm) Store
      Content.
      Download a hassle-free demo today
      <A HREF ="http://www.phosphormedia.com/go.mv?ID=listsm">http://www.phosphormedia.com/go.mv?ID=listsm</A>
      ......................................



      ---
      Outgoing mail is certified Virus Free.
      Checked by AVG anti-virus system (<A HREF =/"http://www.grisoft.com)/">http://www.grisoft.com)</A>.
      Version: 6.0.825 / Virus Database: 563 - Release Date: 12/30/04


      Comment


        #4
        Using a function in a select list



        > -----Original Message-----
        > From: [email protected]
        > [mailto:[email protected]]On Behalf Of Pete @ Total Hosting
        > Sent: Sunday, January 02, 2005 5:15 PM
        > To: [email protected]
        > Subject: RE: [mrc] Using a function in a select list
        >
        >
        > Hey Bruce.
        >
        > I looked at your module. Is there a way to at least import the settings?

        Not currently...but we might do something along those lines.

        > If I read the other part of your message correctly, all that could be
        > extracted out of the field "prodheader" is a value of "1" (that there is
        > something in the field)?

        What I was referring to is that simply evaluating the contents of either the database
        field or a variable representing that field will give you what is in that field or in
        other words a single numerical value. So, if a product can only be ordered in a quantity
        of say 6, then your better off making the product a "case of six". If you really need to
        make quantities a multiple, (6, 12, 18, 24 , etc) then you need to create a method to have
        mulitple quantity values in that field.

        > What about a field like "prodcost" or something
        > numeric? I want a value holder that will allow the value entered to be what
        > is used in the operation.

        Again, if there is only one quantity, then make that quantity the actual product (I.e.,
        case of beer, dozen muffins, etc.)


        > Pete
        >
        > -----Original Message-----
        > From: [email protected] [mailto:[email protected]]
        > On Behalf Of Bruce - Phosphor Media
        > Sent: Sunday, January 02, 2005 6:25 PM
        > To: [email protected]
        > Subject: RE: [mrc] Using a function in a select list
        >
        > > -----Original Message-----
        > > From: [email protected]
        > > [mailto:[email protected]]On Behalf Of Pete @ Total Hosting
        > > Sent: Sunday, January 02, 2005 2:28 PM
        > > To: [email protected]
        > > Subject: [mrc] Using a function in a select list
        > >
        > >
        > > Hi All.
        > >
        > > Hoping for a point in the right direction here.
        > >
        > > Trying to selectively replace "Quantity Box" on my product templates. It
        > > would be easy enough if it were a fixed replacement. However, certain
        > > products have different "multiples."
        > >
        > > So I need a value holder that I can easily manage. I am thinking of either
        > > the Product Header, or using OUIs Custom Product Field called QUANT. I
        > want
        > > something that I can bulk import and manage through Storeman, so I would
        > > prefer Product Header, since I am not using it for anything.
        > >
        > > I came up with several variants based on the OUI docs and a previous
        > thread
        > > with JMH.
        >
        > Well, its more of a "OpenUI Token Coding Question and not a Merchant Coding
        > question, but
        > here's a stab:
        >
        >
        > > Something along the lines of:
        > >
        > > <input type="hidden" name="Screen" value="PROD">
        > > <select name="Quantity">
        > > <option value="%EXPR(1*%VAR(prodheader)%"
        > > SELECTED>%EXPR(1*%VAR(prodheader)%</option>
        > > </select>
        >
        > I think you would need something like %VAR(g.prodheader)% or
        > %VAR(g.OUIXProduct.d.header)%
        > if the product header contains the required quantity. This would only give
        > you "1"
        > quantity value however, if you wanted mulitples quantities, i.e., 3, 6, 9,
        > etc, you would
        > need something like:
        > %SET(cnt|1)%
        > %WHILE(%EXPR(gettoken(g.OUIXProduct.d.header, ',', cnt)%)
        > <option value="%VAR(%EXPR(gettoken(g.OUIXProduct.d.header, ',',
        > cnt)%)%">%VAR(%EXPR(gettoken(g.OUIXProduct.d.heade r, ',', cnt)%)%</option>
        > %ASSIGN(cnt|%EXPR(cnt + 1)%)%
        > %ENDWHILE%
        >
        > (but the actuall syntax might not be correct...don't do much opentoken
        > coding.
        >
        > BTW: Our Dynamic Attribute Pricing module provides this ability built in
        > (although its not
        > updatable by StoreMan).
        >
        >
        > -Bruce
        > ......................................
        > PHOSPHOR Media
        > Featuring: StoreMan - A smarter way to manage Miva Merchant(tm) Store
        > Content.
        > Download a hassle-free demo today
        > <A HREF ="http://www.phosphormedia.com/go.mv?ID=listsm">http://www.phosphormedia.com/go.mv?ID=listsm</A>
        > ......................................
        >
        >
        >
        > ---
        > Outgoing mail is certified Virus Free.
        > Checked by AVG anti-virus system (<A HREF =/"http://www.grisoft.com)/">http://www.grisoft.com)</A>.
        > Version: 6.0.825 / Virus Database: 563 - Release Date: 12/30/04
        >
        >

        Comment

        Working...
        X