title: magento add multiple products to cart from wishlist through check box
body: <p><strong>Scenario:</strong><br> Want to add multiple products to cart from wishlist through check box, such that the selected products along with their quantity are transferred to cart and the selected items are removed from the wishlist table.<br>
  Referred many blogs.<br>
  I tried to implement it by (applying) adding related-products javascript (logic).<br>But still not getting.<br></p>
  
  <p><strong>[updated]</strong></p>
  
  <p>This is the checkbox column (time being hard code)</p>
  
  <pre><code>&lt;input type="checkbox" class="checkbox related-checkbox" id="related-checkbox7" name="related_products[]" value="7"&gt;
  </code></pre>
  
  <p>Added Javascript for this part:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
      $$('.related-checkbox').each(function(elem){
          Event.observe(elem, 'click', addRelatedToProduct)
      });
  
      var relatedProductsCheckFlag = false;
      function selectAllRelated(txt){
          if (relatedProductsCheckFlag == false) {
              $$('.related-checkbox').each(function(elem){
                  elem.checked = true;
              });
              relatedProductsCheckFlag = true;
              txt.innerHTML="unselect all";
          } else {
              $$('.related-checkbox').each(function(elem){
                  elem.checked = false;
              });
              relatedProductsCheckFlag = false;
              txt.innerHTML="select all";
          }
          addRelatedToProduct();
      }
  
      function addRelatedToProduct(){
          var checkboxes = $$('.related-checkbox');
          var values = [];
          for(var i=0;i&lt;checkboxes.length;i++){
              if(checkboxes[i].checked) values.push(checkboxes[i].value);
          }
          if($('related-products-field')){
              $('related-products-field').value = values.join(',');
          }
      }
      //]]&gt;
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>Add to cart</strong><br> <code>&lt;button type="button" title="Add to Cart" class="button btn-cart" onclick="productAddToCartForm.submit(this)"&gt;&lt;span&gt;&lt;span&gt;Add to Cart&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;</code></p>
  
  <p>And javascript for this part:<br></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
          var productAddToCartForm = new VarienForm('product_addtocart_form');
          productAddToCartForm.submit = function(button, url) {
              if (this.validator.validate()) {
                  var form = this.form;
                  var oldUrl = form.action;
  
                  if (url) {
                     form.action = url;
                  }
                  var e = null;
                  try {
                      this.form.submit();
                  } catch (e) {
                  }
                  this.form.action = oldUrl;
                  if (e) {
                      throw e;
                  }
  
                  if (button &amp;&amp; button != 'undefined') {
                      button.disabled = true;
                  }
              }
          }.bind(productAddToCartForm);
  
          productAddToCartForm.submitLight = function(button, url){
              if(this.validator) {
                  var nv = Validation.methods;
                  delete Validation.methods['required-entry'];
                  delete Validation.methods['validate-one-required'];
                  delete Validation.methods['validate-one-required-by-name'];
                  // Remove custom datetime validators
                  for (var methodName in Validation.methods) {
                      if (methodName.match(/^validate-datetime-.*/i)) {
                          delete Validation.methods[methodName];
                      }
                  }
  
                  if (this.validator.validate()) {
                      if (url) {
                          this.form.action = url;
                      }
                      this.form.submit();
                  }
                  Object.extend(Validation.methods, nv);
              }
          }.bind(productAddToCartForm);
      //]]&gt;
      &lt;/script&gt;
  </code></pre>
  
  <p>Thanks in advance</p>