Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:55:13+00:00 2026-06-04T15:55:13+00:00

I am developing an option in Magento where the customer can enter multiple product

  • 0

I am developing an option in Magento where the customer can enter multiple product ID’s in a text box and add them to Shopping Cart.
I have been able to do it for only one product ID where it is entered in a input box by using the following jquery,

$(document).ready(function(){
        $("#submit").click(function(){
            var id = $("#nam").val();
            $.post("....../checkout/cart/add", { product:id },
            function(data) {
                alert("The Product is added to your shopping cart.");
                window.location.reload(true);
            });
        });
    });

var id fetches the value of the input box.

In an input box I am taking one product ID and so it’s no problem in fetching the value and passing it to the add product page by using jquery.post().
But if I enter several product ID’s separated by comma in a text box how will I fetch each productID and send it to add product page for updating ?
Is there any better way to do it other than using jquery.post() method ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:55:15+00:00Added an answer on June 4, 2026 at 3:55 pm

    You can split your Ids by a separator and iterate over the resulting array adding the items to the shopping card. Something like:

    $(document).ready(function(){
            $("#submit").click(function(){
                var ids = $("#nam").val().split(' '); // SPACE seperated Ids
                for(i = 0; i < ids.length; i++){
                  var id = ids[i];
                  $.post("....../checkout/cart/add", { product:id },
                  function(data) {
                    //alert("The Product is added to your shopping cart.");
                    //window.location.reload(true);
                  });
                }
            });
        });
    

    You will have to sanitize your textbox values before doing so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to magento. Currently i'm developing two ecommerce sites using multi-store option in
I am developing an application Android to have the option to reduce the size
I am developing android application in which i have to open option menu from
I have come across a bizarre error in the Magento shop I'm developing and
I'm developing a website in flash which have the option to be displayed in
I am new to ios developing. I have using a camera option in my
i am developing an application in which i have a logout option at all
I have a MYSQL server setup. What are my option for developing a IOS
I'm developing an iphone app and want to have the option to programmatically change
I'm developing a feeder application, and i have the option that let the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.