How To Inject Products Into The Cart

I need to add items to the cart in the cart page by JS code.
Could someone point me to the information required for this or some sample code?

Thanks,

Nir B

I need to add items to the cart in the cart page by JS code.
Could someone point me to the information required for this or some sample code?

Thanks,

Nir B

Please clarify the purpose of this functionality?

Please clarify the purpose of this functionality?

Cross sell - offer complementary products with add to cart button.

Are you selling these or simply adding a link so that add-to-cart takes the customer to the product owner's site for purchase?

You can't sell any products that you don't have setup as products in your backend.

I've you're wanting to list the products on a product listing page and then alter the 'add-to-cart' button to be a link off-site, then you can do that from the backend using hooks (that use whatever product data you get from your JS) but to add to the listings in JS would be difficult and would take a change per product listing template.

Alternatively, you could simply add an html/smarty block to the layouts and add whatever JS code you want there to present the list of additional products.

Suggest you present the "problem" and let some of us who've been around for a while help you solve the problem rather than giving us a solution and then ask how to do it.

Please pay attention to our Up-sells And Cross-sells module