Add product with attributes from URL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tberry
    Mini Mivite

    • Nov 2022
    • 24

    #1

    Add product with attributes from URL

    Hi,
    We have a non-Miva website with URLs that add products into a Miva basket on our Miva website that we use for checkout. I am able to do this with the Action=ADPR and also Action=ADPM, but I am not able to get it to work adding a product with attributes. The best I have been able to do is to add the product and then if it has attributes it open the Attributes in bold are required. screen and the customer has to pick them from that screen. Here are a few of the things I have tried without success. Is it possible to add products with attributes to the basket from a URL? Thank you!

    mm5/merchant.mvc?SCREEN=BASK&Store_Code=cartdataq&Acti on=ADPR&Product_Code=TC-JWB2-C&Attributes=Yes&Product_Attributes[1]:code=TC_Custom&Product_Attributes[1]:template_code=TC_Feet&Product_Attributes[1]:value=TC_35&Quantity=1

    mm5/merchant.mvc?Action=ADPM&Products[1]:code=TC-JWB2-C&Products[1]:quantity=1&Products[1]:attributes[1]:value=TC_35&Screen=BASK

  • alphabet
    Mega Mivite





    • Aug 2006
    • 1160

    #2
    Try adding the attribute count in the URL:

    Code:
    Product_Attribute_Count=2
    http://www.alphabetsigns.com/

    Comment

    • tberry
      Mini Mivite

      • Nov 2022
      • 24

      #3
      Thank you for your help. I have tried adding that for both the ADPR and ADPM method with no luck. If I do this url:

      /mm5/merchant....uct_Attributes[1]:code=TC_Custom&Product_Attributes[1]:template_code=TC_Feet&Product_Attributes[1]:value=TC_35&Product_Attribute_Count=1&Quantity=1

      It goes to the Attributes in bold are required. screen. If I take out the Attributes=Yes then it adds the product without any attributes even though they are required.
      Last edited by tberry; 01-29-25, 10:50 AM.

      Comment

      • Nick
        Super Moderator











        • Dec 2011
        • 575

        #4
        tberry This seemed to work for me:

        Code:
        ...?SCREEN=BASK&Store_Code=cartdataq&Action=ADPR&Product_Code=TC-JWB2-C&Product_Attributes[1]:code=TC_Custom&Product_Attributes[1]:template_code=TC_Feet&Product_Attributes[1]:value=TC_35&Quantity=1
        Nicholas Adkins
        Technical Training Specialist / Miva, Inc.
        [email protected]
        https://www.miva.com/mivalearn

        Comment

        • Kent Multer
          Mega Mivite









          • Mar 2006
          • 3251

          #5
          Are you sure that you have the correct values for :code and :template_code? IIRC there's this quirk where, if the attribute is from a template, you put the template's code in the :code parameter, and the product's code in :template_code. Kind of counter-intuitive.
          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

          • tberry
            Mini Mivite

            • Nov 2022
            • 24

            #6
            Originally posted by Nick View Post
            tberry This seemed to work for me:

            Code:
            ...?SCREEN=BASK&Store_Code=cartdataq&Action=ADPR&Product_Code=TC-JWB2-C&Product_Attributes[1]:code=TC_Custom&Product_Attributes[1]:template_code=TC_Feet&Product_Attributes[1]:value=TC_35&Quantity=1
            Nick - sorry, I left the &Attributes=Yes out of that so when it is adding it to the basket it does not have the attributes. Here is the url with Attributes=Yes and you can see it just goes to the Attributes required screen.

            /mm5/merchant....uct_Attributes[1]:code=TC_Custom&Product_Attributes[1]:template_code=TC_Feet&Product_Attributes[1]:value=TC_35&Quantity=1
            Last edited by tberry; 02-03-25, 05:37 AM.

            Comment

            • tberry
              Mini Mivite

              • Nov 2022
              • 24

              #7
              Originally posted by Kent Multer View Post
              Are you sure that you have the correct values for :code and :template_code? IIRC there's this quirk where, if the attribute is from a template, you put the template's code in the :code parameter, and the product's code in :template_code. Kind of counter-intuitive.
              Kent, thank you, I tried switching the code and template code with the same result of landing on the Attributes required screen. I also tried a different product not using the template at all and am getting the same result. /mm5/merchant....uct_Attributes[1]:code=TC_KFeet&Product_Attributes[1]:value=TC_35&Quantity=1
              Last edited by tberry; 02-03-25, 05:37 AM.

              Comment

              • alphabet
                Mega Mivite





                • Aug 2006
                • 1160

                #8
                I haven't seen the &Attributes=Yes parameter. Are you using a third party module?
                http://www.alphabetsigns.com/

                Comment

                • tberry
                  Mini Mivite

                  • Nov 2022
                  • 24

                  #9
                  Originally posted by alphabet View Post
                  I haven't seen the &Attributes=Yes parameter. Are you using a third party module?
                  No 3rd party module. I'm actually not sure where I got the &Attributes=Yes part of the URL, but when it is there it requires the attributes and when it is not the URL just adds the product with no attributes so I figured it was just telling Miva to require the attributes? I have actually tried on and off for years to add a product with attributes via the URL with no luck so if anyone has a working example that would be awesome! When I was adding these new products I searched the forum for an answer and found one post of someone having the same problem and then I realized I had posted it in 2014, haha. https://www.miva.com/forums/forum/on...-non-miva-site

                  I appreciate your help

                  Comment

                  • Nick
                    Super Moderator











                    • Dec 2011
                    • 575

                    #10
                    tberry When I use this URL:

                    Add to Basket

                    The functionality works, I am directed to the BASK page with the item in the basket.

                    Nicholas Adkins
                    Technical Training Specialist / Miva, Inc.
                    [email protected]
                    https://www.miva.com/mivalearn

                    Comment

                    • tberry
                      Mini Mivite

                      • Nov 2022
                      • 24

                      #11
                      [QUOTE=Nick;n723963]tberry This seemed to work for me:

                      Thanks Nick, that link does not have the &Attributes=Yes in it and so it works but does not have the attributes or correct pricing for the product.

                      I am hoping that someone can provide me with a working URL example for another website or something that adds the product to the basket with the attributes.

                      Comment

                      • afiumano
                        Mighty Mivite




                        • Dec 2010
                        • 765

                        #12
                        tberry It appears that the 'value' should be 'TC-35' instead of 'TC_35'. Try this:
                        Code:
                        https://cart.dataq.com/mm5/merchant.mvc?SCREEN=BASK&Store_Code=cartdataq&Action=ADPR&Product_Code=TC-JWB2-C&Product_Attributes[1]:code=TC_Custom&Product_Attributes[1]:template_code=TC_Feet&Product_Attributes[1]:value=TC-35&Quantity=1

                        Comment

                        • alphabet
                          Mega Mivite





                          • Aug 2006
                          • 1160

                          #13
                          afiumano Good grab!
                          http://www.alphabetsigns.com/

                          Comment

                          • tberry
                            Mini Mivite

                            • Nov 2022
                            • 24

                            #14
                            Thank you so much!!! I embarrassed that's what it was but I am so glad you caught it!

                            Comment

                            Working...
                            X