Announcement

Collapse
No announcement yet.

Terminating an mvt:foreach iterator loop

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

    Terminating an mvt:foreach iterator loop

    I know some hard ways of accomplishing this but has anyone come across a simple command that can be used after testing for a condition that will end/exit an &mvt:foreach iterator loop? Is there a module that adds this functionality?
    Jeffrey Koch - Wolfpaw Hosting LLC
    [email protected]

    Miva Merchant Premier Hosting and Development Partner
    PCI / PA-DSS Certified eCommerce Solutions
    24x7 Free Telephone Technical Support: 972-219-6899
    http://www.wpcomp.com - [email protected]

    #2
    Re: Terminating an mvt:foreach iterator loop

    Hi Jeff,

    I don't believe there is one. But you can bail out of ANY template using mvt:exit, which stops the CURRENT template execution immediately, returning control and continuing execution in the calling template.

    How will this help? Essentially if you isolate your mvt:foreach loop into it's own template, then you can bail on the foreach loop and still render the rest of your current template.

    This is a great use case for the "General Template" feature of our Template Manager.

    Best,
    James
    James Harrell
    current: Friend of Miva
    2007-2012 eMediaSales & Viking Coders
    2005-2007 Miva Merchant
    2001-2005 Copernicus

    Comment


      #3
      Re: Terminating an mvt:foreach iterator loop

      <mvt:break /> and <mvt:continue /> would be awesome!

      Comment


        #4
        Re: Terminating an mvt:foreach iterator loop

        It has been requested for a couple years. I don't think we'll ever see it get included into the engine even though it would be a simple one to adopt.
        Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
        Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
        Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
        Facebook http://www.facebook.com/EmporiumPlus
        Twitter http://twitter.com/emporiumplus

        Comment


          #5
          Re: Terminating an mvt:foreach iterator loop

          Bill,

          For some reason this wasn't on our radar, but we have added it to the list for 5.10 whenever that happens (no ETA at this time, as there's no 5.09 bugs reported yet).


          http://bugzilla.mivamerchant.com/show_bug.cgi?id=5800
          Thanks,

          Rick Wilson
          CEO
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment


            #6
            Re: Terminating an mvt:foreach iterator loop

            Hallelujah!
            Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
            Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
            Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
            Facebook http://www.facebook.com/EmporiumPlus
            Twitter http://twitter.com/emporiumplus

            Comment


              #7
              Re: Terminating an mvt:foreach iterator loop

              Ditto on <mvt:break />

              As for the original question... just in case it's not clear, your ONLY option is to use conditionals to skip the items you do not want to process.
              Ray Yates
              "If I have seen further, it is by standing on the shoulders of giants."
              --- Sir Isaac Newton

              Comment

              Working...
              X