0

I have a SWF file on my Magento site that allows customers to pick from options and get a visual representation of the resulting product. This SWF file then outputs half a dozen or so parameters and 2 images that are all written to a database. All of this works fine.

My question is how do I add a product to the Magento cart that has some of this information (even if it is just the db key from the other db) attached to it?

I have thought about creating lots of blank hidden products and adding the product with the same id as the db key to the cart by forwarding the browser to [Magento URL]/index.php/checkout/cart/add/uenc/,/product/[db Key\product ID]/ or programmatically create a new product but I feel there must be a better way as I just want to configure a configurable product and submit a hidden integer and string .

Thanks in advance, Norman

Norman_SK
  • 35
  • 2
  • 8
  • What can you send from flash to web-server? ID? SKU? Qtty? Magento can add product to cart in around 10 rows of code. If you have two IDs (primary db and magento db) you can make relative table where primary_id1=magento_id2 and execute sql (plus 5-7 of code rows) followed by adding to cart – P0ZiTR0N Sep 11 '14 at 17:40
  • Thanks for the comment. It can pass whatever it needs to as it is currently done with GET. The ids do not need to be the same, that was just an idea. Ideally what would happen is that the configurable product options will be set using GET variables and then added to the cart. This would need to include 2 hidden options. – Norman_SK Sep 11 '14 at 18:47
  • I have found http://stackoverflow.com/questions/1315578/how-to-get-the-url-to-a-configurable-item-in-magento. This looks like the way to go. I will give it a try. – Norman_SK Sep 11 '14 at 18:59

1 Answers1

0

Ok so what I have done is:

  1. Browsed to the product in question on the Magento shop.
  2. Used Chrome's "Inspect element" on the configurable items dropdowns and got the HTML e.g. <select name="super_attribute[134]" id="attribute134" class="required-entry super-attribute-select"> for each one.
  3. For each select, expanded the select and found the option values e.g. <option value="4" price="0">Option 1</option>.
  4. Browsed to [Magento URL]/index.php/checkout/cart/add?product=[Product ID]&qty=1&[name from select]=[Value from option] e.g. [Magento URL]/index.php/checkout/cart/add?product=123&qty=1&super_attribute[134]=4.

This added product 123 with the attribute as "Option 1" to the cart.

:)

Norman_SK
  • 35
  • 2
  • 8