No announcement yet.

Getting prices for all attributes on PROD

  • Filter
  • Time
  • Show
Clear All
new posts

    Getting prices for all attributes on PROD

    For structured data purposes, I need to get all variants and their prices on the PROD page. I found this code sample:
    However, it assumes pricing is being controlled by the variant product. These products have pricing set by master + attributes/options.

    Any ideas? Basically I need a function that takes a master product and its variant, and returns the price. Alternatively, it could return a list of attributes/options that determine that variant, and I can calculate the price.

    The closest I seem to be able to get is the variant_options member of the variant, but for products that depend on two or more attributes, that has the option codes separated by a delimiter. I'd prefer not to assume that the "_" is always used as the delimiter, but that's the only way I can think to split it out.

    Hopefully I'm just overlooking the obvious.

    Susan Petracco



    Like us on Facebook

    Maybe I'm not following but wouldn't you just do some assigns in the attribute template to add up all the possible combinations (using miva_variable_value()) and then stack them using LT/GT to get the least and most expensive combo? (I suppose if you want to be real clever, you could stuff the variables into an array and then sort them Low to High then High to Low.)

    IOW: I don't think miva has variables for this. If you are keen on JS or jQuery you could also do this at the DOM layer...
    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


      I've done some projects similar to this; I may have some code that can be copied and pasted into a solution for you. You can email me to discuss this in detail.

      Thanks --
      Kent Multer
      Magic Metal Productions
      * Web developer/designer
      * E-commerce and Miva
      * Author, The Official Miva Web Scripting Book -- available on-line: