Announcement

Collapse
No announcement yet.

Login and Price Groups

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

    Login and Price Groups

    Hello,

    How can I make appear a message on the PROD page only if you are login as a customer and you are also assigned to a Price Group and if you're not login another message should appear?

    I figured out how to do the last thing (make appear a message if you are not logged in) but when you are login and also assigned to a Price Group, the message appears as many times as the product is assigned to a Price Group. Here is the code I'm using:


    Code:
    <mvt:if expr="g.Basket:cust_id">
    
    <mvt:do name="g.count" file="g.Module_Feature_PGR_DB" value="PriceGroupAndModuleList_Load_Customer( g.basket:cust_id, g.PriceGroups )" />
    
    <mvt:if expr="g.count GT 0">
    <mvt:foreach iterator="customer_pgroup" array="global:PriceGroups">
    <mvt:if expr="l.settings:customer_pgroup:name EQ 'EMPLOYEE 2' OR l.settings:customer_pgroup:name EQ 'PA-118' OR l.settings:customer_pgroup:name EQ 'PA-125'
    OR l.settings:customer_pgroup:name EQ 'PA-128' OR l.settings:customer_pgroup:name EQ 'PA-132' OR l.settings:customer_pgroup:name EQ 'PA-139'
    OR l.settings:customer_pgroup:name EQ 'PA-143' OR l.settings:customer_pgroup:name EQ 'PA-154' OR l.settings:customer_pgroup:name EQ 'Sponsored Team Account'
    OR l.settings:customer_pgroup:name EQ 'Wholesale Group - Turbyna' OR l.settings:customer_pgroup:name EQ 'Employee'">
    
    <mvt:if expr="g.promo_message_customer OR g.promo_price_customer">
    <span class="promo-message"> &mvt:global:promo_message_customer; &mvt:global:promo_price_customer; </span>
    </mvt:if>
    
    </mvt:if>
    </mvt:foreach>
    </mvt:if>
    <mvt:else>
    
    
    <mvt:if expr="g.promo_message OR g.promo_price">
    <span class="promo-message"> &mvt:global:promo_message; &mvt:global:promo_price; </span>
    </mvt:if>
    
    </mvt:if>

    Do you know what is happening?


    Thanks in advance,
    Naomi

    #2
    You need to move your message display outside of the foreach loop.

    Code:
    <mvt:if expr="g.Basket:cust_id">
    
    <mvt:do name="g.count" file="g.Module_Feature_PGR_DB" value="PriceGroupAndModuleList_Load_Customer( g.basket:cust_id, g.PriceGroups )" />
    
    <mvt:if expr="g.count GT 0">
    
    <mvt:foreach iterator="customer_pgroup" array="global:PriceGroups">
    <mvt:if expr="l.settings:customer_pgroup:name EQ 'EMPLOYEE 2' OR l.settings:customer_pgroup:name EQ 'PA-118' OR l.settings:customer_pgroup:name EQ 'PA-125'
    OR l.settings:customer_pgroup:name EQ 'PA-128' OR l.settings:customer_pgroup:name EQ 'PA-132' OR l.settings:customer_pgroup:name EQ 'PA-139'
    OR l.settings:customer_pgroup:name EQ 'PA-143' OR l.settings:customer_pgroup:name EQ 'PA-154' OR l.settings:customer_pgroup:name EQ 'Sponsored Team Account'
    OR l.settings:customer_pgroup:name EQ 'Wholesale Group - Turbyna' OR l.settings:customer_pgroup:name EQ 'Employee'">
    
    <mvt:if expr="g.promo_message_customer OR g.promo_price_customer">
    
    <mvt:assign name="g.promo_customer" value="1" />
    
    </mvt:if>
    
    </mvt:if>
    </mvt:foreach>
    </mvt:if>
    
    
    <mvt:if expr="g.promo_customer EQ 1">
    
    <span class="promo-message"> &mvt:global:promo_message_customer; &mvt:global:promo_price_customer; </span>
    
    <mvt:else>
    
    <mvt:if expr="g.promo_message OR g.promo_price">
    <span class="promo-message"> &mvt:global:promo_message; &mvt:global:promo_price; </span>
    </mvt:if>
    
    </mvt:if>

    Comment


      #3
      to make easier to maintain and more efficient use CIN instead of OR.

      <mvt:if expr="l.settings:customer_pgroup:name CIN 'EMPLOYEE 2,PA-118,PA-128,..." />

      also add this all the way at the beginning of your code

      <mvt:assign name="g.promo_customer" value="0" />

      :
      Andreas Toman
      PCINET, LLC

      Miva Merchant Design, Development, Integration & Support
      We built over 200 Miva Merchant stores!
      Miva shopping cart design & integration service and see our Portfolio!


      e-mail: [email protected]
      web: www.pcinet.com
      LinkedIn: Andreas Toman
      phone: (786) 250-2056 (Miami, FL)

      Comment


        #4
        Hello Andreas,

        Thanks for the response, but still is appearing the message as many times as the product is assigned to a Price Group. Here is the code I'm applying:

        At the beginning of my PROD page code:


        Code:
        <mvt:assign name="g.promo_customer" value="0" />
        Then at the body:

        Code:
         <mvt:if expr="g.Basket:cust_id">
        
        <mvt:do name="g.count" file="g.Module_Feature_PGR_DB" value="PriceGroupAndModuleList_Load_Customer( g.basket:cust_id, g.PriceGroups )" />
        
        <mvt:if expr="g.count GT 0">
        <mvt:foreach iterator="customer_pgroup" array="global:PriceGroups">
        <mvt:if expr="l.settings:customer_pgroup:name CIN 'PA-119,PA-118,PA-125,PA-127,PA-129,PA-137,PA-145,
        PA-155,PA-123,PA-121,PA-131,PA-133,PA-135,PA-141,PA-147,PA-149,PA-151'">
        
        <mvt:if expr="g.promo_message_customer OR g.promo_price_customer">
        <span class="promo-message"> &mvt:global:promo_message_customer; &mvt:global:promo_price_customer; </span>
        </mvt:if>
        
        </mvt:if>
        </mvt:foreach>
        </mvt:if>
        <mvt:else>
        
        
        <mvt:if expr="g.promo_message OR g.promo_price">
        <span class="promo-message"> &mvt:global:promo_message; &mvt:global:promo_price; </span>
        </mvt:if>
        
        </mvt:if>

        So for example, the product ABCD is assigned to Price Group PA-119,PA-118,PA-125, the promo_message appears 3 times and I only need to be 1.

        Do you know what could be happening?

        Thanks,
        Naomi

        Comment


          #5
          Hey! As Leanne pointed out, move the message out of the loop and just set promo_customer to 1. Outside the loop test if promo customer is 1 and display message.
          Andreas Toman
          PCINET, LLC

          Miva Merchant Design, Development, Integration & Support
          We built over 200 Miva Merchant stores!
          Miva shopping cart design & integration service and see our Portfolio!


          e-mail: [email protected]
          web: www.pcinet.com
          LinkedIn: Andreas Toman
          phone: (786) 250-2056 (Miami, FL)

          Comment


            #6
            Thanks Leanne and Andreas! You really help me out :)

            Comment


              #7
              very welcome :)
              Andreas Toman
              PCINET, LLC

              Miva Merchant Design, Development, Integration & Support
              We built over 200 Miva Merchant stores!
              Miva shopping cart design & integration service and see our Portfolio!


              e-mail: [email protected]
              web: www.pcinet.com
              LinkedIn: Andreas Toman
              phone: (786) 250-2056 (Miami, FL)

              Comment


                #8
                Glad we could help :)

                Comment

                Working...
                X