Announcement

Collapse
No announcement yet.

Is there any way to dynamically set a products price?

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

    Is there any way to dynamically set a products price?

    I currently use the external product module, which has various calculations on the page to set the price. I'm looking at moving away from using that module, but I would need to set the price via code rather than having the price set on the product or an attribute. Has there been any newer solutions to this other than the external module?

    #2
    Have you looked into using the JSON API? https://docs.miva.com/json-api/

    Comment


      #3
      The JSON api can work, but this sets the price for all shoppers not a single shopper/basket.

      A couple other options:

      1. Use persistent price groups to dynamically assign or unassign a shopper from a price group controlling the price of the product: https://docs.miva.com/how-to-guides/...-template-code. However this will only work if the pricing is relatively simple

      2. Instead of External module you can use the Donation module which functions similar to what the External module does, allowing you to pass in the price via a input to a form: https://apps.miva.com/donation-manager.html

      3. Update the product price after it was added to the basket via template code.
      Brennan Heyde
      VP Product
      Miva, Inc.
      [email protected]
      https://www.miva.com

      Comment


        #4
        What template code can be used to update the price in the basket? I have toolkits upcharge applying some fees for some products on my basket currently.

        Comment


          #5
          For everyone? Or just some people. For some people, use price groups like Brennan was suggesting. For all, you can use

          Product_Read_Code(l.settings:thisProduct)
          assign price to l.settings:thisProduct:price
          then run
          Product_Update(l.settings:thisProduct)
          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
            I have a "universal pricing" module that may meet your needs. It can set a product price by doing any sort of calculation involving attributes, quantities, other items in the basket, customer identity, etc.
            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


              #7
              I'm checking out the donation module, and I'm wondering if I can use product attributes with it? I see that it comes with its own dropdown that can be added, but I'd like to use more than that. For example, I have a text box attribute called width added on the sku, and so I removed the
              <input type="hidden" name="Product_Attributes:code" value="&mvte:mvdonate:donate_settings:attr_code;">

              code from the donations form, and tried passing this through.
              <input type="hidden" name="Product_Attributes[1]:code" value="Width" />
              <input type="hidden" name="Product_Attributes[1]:value" value="123" />

              But the option doesnt come through to the cart.

              I tried that template code for the basket, but that wasn't exactly what I was looking for, the price of the product is going to change based on the options that are entered, using calculations on numbers that are entered, so the price groups or setting the price in the basket with the code isnt going to work.

              Kent, I'll contact you about your module if the donations module doesnt allow for attributes.
              Last edited by heatherwebdev; 12-14-22, 11:39 AM.

              Comment


                #8
                I can understand the use of a form field in terms of a donation page and correct me if I'm wrong, but I believe allowing the price to be set in a form field could lead to misuse by someone easily changing the value of that field. If memory serves, this was something that had to be corrected in Miva itself many, many moons ago.

                Comment


                  #9
                  Originally posted by TFo View Post
                  I can understand the use of a form field in terms of a donation page and correct me if I'm wrong, but I believe allowing the price to be set in a form field could lead to misuse by someone easily changing the value of that field. If memory serves, this was something that had to be corrected in Miva itself many, many moons ago.
                  true. depends on how you are managing the payment information and how close you can keep an eye out for miscreants.

                  in this case, i'd use a module like Kent's. while it can be done at the SMT layer, it probably shouldn't.
                  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

                  Working...
                  X