title: Opencart cart.add() with option
body: <p>I'm looking for solution in opencart.</p>
  
  <p>Need to rebuild cart.add function for adding product with option value.</p>
  
  <p>By default:</p>
  
  <pre><code>'add': function(product_id, quantity) {
      $.ajax({
          url: 'index.php?route=checkout/cart/add',
          type: 'post',
          data: 'product_id=' + product_id + '&amp;quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
          dataType: 'json',
          beforeSend: function() {
              $('#cart &gt; button').button('loading');
          },
          success: function(json) {
              $('.alert, .text-danger').remove();
  
              $('#cart &gt; button').button('reset');
  
              if (json['redirect']) {
                  location = json['redirect'];
              }
  
              if (json['success']) {
                  $('#content').parent().before('&lt;div class="alert alert-success"&gt;&lt;i class="fa fa-check-circle"&gt;&lt;/i&gt; ' + json['success'] + '&lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;&lt;/div&gt;');
  
                  $('#cart-total').html(json['total']);
  
                  $('html, body').animate({ scrollTop: 0 }, 'slow');
  
                  $('#cart &gt; ul').load('index.php?route=common/cart/info ul li');
              }
          }
      });
  </code></pre>
  
  <p>checkout/cart/add php side for option: </p>
  
  <pre><code>        if (isset($this-&gt;request-&gt;post['option'])) {
              $option = array_filter($this-&gt;request-&gt;post['option']);
          } else {
              $option = array();
          }
  </code></pre>
  
  <p>Any solutions? </p>