title: Opencart 3 get the product option in Latest Product view
body: <p>I am modifying the OpenCart default theme and I want to get the the product options on the latest product view page.</p>
  
  <p>I copied this code from the product view page:</p>
  
  <pre><code>{% if options %}
   &lt;hr&gt;
   &lt;h3&gt;{{ text_option }}&lt;/h3&gt;
  
   {% for option in options %}
  
    {% if option.type == 'select' %}
    &lt;div class="form-group{% if option.required %} required {% endif %}"&gt;
    &lt;label class="control-label" for="input-option{{ option.product_option_id }}"&gt;{{ option.name }}&lt;/label&gt;
    &lt;select name="option[{{ option.product_option_id }}]" id="input-option{{ option.product_option_id }}" class="form-control"&gt;
    &lt;option value=""&gt;{{ text_select }}&lt;/option&gt;
    {% for option_value in option.product_option_value %}
    &lt;option value="{{ option_value.product_option_value_id }}"&gt;{{ option_value.name }}
    {% if option_value.price %}
    ({{ option_value.price_prefix }}{{ option_value.price }})
     {% endif %} &lt;/option&gt;
     {% endfor %}
    &lt;/select&gt;
  &lt;/div&gt;
  {% endfor %}
  {% endif %}
  </code></pre>
  
  <p>I copied this code in <code>catalog/controller/extention/module/latest.php</code></p>
  
  <pre><code>$data['options'] = array();
  
      foreach ($this-&gt;model_catalog_product-&gt;getProductOptions($this-&gt;request-&gt;get['product_id']) as $option) {
          $product_option_value_data = array();
  
          foreach ($option['product_option_value'] as $option_value) {
              if (!$option_value['subtract'] || ($option_value['quantity'] &gt; 0)) {
                  if ((($this-&gt;config-&gt;get('config_customer_price') &amp;&amp; $this-&gt;customer-&gt;isLogged()) || !$this-&gt;config-&gt;get('config_customer_price')) &amp;&amp; (float)$option_value['price']) {
                      $price = $this-&gt;currency-&gt;format($this-&gt;tax-&gt;calculate($option_value['price'], $product_info['tax_class_id'], $this-&gt;config-&gt;get('config_tax') ? 'P' : false), $this-&gt;session-&gt;data['currency']);
                  } else {
                      $price = false;
                  }
  
                  $product_option_value_data[] = array(
                      'product_option_value_id' =&gt; $option_value['product_option_value_id'],
                      'option_value_id'         =&gt; $option_value['option_value_id'],
                      'name'                    =&gt; $option_value['name'],
                      'image'                   =&gt; $this-&gt;model_tool_image-&gt;resize($option_value['image'], 50, 50),
                      'price'                   =&gt; $price,
                      'price_prefix'            =&gt; $option_value['price_prefix']
                  );
              }
          }
  
          $data['options'][] = array(
              'product_option_id'    =&gt; $option['product_option_id'],
              'product_option_value' =&gt; $product_option_value_data,
              'option_id'            =&gt; $option['option_id'],
              'name'                 =&gt; $option['name'],
              'type'                 =&gt; $option['type'],
              'value'                =&gt; $option['value'],
              'required'             =&gt; $option['required']
          );
      }
  </code></pre>
  
  <p>And i get</p>
  
  <pre><code> Undefined index: product_id in F:\xampp\htdocs\*\catalog\controller\extension\module\latest.php
  </code></pre>
  
  <p>In the <code>foreach</code> parameter </p>
  
  <pre><code>$this-&gt;request-&gt;get['product_id'])
  </code></pre>
  
  <p>The above <code>product_id</code> is <code>Undefined</code>, Any suggestions?</p>