Announcement

Collapse
No announcement yet.

Redirect based on Availability Group

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

  • Redirect based on Availability Group

    I need to redirect customers who are part of an Availability Group to a specific section of the website if they click on any tab or menu in my ready theme. How would I go about this and where would I write the code for this?

    Thank you

  • You could wrap a meta refresh directive in the availability group conditional. That would need to go in the Head Tag template.
    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


    • Bruce,

      Awesome, how do I do that? My company refuses to hire a Web Developer so I'm teaching myself as I go

      Thank you

      Comment


      • I know I'm asking a lot but I have to figure this out myself.

        I looked through the forums and found another post with a setup I think I can use

        Code:
        <mvt:comment>Load Availability Group by Name</mvt:comment> <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailabilityGroup_Load_Name('MyAvailGroupNa me', g.availabilitygroup)" /> <mvt:comment>Check if customer is assigned to the group</mvt:comment> <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailGroupXCustomer_Load(g.availabilitygrou p:id, g.basket:cust_id, l.settings:availgroupxcustomer)" /> <mvt:if expr="NOT ISNULL l.settings:availgroupxcustomer:agrp_id"> //Customer is part of the availability group <mvt:else> //customer is not part of the availability Group </mvt:if> I think I can alter this to make this work I'm just not that confident and could use some guidance.

        Any assistance anyone could give would be greatly appreciated

        Thank you,

        Comment


        • This goes in the head

          Code:
          <mvt:comment>Load Availability Group by Name</mvt:comment> 
          <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailabilityGroup_Load_Name('MyAvailGroupName', g.availabilitygroup)" /> 
          
          <mvt:comment>Check if customer is assigned to the group</mvt:comment> 
          <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailGroupXCustomer_Load(g.availabilitygroup:id, g.basket:cust_id, l.settings:availgroupxcustomer)" /> 
          <mvt:if expr="NOT ISNULL l.settings:availgroupxcustomer:agrp_id">
          <meta http-equiv="Refresh" content="0;url=https://your-domain.com/path-of-the-url">
          </mvt:if>
          Make sure you change the availability group name and redirect path. The '0;' in front of the redirect path is how much delay to add.
          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


          • Bruce,

            Thank you.

            If I wanted to make the redirect conditional, based on someone clicking a category in the left navigation set or the ReadyTheme Navigation set, could I write an additional if statement like this:

            ```
            <mvt:comment>Load Availability Group by Name</mvt:comment>
            <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailabilityGroup_Load_Name('Tiered Dealers', g.availabilitygroup)" />

            <mvt:comment>Check if customer is assigned to the group</mvt:comment>
            <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailGroupXCustomer_Load(g.availabilitygrou p:id, g.basket:cust_id, l.settings:availgroupxcustomer)" />
            <mvt:if expr="NOT ISNULL l.settings:availgroupxcustomer:agrp_id">
            <mvt:if expr="l.settings:cattree_category:name EQ 'In Stock'">
            <meta http-equiv="Refresh" content="0;url=https://www.tacticalholsters.com/category/dealers/">
            </mvt:if>
            </mvt:if>
            ```
            Last edited by iiams571; 08-22-19, 10:03 AM.

            Comment


            • invert the code a bit.

              test for the category code (just use IF l.settings:category:code EQ 'cat-code'), then run the availability test

              mostly because the availability test takes longer.
              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


              • Like this?

                <mvt:comment>Load Availability Group by Name</mvt:comment>
                <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailabilityGroup_Load_Name('Tiered Dealers', g.availabilitygroup)" />

                <mvt:if l.settings:cattree_category:code EQ 'In-Stock'>
                </mvt:if>
                <mvt:comment>Check if customer is assigned to the group</mvt:comment>
                <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailGroupXCustomer_Load(g.availabilitygrou p:id, g.basket:cust_id, l.settings:availgroupxcustomer)" />
                <mvt:if expr="NOT ISNULL l.settings:availgroupxcustomer:agrp_id">
                <meta http-equiv="Refresh" content="0;url=https://www.tacticalholsters.com/category/dealers/">

                </mvt:if>

                Comment


                • close

                  Code:
                  <mvt:comment>Load Availability Group by Name</mvt:comment> 
                  <mvt:if l.settings:cattree_category:code EQ 'In-Stock'>
                     <mvt:comment>Check if customer is assigned to the group</mvt:comment> 
                     <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailabilityGroup_Load_Name('Tiered Dealers', g.availabilitygroup)" /> 
                     <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailGroupXCustomer_Load(g.availabilitygrou p:id, g.basket:cust_id, l.settings:availgroupxcustomer)" /> 
                     <mvt:if expr="NOT ISNULL l.settings:availgroupxcustomer:agrp_id">
                        <meta http-equiv="Refresh" content="0;url=https://www.tacticalholsters.com/category/dealers/">
                     </mvt:if>
                  </mvt:if>
                  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


                  • Thank you,

                    I tried the code and I'm getting a syntax error. (Image included)

                    Says:

                    at 69:9 - 69:9 - syntax error, unexpected IDENTIFIER, expecting EXPR

                    Attached Files

                    Comment


                    • You where missing the expression term in the mvt:if

                      Code:
                       
                       <mvt:comment>Load Availability Group by Name</mvt:comment>  <mvt:if expr="l.settings:cattree_category:code EQ 'In-Stock'">    <mvt:comment>Check if customer is assigned to the group</mvt:comment>     <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailabilityGroup_Load_Name('Tiered Dealers', g.availabilitygroup)" />     <mvt:do file="g.Module_Feature_AGR_DB" name="l.success" value="AvailGroupXCustomer_Load(g.availabilitygrou p:id, g.basket:cust_id, l.settings:availgroupxcustomer)" />     <mvt:if expr="NOT ISNULL l.settings:availgroupxcustomer:agrp_id">       <meta http-equiv="Refresh" content="0;url=https://www.tacticalholsters.com/category/dealers/">    </mvt:if> </mvt:if>
                      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


                      • Bruce,

                        Still not working to redirect. In fact does nothing at all.

                        I think what I need is someone who can look at my setup with me over a conference call and advise or assist directly.

                        Do you know any freelance coders that could assist me over a screenshare with writing the conditionals with me directly

                        Thank you,

                        Comment


                        • I'd offer, but pretty booked up at the moment. You can try the 'For Hire' forum or even ask Miva Support. They don't usually handle custom work, but in your case, i think its just a matter of you missing a something in the code.

                          As for trouble shooting: If you are logged into the availability group, and go to the intended category, do you see the meta redirect tag? or is the logic to display that tag not working.
                          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


                          • Bruce,

                            When logged in I don't see the meta redirect tag if I go to the Intended Category.

                            I checked with Miva Support and they said they don't do any coding so I can to the Forums.

                            I'll search in the For Hire section.

                            Thank you for all your help

                            Comment

                            Working...
                            X

                            This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

                            This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

                            Accept