Announcement

Collapse
No announcement yet.

Miva 9.6, one click add prod to cart with pre-selected attribute values

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

    Miva 9.6, one click add prod to cart with pre-selected attribute values

    Hello All,

    I know this code is correct for adding a product to the cart. But it is not passing the selected (required) attributes with the add action. Can anyone tell me what I have wrong with the attributes part of the code?

    <form method="post" action="&mvte:global:sessionurl;Screen=BASK">
    <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" />
    <input type="hidden" name="Action" value="ADPR">

    <input type="hidden" name="Product_Code" value="12345" />
    <input type="hidden" name="Products_Attributes[1]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[2]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[3]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[4]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[5]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[6]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[7]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[8]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[9]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[10]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[11]:value" value="Blue" />
    <input type="hidden" name="Products_Attributes[12]:value" value="Blue" />
    <input type="hidden" name="Quantity" value="1" />

    <input type="submit" value="Add to Basket">
    </form>


    Thank you,
    Sean Harrell
    Southland Trade Corp.

    #2
    I think you are missing in the form:
    Product_Attribute_Count, Product_Attributes[XX]:code
    Andreas Toman
    PCINET, LLC

    Miva Merchant Design, Development, Integration & Support
    We built over 200 Miva Merchant stores!
    Miva shopping cart design & integration service and see our Portfolio!


    e-mail: [email protected]
    web: www.pcinet.com
    LinkedIn: Andreas Toman
    phone: (786) 250-2056 (Miami, FL)

    Comment


      #3
      I modified it to this and it still does not work. There is reference on the forum a ways back (from a Miva support rep) to Miva having removed the need for Product_Attribute_Count, so I left that out. Tried it as well and it made no difference.

      <form method="post" action="&mvte:global:sessionurl;Screen=BASK">
      <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" />
      <input type="hidden" name="Old_Screen" value="PROD" />

      <input type="hidden" name="Action" value="ADPR">

      <input type="hidden" name="Product_Code" value="12345" />

      <input type="hidden" name="Product_Attributes[1]:code" value="allcolors" />
      <input type="hidden" name="Product_Attributes[1]:template_code" value="Color1" />
      <input type="hidden" name="Products_Attributes[1]:value" value="Blue" />

      <input type="hidden" name="Product_Attributes[2]:code" value="allcolors" />
      <input type="hidden" name="Product_Attributes[2]:template_code" value="Color2" />
      <input type="hidden" name="Products_Attributes[2]:value" value="Blue" />

      <input type="hidden" name="Quantity" value="1" />

      <input type="submit" value="Add to Basket">

      </form>

      This all pretty much matches the source of the same product as submitted on the actual product page. But I am trying to add a one click order button elsewhere that pre-selects the attributes and places the item in the cart.
      Sean Harrell
      Southland Trade Corp.

      Comment


        #4
        That all looks correct, that happens when you try and add it? Does it take you to the missing product attributes page? If so confirm the product attribute code and values are correct. These have to match with actually attribute code/value.

        A simple trick for this, is on the Product page, use the browsers developer tool to change the form action from POST to GET. It should then show you all the name/value pairs you need for the attributes in the URL.
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment

        Working...
        X