Opencart 3.0.3.2-在Ajax + Twig上抓取多维数组

时间:2019-12-16 02:19:27

标签: php arrays ajax twig

早上好,我在尝试在admin / view / template / catalog / product_form.twig ajax函数上获取数组以将其显示到自定义<select>中时遇到了一些麻烦,该数组由{{1 }}在admin / controller / catalog / option.php上运行,新的数组值存储在autocomplete()中。 我一直在把诸如将'parent_option_value' => $parent_option_value_data更改为$('#option-values' + option_row)之类的东西和其他元素都搞砸了。

新的 array()确实获取了数据,但是Im无法在第一个$('#parent-option-values' + option_row)上显示其值。 我需要添加和更改什么才能使该数组显示为第二个选项值<select>呢?

admin / view / template / catalog / product_form.twig

<select>

admin / controller / catalog / option.php

      <!-- The Array I Need -->
      if (parent_option_id > 0) {
          html += '  <td class="text-left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][option_value_id]" class="form-control">';
          html += $('#option-values' + option_row).html();
          html += '  </select><input type="hidden" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][product_option_value_id]" value="" /></td>';
      }
      <!--/ The Array I Need /-->

      html += '  <td class="text-left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][option_value_id]" class="form-control">';
      html += $('#option-values' + option_row).html();
      html += '  </select><input type="hidden" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][product_option_value_id]" value="" /></td>';

0 个答案:

没有答案