title: Warning: Illegal string offset 'quantity' Opencart 2.1
body: <p>Im trying to resolve this question about 5 hours, but I cant.
  The problem is I have an error
  &quot;Warning: Illegal string offset 'quantity' in C:\laragon\www\opencart\system\library\cart.php on line 211&quot;</p>
  <p>My code from system\library\cart.php</p>
  <pre><code>elseif ($option_query-&gt;row['type'] == 'checkbox_shildik2') {
                          $value = json_decode(json_encode($value),true);
                              foreach ($value as $product_option_value_id =&gt; $data) {
                                  $qnt = (int)$data['quantity'];
                                  if($qnt &gt; 0){
                                      $option_value_query = $this-&gt;db-&gt;query(&quot;SELECT pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM &quot; . DB_PREFIX . &quot;product_option_value pov LEFT JOIN &quot; . DB_PREFIX . &quot;option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN &quot; . DB_PREFIX . &quot;option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '&quot; . (int)$product_option_value_id . &quot;' AND pov.product_option_id = '&quot; . (int)$product_option_id . &quot;' AND ovd.language_id = '&quot; . (int)$this-&gt;config-&gt;get('config_language_id') . &quot;'&quot;);
                                      $qnt = (int)$qnt;
                                      if ($option_value_query-&gt;num_rows) {
                                          if ($option_value_query-&gt;row['price_prefix'] == '+') {
                                              $option_price += $qnt*$option_value_query-&gt;row['price'];
                                          } elseif ($option_value_query-&gt;row['price_prefix'] == '-') {
                                              $option_price -= $qnt*$option_value_query-&gt;row['price'];
                                          }
  
                                          if ($option_value_query-&gt;row['points_prefix'] == '+') {
                                              $option_points += $qnt*$option_value_query-&gt;row['points'];
                                          } elseif ($option_value_query-&gt;row['points_prefix'] == '-') {
                                              $option_points -=$qnt* $option_value_query-&gt;row['points'];
                                          }
  
                                          if ($option_value_query-&gt;row['weight_prefix'] == '+') {
                                              $option_weight += $qnt*$option_value_query-&gt;row['weight'];
                                          } elseif ($option_value_query-&gt;row['weight_prefix'] == '-') {
                                              $option_weight -= $qnt*$option_value_query-&gt;row['weight'];
                                          }
  
                                          if ($option_value_query-&gt;row['subtract'] &amp;&amp; (!$option_value_query-&gt;row['quantity'] || ($option_value_query-&gt;row['quantity'] &lt; $qnt * $cart['quantity']))) {
                                              $stock = false;
                                          }
  
                                          $option_data[] = array(
                                              'product_option_id'       =&gt; $product_option_id,
                                              'product_option_value_id' =&gt; $product_option_value_id,
                                              'option_id'               =&gt; $option_query-&gt;row['option_id'],
                                              'option_value_id'         =&gt; $option_value_query-&gt;row['option_value_id'],
                                              'name'                    =&gt; $qnt.' x '.$option_query-&gt;row['name'],
                                              'value'                   =&gt; $option_value_query-&gt;row['name'],
                                              'type'                    =&gt; $option_query-&gt;row['type'],
                                              'quantity'                =&gt; $option_value_query-&gt;row['quantity'],
                                              'subtract'                =&gt; $option_value_query-&gt;row['subtract'],
                                              'price'                   =&gt; $qnt*$option_value_query-&gt;row['price'],
                                              'price_prefix'            =&gt; $option_value_query-&gt;row['price_prefix'],
                                              'points'                  =&gt; $qnt*$option_value_query-&gt;row['points'],
                                              'points_prefix'           =&gt; $option_value_query-&gt;row['points_prefix'],
                                              'weight'                  =&gt; $qnt*$option_value_query-&gt;row['weight'],
                                              'weight_prefix'           =&gt; $option_value_query-&gt;row['weight_prefix']
                                          );
                                      }
                                  }
                      }
                      }
  </code></pre>
  <p>So when I click on add to cart, I have Unexpected token json.
  I dont know even how to resolve this and whats the problem</p>
  <p>211 line is $qnt = (int)$data['quantity'];</p>