Announcement

Collapse
No announcement yet.

Can I know if a product is in a price group on CTGY and PROD?

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

    Can I know if a product is in a price group on CTGY and PROD?

    I have a free shipping price group, and I want to display an image if a product is assigned to the group. Is there a way to know if a product is in a certain price group on the CTGY and PROD pages?

    #2
    Price-group assignments are not normally made available on page templates. If your store has the right "Tool" module, you can use a custom SQL query to read this info. However, I think someone else was asking about this just a few weeks ago. If there's enough interest, I can write a small module to provide the price-group data as template variables, in a convenient array format. You can drop me a line if you're interested in this.

    Thanks --
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      Thanks for the response Kent. That's pretty much what I expected, but I wanted to make sure I wasn't missing something. I'll have to decide whether I'm going to go the old custom product field route or the module route now. I'm thinking the custom field route, while more demanding for store maintenance, would require less resources at page load since I'd be skipping all of the queries.

      Comment


        #4
        Come to think of it, newer versions of MM use in-memory caching, so that the results of a DB query are saved in memory for later use. It may be that the data you need is already in some global variables when the page template is rendered, because the price-group data would be needed to determine what price to display for the product. I can't say for sure without spending some time studying the LSK, and the answer may not even be in there. Maybe someone from in-house can advise on this?

        Thanks --
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment


          #5
          We don't cache it but you can explicitly look it up using this code:

          http://docs.miva.com/code-samples/ch...ned-to-product


          Brennan Heyde
          VP Product
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment


            #6
            That's terrific! I had no idea that there was a code sample section.

            Comment


              #7
              I was trying to use the code sample on CTGY, but it wasn't working properly. Every product on the category page after the first one in the price group would be listed as if it was in the price group too. I added the following code to reset the switch after each use, and now it works fine.

              <mvt:assign name="l.settings:pricegroupvar" value="''" />

              Comment

              Working...
              X