Announcement

Collapse
No announcement yet.

Price Group Conditional/Variable?

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

    Price Group Conditional/Variable?

    Hello everyone,

    Can someone help me with a price group conditional/variable? Is one even possible?

    Such as;

    If a member of Price Group A, display sentence A; if a member of Price Group B, display sentence B.

    I'm using Latu's Store Helper module to try and find something that resembles it, but it seems the closest I have found is this: &mvt:product:pgrpcount

    But it doesn't change when I log in under different price groups, so I am guessing it isn't the variable I am looking for. There is also &mvt:global:customer:pgrpcount; but once again, it isn't changing when I log in under different users under different price groups.

    Any help will be greatly appreciated.

    If anyone is curious as to what this is for, we have owners that order specific items for their menu so I was going to set this up so our logo or some icon could be on the items they order, so they knew they were on the right ones; but it would be hidden from the public, and other price groups (other companies that use our site as well) so there wouldn't be any confusion.
    Last edited by leslienord; 05-29-08, 11:13 AM.
    http://www.specialtycoffeecoop.com
    Your online source everything coffee related.

    #2
    Re: Price Group Conditional/Variable?

    You'll need a module to do that. Take a look at the Emporium Plus Tool Kit at
    http://www.emporiumplus.com/go/wcw/PROD/1AA/1AA00223
    Scroll down to the function called pgroup.
    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


      #3
      Re: Price Group Conditional/Variable?

      Can I create new variables using that?

      I was thinking; using my previous idea of just having a price group variable, I still wouldn't be able to do what I want I think because I can't edit a specific product page.

      Here is what I want: (Atleast, the ability to do this)
      If someone in Price Group A visits Product A, an icon is displayed.
      If someone in Price Group A visits Product B, the icon isn't displayed.
      If someone in Price Group B visits Product A, the icon isn't displayed.
      If someone in Price Group B visits Product B, the icon isn't displayed.
      If someone in Price Group C visits Product A, an icon is displayed.
      If someone in Price Group C visits Product B, an icon is displayed.

      I know it sounds complex, but I know this can be done with PHP and mySQL. I just have to find a way to do it using MIVA's code.

      Any sugguestions? Could the Emporium Plus Tool Kit do all of the above? If so, how would it do it?

      Would it require me to list the variable price group (If price group is X, display A; else display B) and also list every product code (If product code is ProductCode1001,ProductCode1002,ProductCode1003, display A; else display B)?
      http://www.specialtycoffeecoop.com
      Your online source everything coffee related.

      Comment


        #4
        Re: Price Group Conditional/Variable?

        It looks like you also need a product page template that let's you assign a different template to a specific product or group of products.
        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: Price Group Conditional/Variable?

          I have Sebenza's Category Template Manager. Will that work? If not, what do you recommend?

          And using what you recommend, in conjunction with your Toolkit, I should be able to achieve this effect?

          I just don't want to buy a bunch of modules then still be unable to achieve my goal.

          http://www.specialtycoffeecoop.com
          Your online source everything coffee related.

          Comment


            #6
            Re: Price Group Conditional/Variable?

            It depends on which screen you want the icon on. If category, then category templates. If product, then product templates. You'll need a different template for each price group. That said, you could do it without template modules, but you'll need to write a bunch of conditional code. The tool kit will tell you the price group. But you'll need to write the conditional code to display the icon.
            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: Price Group Conditional/Variable?

              They should work together just fine.

              Just be sure to paste the toolkit code into the top of the template so it will produce the variable, and also assign the toolkit item to any screen you will be using it in.

              Put this in the top of the template:
              Code:
              <mvt:item name="toolkit" param="agroup|acount" />
              <mvt:if expr="g.acount GT 0">
              <mvt:foreach iterator="customer_agroup" array="customer_agroups">
              </mvt:foreach>
              </mvt:if>
              Then conditionalize your display:
              Code:
              <mvt: if expr="l.settings:customer_agroup:name EQ "GroupA">
              show this icon...
              <mvt:else>
              dont show it...
              </mvt:if>

              Comment


                #8
                Re: Price Group Conditional/Variable?

                Originally posted by wcw
                It depends on which screen you want the icon on. If category, then category templates. If product, then product templates. You'll need a different template for each price group. That said, you could do it without template modules, but you'll need to write a bunch of conditional code. The tool kit will tell you the price group. But you'll need to write the conditional code to display the icon.
                Product pages, definitely.

                Originally posted by Vic - WolfPaw Computers
                They should work together just fine.

                Just be sure to paste the toolkit code into the top of the template so it will produce the variable, and also assign the toolkit item to any screen you will be using it in.

                Put this in the top of the template:
                Code:
                <mvt:item name="toolkit" param="agroup|acount" />
                <mvt:if expr="g.acount GT 0">
                <mvt:foreach iterator="customer_agroup" array="customer_agroups">
                </mvt:foreach>
                </mvt:if>
                Then conditionalize your display:
                Code:
                <mvt: if expr="l.settings:customer_agroup:name EQ "GroupA">
                show this icon...
                <mvt:else>
                dont show it...
                </mvt:if>
                Far out.

                Seems like this is definitely the easiest way to go; with the product page templates and the toolkit.

                Thanks for the help everyone. I'll let you guys know how it goes.
                http://www.specialtycoffeecoop.com
                Your online source everything coffee related.

                Comment


                  #9
                  Re: Price Group Conditional/Variable?

                  I just got through doing a lot of conditional displays based on availability group assignments for client.

                  Comment


                    #10
                    Re: Price Group Conditional/Variable?

                    Alright so I bought those 2 modules, have them both up and running, but am running into some issues with the conditional.

                    Using your exact code, Vic, I get this error:
                    Code:
                    Line 60:mvt:if requires the "expr" attribute
                    Even when changing something like "GroupA" to "Owners" (my price group), I still get it.

                    So I thought maybe the space after
                    Code:
                    "mvt: if"
                    was doing it. I removed it, but it still doesn't work. Still got the error.

                    So I tinkered with the code on my own and switched it to this:
                    Code:
                    <mvt:item name="toolkit" param="pgroup|pcount" />
                    <mvt:if expr="g.acount GT 0">
                    <mvt:foreach iterator="customer_pgroup" array="customer_pgroups">
                    </mvt:foreach>
                    </mvt:if>
                    Code:
                    <mvt:if expr="l.settings:customer_pgroup:name EQ 'Owners'">
                    <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                    <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                    <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                    <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                    <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                    <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                    <mvt:else>
                    &nbsp;
                    </mvt:if>
                    I don't get an error with it; but it doesn't work either. When logged in or logged out, the tags don't show up.

                    I'm of course just using those as a test to see if the code is working.

                    Any help is appreciated.

                    So close but so far away...
                    http://www.specialtycoffeecoop.com
                    Your online source everything coffee related.

                    Comment


                      #11
                      Re: Price Group Conditional/Variable?

                      The example in the module's admin screen is:
                      Code:
                      <mvt:item name="toolkit" param="pgroup|pcount" />
                      <mvt:if expr="g.pcount GT 0">
                      <mvt:foreach iterator="customer_pgroup" array="customer_pgroups">
                      <br>&mvt:customer_pgroup:name;
                      </mvt:foreach>
                      </mvt:if>
                      In your example you saved the variable to pcount but then checked for acount GT 0. acount will always be 0 since that is not the variable you saved to.
                      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


                        #12
                        Re: Price Group Conditional/Variable?

                        So wait, I need the first code in the head to be;


                        Code:
                        <mvt:item name="toolkit" param="pgroup|pcount" />
                        <mvt:if expr="g.pcount GT 0">
                        <mvt:foreach iterator="customer_pgroup" array="customer_pgroups">
                        <br>&mvt:customer_pgroup:name;
                        </mvt:foreach>
                        </mvt:if>
                        And the other part to be:

                        Code:
                        <mvt:if expr="l.settings:customer_pgroup:name EQ 'Owners'">
                        <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                        <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                        <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                        <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                        <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                        <h1>YOU ARE AN OWNER! CONGRATS!!!!!!</h1>
                        <mvt:else>
                        &nbsp;
                        </mvt:if>
                        ?

                        I'm sorry if I'm not following what you are saying; obviously I am new to this, however I am willing and trying to learn, thus my editing of the code and trying things out before running on here and asking for it to be done for me.

                        Edit: Tried it and it works! Thanks!
                        Last edited by The Brandon; 04-02-07, 11:30 AM.
                        http://www.specialtycoffeecoop.com
                        Your online source everything coffee related.

                        Comment


                          #13
                          Re: Price Group Conditional/Variable?

                          I don't know what the second code is for. The code I corrected and posted will show all the groups the customer is in. That should be all you need. If you want to say welcome or something for a particular group, your conditional needs to be inside the foreach loop (in the code I gave you).

                          If a customer is in more than one group, your code in the second display will only be true if the last group he/she is in happens to be Owners. For example a customer is in:
                          Wholesale
                          Owners
                          New Guy
                          The second bit of code would be blank since the group would be New Guy.
                          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


                            #14
                            Re: Price Group Conditional/Variable?

                            Originally posted by wcw
                            I don't know what the second code is for. The code I corrected and posted will show all the groups the customer is in. That should be all you need. If you want to say welcome or something for a particular group, your conditional needs to be inside the foreach loop (in the code I gave you).

                            If a customer is in more than one group, your code in the second display will only be true if the last group he/she is in happens to be Owners. For example a customer is in:
                            Wholesale
                            Owners
                            New Guy
                            The second bit of code would be blank since the group would be New Guy.
                            Yeah that was part of what I wanted. We have multiple franchises that use our site, so this way I can display different icons for the items on their menu.

                            Also on the code, if I wanted to have more than one price group, how should I seperate it?

                            Example:
                            Code:
                            <tr><td align="left"><mvt:if expr="l.settings:customer_pgroup:name EQ 'Owners'">
                            <img src="http://www.specialtycoffeecoop.com/images/jjhead.gif" width="50" height="29" />
                            <mvt:else>
                            &nbsp;
                            </mvt:if></td></tr>
                            Right now it is in single quotes, should it be:
                            Code:
                            <mvt:if expr="l.settings:customer_pgroup:name EQ 'Owners,' 'Monkeys,' 'Robots,' 'Other Wordly Beings'">
                            ?

                            Once again thank you to everyone who helped, and to you WCW and Sebenza for making 2 fantastic modules. Both of these open up so many possibilities that I am just eager to come up with more ways to use them to make the website better.
                            http://www.specialtycoffeecoop.com
                            Your online source everything coffee related.

                            Comment


                              #15
                              Re: Price Group Conditional/Variable?

                              <mvt:if expr="l.settings:customer_pgroup:name CIN 'Owners|Monkeys|Robots|Other Wordly Beings'">
                              should work.
                              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

                              Working...
                              X