Announcement

Collapse
No announcement yet.

Price Group Message

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

    Price Group Message

    I need to display a message next to a product in a Price Group, but only to customers in that Price Group

    This code puts the message next to only products in the Price Group but shows the message to everyone:

    Code:
    <mvt:do file="g.Module_Feature_PGR_DB" name="l.ok" value="PriceGroup_Load_Name( 'Barrys_Tea_10_1', l.price_group )" />
    <mvt:if expr="l.price_group:id GT 0">
    <mvt:do file="g.Module_Feature_PGR_DB" name="l.b" value="PriceGroupXProduct_Load( l.price_group:id , l.settings:product:id, l.settings:pricegroupvar )" />
    <mvt:if expr="NOT ISNULL l.settings:pricegroupvar">
    <span class="category-product-flag volume">Barry's Deal</span>
    </mvt:if>
    
    </mvt:if>
    <mvt:assign name="l.settings:pricegroupvar" value="''"/>
    This shows the message to only those in the Price Group, but shows it next to every product:

    Code:
    <mvt:if expr="g.Basket:cust_id">
    <mvt:do name="l.result" file="g.Module_Feature_PGR_DB" value="PriceGroup_Load_Name( 'Barrys_Tea_10_1', l.pricegroup )" />
    <mvt:if expr="l.result">
    <mvt:do name="l.exists" file="g.Module_Feature_PGR_DB" value="PriceGroupXCustomer_Load( l.pricegroup:id, g.Basket:cust_id, l.null )" />
    <mvt:if expr="l.exists">
    <mvt:assign name="g.basket:customer:Barrys_Tea_10_1" value="1" />
    </mvt:if>
    </mvt:if>
    </mvt:if>
    <mvt:if expr="g.basket:customer:Barrys_Tea_10_1">
    <span class="category-product-flag volume">BARRY'S DEAL</span>
    </mvt:if>
    This one is just a bit beyond me (but will probably make perfect sense when I see it).

    Note: I do not know why one uses l.price_group and one uses l.pricegroup

    Thanks,
    Leslie
    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

    #2
    The second code snippet is the one you need as the first just checks to see whether the price group exists the second tests to see if custom is assigned.

    It shows for all products because you need to null out the test condition (l.exists and l.result) after each product call.

    (the difference in the return var result is just a stylistic one. personally i don't string words together any more--i.e., price_group verses pricegroup--Just easier to read.)
    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


      #3
      Originally posted by Bruce - PhosphorMedia View Post
      The second code snippet is the one you need as the first just checks to see whether the price group exists the second tests to see if custom is assigned.

      It shows for all products because you need to null out the test condition (l.exists and l.result) after each product call.

      (the difference in the return var result is just a stylistic one. personally i don't string words together any more--i.e., price_group verses pricegroup--Just easier to read.)
      I need to double-check something, because when I test the second code, it seems to be displaying the flag next to every product. I am now wondering if the store owner has misassigned products. Let me double check that and I will follow up here.

      As for how the code is written, they are samples directly from Miva's developer docs...

      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


        #4
        Originally posted by lesliekirk View Post

        I need to double-check something, because when I test the second code, it seems to be displaying the flag next to every product. I am now wondering if the store owner has misassigned products. Let me double check that and I will follow up here.

        As for how the code is written, they are samples directly from Miva's developer docs...
        Yeah, I'm not going that crazy (yet). There are only 10 products assigned to the Price Group. 168 customers, 0 Collections, 0 Categories. The first snippet does show the 10 products assigned to the "Barry" Price Group. If the customer is not assigned to the Barry price group (but is logged in), they can still see the "Barry" flag. Only the customers assigned to the "Barry" Price Group are supposed to see the "Barry" flag when they are logged in.

        If I use the second snippet as Bruce - PhosphorMedia suggested, it displays the "Barry" flag next to every product in the store as long as the customer is assigned to the "Barry" Price Group.

        ​​​​​​​Nope, we are not there yet.
        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
          Try adding:

          <mvt:assign name="g.basket:customer:Barrys_Tea_10_1" value="''" />

          After the closing </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


            #6
            Originally posted by Bruce - PhosphorMedia View Post
            Try adding:

            <mvt:assign name="g.basket:customer:Barrys_Tea_10_1" value="''" />

            After the closing </mvt:if>
            Will that only display the products that are assigned to the "Barry" Price Groups to these assigned customers?
            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

            Working...
            X