add t ocart link for products with attributes
hi, I'm hoping someone can help me, I need an url, a link to add product to cart, but with attributes, say the product id is "x" and product has 1 attribute, flavour, wiht 3 posible values (cho, vanilla and strawberry), I need a link that would add the product to the cart with vanilla selected, and then direct you to the shopping cart.
Best Regards
Joćo Mustra
add products to cart from any url, including attributes
hi, I'm hoping someone can help me, I need an url, a link to add product to cart, but with attributes, say the product id is "x" and product has 1 attribute, flavour, wiht 3 posible values (cho, vanilla and strawberry), I need a link that would add the product to the cart with vanilla selected, and then direct you to the shopping cart.
Best Regards
Joćo Mustra
Re: add products to cart from any url, including attributes
Duplicate posts merged. Please don't re-post the same thing over and over again in multiple places.
Re: add t ocart link for products with attributes
Quote:
Originally Posted by
joricam
I need an url, a link to add product to cart, but with attributes, say the product id is "x" and product has 1 attribute, flavour, wiht 3 posible values (cho, vanilla and strawberry), I need a link that would add the product to the cart with vanilla selected, and then direct you to the shopping cart.
You cannot do that with a URL. Attribute-selections are not auto-selectable via any URL parameters. Only via <form> POST data.
You would need to build a <form> with all the corresponding <input> fields embedded in it with all your predefined values. You would have to reverse-engineer that by studying the dynamically-generated product page and recreating the HTML for your very unique needs. And remember that when you do that you cannot change those attributes in the admin without it affecting the <form> data, and then you'll have to manually rebuild that <form> again after making those edits.
Why are you trying to skip the main product page in Zen Cart, when it already intelligently does all the magic you're looking for? If it's because you want the page to look different, then just style it according to your needs instead of reinventing the wheel.
Re: add t ocart link for products with attributes
Hello DrByte, I was exactly looking for you!! Yes its not a problem to use post, I can even use it with jquery post, I really need this badly, it's not to style the page, its so that I can include this in a facebook app that posts open graph objects with a link to add the product directly to the cart, please show me the url structure, the post variables and affected files please.
Best Regards
Joćo Mustra
Re: add t ocart link for products with attributes
You can see all the details in the generated HTML page source for your product when you view the product in your store.