Announcement

Collapse
No announcement yet.

Quick Order Form Item Conditional

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

    Quick Order Form Item Conditional

    I know this kind of defeats the purpose of using the Content Management and Flex items, but if I want to only show the Quick Order Form to logged in customers, is the best way to simply add the item to a page manually say in the footer and write the condition there to display it or is there a better way?
    Highly caffeinated
    http://www.coffeehouseexpress.com

    #2
    You can wrap the flex component output in a conditional, but it would impact all flex components on the page not just a single component. So someone who was not logged in would see a blank page or a message asking them to login.

    But here is an example of the template code you would need. First create the page you want then edit the template and wrap the flex component output (called a sequence) in a conditional

    <mvt:if expr="g.basket:cust_id NE 0">
    <mvt:item name="sequence" />
    <mvt:else>
    You must be logged in to view this page
    </mvt:if>

    Another option would be to do a similar conditional and have it automatically redirect to the login screen if they are not logged in.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Great! Thanks Brennan.
      Highly caffeinated
      http://www.coffeehouseexpress.com

      Comment


        #4
        You could also use the
        Code:
        <mvt:item name="header_sequence" />
        or
        Code:
        <mvt:item name="footer_sequence" />
        if you didn't want to take up the whole "sequence". These little ditties are used on the CTGY template and others. This would enable you to "hide" the Quick Form but still use the others.
        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


          #5
          Originally posted by lesliekirk View Post
          You could also use the
          Code:
          <mvt:item name="header_sequence" />
          or
          Code:
          <mvt:item name="footer_sequence" />
          if you didn't want to take up the whole "sequence". These little ditties are used on the CTGY template and others. This would enable you to "hide" the Quick Form but still use the others.
          Excellent! Thank you Leslie.
          Highly caffeinated
          http://www.coffeehouseexpress.com

          Comment


            #6
            You could also create your own sequence item by selecting the add item button from the items tab on any page. Then choose the cmp-mv-sequence module and give the item a code of your choice. Now you can assign this new item to any page and add <mvt:item name="sequence" /> to the template where you want it to display.

            If you want to give the sequence item a specific name you can import this XML into data management and it will give the item a custom name:

            Code:
            <Page_Update code="ABUS">
                <Item code="footer_sequence">
                     <Title>Page Builder Footer</Title>
               </Item>
            </Page_Update>
            Nicholas Adkins
            Technical Training Specialist / Miva, Inc.
            [email protected]
            https://www.miva.com/mivalearn

            Comment


              #7
              Originally posted by Nick View Post
              You could also create your own sequence item by selecting the add item button from the items tab on any page. Then choose the cmp-mv-sequence module and give the item a code of your choice. Now you can assign this new item to any page and add <mvt:item name="sequence" /> to the template where you want it to display.

              If you want to give the sequence item a specific name you can import this XML into data management and it will give the item a custom name:

              Code:
              <Page_Update code="ABUS">
              <Item code="footer_sequence">
              <Title>Page Builder Footer</Title>
              </Item>
              </Page_Update>
              LOL, yeah, I forgot about that one. I remember I created one when PageBuilder first came out. Haven't needed to since...
              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


                #8
                Are these items appropriate to use?
                Code:
                <mvt:item name="flex" param="mmx_imageandtext" />
                <mvt:item name="flex" param="mmx_quickorder" />
                Highly caffeinated
                http://www.coffeehouseexpress.com

                Comment


                  #9
                  Originally posted by Jim Cockerham View Post
                  Are these items appropriate to use?
                  Code:
                  <mvt:item name="flex" param="mmx_imageandtext" />
                  <mvt:item name="flex" param="mmx_quickorder" />
                  Are you wanting to try and use the component outside of the PageBuilder "framework"?
                  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


                    #10
                    Originally posted by lesliekirk View Post

                    Are you wanting to try and use the component outside of the PageBuilder "framework"?
                    I don't want to but I thought I needed to. So, here is what I did. I created a new page in PageBuilder "Content Management" section. I assigned the Quick Order component and all was fine except that I needed it to only show to logged in customers. So I went into the Page Template (outside of PageBuilder) and added the condition in the footer section using the items above. I then hid the components in PageBuilder so that they would not display twice. This is probably not the best way, but it works. Are there any docs so that I can better understand the Sequence item?
                    Highly caffeinated
                    http://www.coffeehouseexpress.com

                    Comment


                      #11
                      Jim Edwards the best resource to understand Miva's Flex Components is this page: https://docs.miva.com/miva10/referen...flex-component

                      There is a bit of information in there around the Sequence item but essentially when it is added to a template (and assigned) it will render the flex components that have been added via page builder.

                      You can have multiple sequence items on the page with flex components added via page builder. If there are multiple sequence items assigned to the page the item names will show up in PageBuilder in a dropdown right above the add component section.

                      Although the way you implemented the functionality works it is not the way it was intended to be used. My suggestion would be to write a condition to redirect the user if they are not intended to view the page, https://docs.miva.com/code-samples/m...t-to-canonical. If that is too much then you could also simply write a condition around the <mvt:item name="sequence"> tag and that will hide the sequence that the quick order flex component is added.
                      Nicholas Adkins
                      Technical Training Specialist / Miva, Inc.
                      [email protected]
                      https://www.miva.com/mivalearn

                      Comment


                        #12
                        Thanks Nick!
                        Highly caffeinated
                        http://www.coffeehouseexpress.com

                        Comment


                          #13
                          Thanks to everyone for the help with this. This was my first look at using Page Builder on my existing site and I was making this much harder than it needed to be. Brennan's Solution is really all I needed in this case. For anyone who reads this post later, this "How to" article is helpful too: https://docs.miva.com/miva10/referen...der-storefront
                          Highly caffeinated
                          http://www.coffeehouseexpress.com

                          Comment

                          Working...
                          X