Announcement

Collapse
No announcement yet.

problem with if else statement syntax error, unexpected ELSE

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

    problem with if else statement syntax error, unexpected ELSE

    Does anyone see anything wrong with my if else statement. My store keeps telling me syntax error, unexpected ELSE
    but it isn't unexpected... I need it!
    I'm reducing a products inventory by either the store default low stock amount or by the products low stock amount if it not default.
    I have values for the variable I am testing. I tried using just 1 and '1', I checked that I have single and double quotes and not smart quotes.
    I"m stumped. (and tired). Can one of you miva gurus help me out with the syntax of my if - else?

    <mvt:do file="g.Module_Feature_INV_DB" name="l.success" value="InventoryProductSettings_Read(l.settings:in vsetstore)" />
    <mvt:do file="g.Module_Feature_INV_DB" name="l.success" value="InventoryProductSettings_Load(l.settings:re cord:id, l.settings:invsetprod)" />

    <mvt:if expr="l.settings:invsetprod:low_lvl_d EQ '1'">
    <mvt:assign name="l.settings:record:invadjusted" value="l.settings:record:inventory - l.settings:invsetstore:low_level" >
    <mvt:else>
    <mvt:assign name="l.settings:record:invadjusted" value="l.settings:record:inventory - l.settings:invsetprod:low_level" >
    </mvt:if>


    #2
    The forum sometimes messes up code displays. I'm seeing a couple of spaces in the middle of variable names (such as "l.settings:re cord:id") but you probably didn't type those.

    mvt:assign tags have to have a slash before the closing angle bracket; looks like you left those out.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      Are the spaces that show up due to pasting the code? I see a couple of them (l.settings:in vsetstore) (l.settings:re cord:id, l.settings:invsetprod)
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        yes they were from pasting... Here is my tired brain fart... I didn't close the assign statements... that slash is so important!

        <mvt:do file="g.Module_Feature_INV_DB" name="l.success" value="InventoryProductSettings_Read(l.settings:in vsetstore)" />
        <mvt:do file="g.Module_Feature_INV_DB" name="l.success" value="InventoryProductSettings_Load(l.settings:re cord:id, l.settings:invsetprod)" />

        <mvt:if expr="l.settings:invsetprod:low_lvl_d EQ '1'">
        <mvt:assign name="l.settings:record:invadjusted" value="l.settings:record:inventory - l.settings:invsetstore:low_level" />
        <mvt:else>
        <mvt:assign name="l.settings:record:invadjusted" value="l.settings:record:inventory - l.settings:invsetprod:low_level" />
        </mvt:if>

        Comment


          #5
          well, at least your not typing <mvassign name="g.foo" value="{ l.something.something}"/> and wondering why it doesn't work.
          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


            #6
            Originally posted by Bruce - PhosphorMedia View Post
            well, at least your not typing <mvassign name="g.foo" value="{ l.something.something}"/> and wondering why it doesn't work.
            Yes, I do that occasionally too. :^)
            Kent Multer
            Magic Metal Productions
            http://TheMagicM.com
            * Web developer/designer
            * E-commerce and Miva
            * Author, The Official Miva Web Scripting Book -- available on-line:
            http://www.amazon.com/exec/obidos/IS...icmetalproducA

            Comment

            Working...
            X