opencart中签出页面中的自定义字段

opencart中签出页面中的自定义字段,opencart,vqmod,Opencart,Vqmod,我是opencart和php的新手。我试图用opencart建立一个在线商店。 我正在尝试在签出页面中添加自定义字段。 我使用的是OC1.5.4。 下面是我写的vqmod。问题是该表没有得到更新 请帮帮我,我哪里做错了 <modification> <id>Custom Field in checkout</id> <version>1</version> <vqmver>2.4</vqmver> <aut

我是opencart和php的新手。我试图用opencart建立一个在线商店。 我正在尝试在签出页面中添加自定义字段。 我使用的是OC1.5.4。 下面是我写的vqmod。问题是该表没有得到更新

请帮帮我,我哪里做错了

<modification>
<id>Custom Field in checkout</id>
<version>1</version>
<vqmver>2.4</vqmver>
<author>arun</author>
<file name="catalog/view/theme/bigshop/template/checkout/shipping_method.tpl">
    <operation>
        <search position="before"><![CDATA[
            <p><?php echo $text_shipping_method; ?></p>
        ]]></search>
        <add><![CDATA[
            <p><?php echo $text_shipping_timeslot; ?></p>
            <table class="radio">

      <tr class="highlight">
        <td colspan="3"><b><?php echo "Delivery time slot"; ?></b></td>
      <td>
         <input type="text" name="selection" value="<?php echo $selection; ?>" id="selection"? 
         </td>
      </tr>

      </table>
        ]]></add>
    </operation>
</file>
<file name="catalog/language/english/checkout/checkout.php">
    <operation>
        <search position="before"><![CDATA[
            $_['text_shipping_method']           = 'Please select the preferred shipping method to use on this order.';
        ]]></search>
        <add><![CDATA[
            $_['text_shipping_timeslot']           = 'Please select the preferred shipping time slot.';

        ]]></add>
    </operation>
</file>


   <file name="catalog/controller/checkout/shipping_method.php">
       <operation>
           <search position="before"><![CDATA[
               $this->data['text_shipping_method'] = $this->language->get('text_shipping_method');
           ]]></search>
           <add><![CDATA[
               $this->data['text_shipping_timeslot'] = $this->language->get('text_shipping_timeslot');

               if (isset($this->request->post['selection'])) {
           $this->data['selection'] = $this->request->post['selection'];
       } else {
           $this->data['selection'] = '';}


]]></add>
       </operation>

   </file>





<file name="catalog/model/checkout/order.php">
        <operation>
            <search position="replace"><![CDATA[
               $this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', store_id = '" . (int)$data['store_id'] . "', store_name = '" . $this->db->escape($data['store_name']) . "', store_url = '" . $this->db->escape($data['store_url']) . "', customer_id = '" . (int)$data['customer_id'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_company_id = '" . $this->db->escape($data['payment_company_id']) . "', payment_tax_id = '" . $this->db->escape($data['payment_tax_id']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', total = '" . (float)$data['total'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', commission = '" . (float)$data['commission'] . "', language_id = '" . (int)$data['language_id'] . "', currency_id = '" . (int)$data['currency_id'] . "', currency_code = '" . $this->db->escape($data['currency_code']) . "', currency_value = '" . (float)$data['currency_value'] . "', ip = '" . $this->db->escape($data['ip']) . "', forwarded_ip = '" .  $this->db->escape($data['forwarded_ip']) . "', user_agent = '" . $this->db->escape($data['user_agent']) . "', accept_language = '" . $this->db->escape($data['accept_language']) . "', date_added = NOW(), date_modified = NOW()");
        ]]></search>
            <add><![CDATA[
              $this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', store_id = '" . (int)$data['store_id'] . "', store_name = '" . $this->db->escape($data['store_name']) . "', store_url = '" . $this->db->escape($data['store_url']) . "', customer_id = '" . (int)$data['customer_id'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_company_id = '" . $this->db->escape($data['payment_company_id']) . "', payment_tax_id = '" . $this->db->escape($data['payment_tax_id']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', total = '" . (float)$data['total'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', commission = '" . (float)$data['commission'] . "', language_id = '" . (int)$data['language_id'] . "', currency_id = '" . (int)$data['currency_id'] . "', currency_code = '" . $this->db->escape($data['currency_code']) . "', currency_value = '" . (float)$data['currency_value'] . "', ip = '" . $this->db->escape($data['ip']) . "', forwarded_ip = '" .  $this->db->escape($data['forwarded_ip']) . "', user_agent = '" . $this->db->escape($data['user_agent']) . "', accept_language = '" . $this->db->escape($data['accept_language']) . "', date_added = NOW(), date_modified = NOW(), selection = '" . $this->db->escape($data['selection']) . "'");
        ]]></add>
        </operation>
</file>

</modification>

签出中的自定义字段
1.
2.4
阿伦

]]>

尝试的步骤:

  • 通过在浏览器中调用检查是否安装了vqmod。如果未安装,请向上滚动并阅读步骤
  • 验证文件名和路径,并确认所述文件中存在搜索标记中的代码
  • 检查文件夹权限。确保vqmod/vqcache和vqmod/logs具有755或777权限。如果什么都不起作用,则递归尝试vqmod文件夹的777权限
  • 检查vqmod/logs中的错误日志
  • 检查已安装的vqmod版本和xml文件()中给出的vqmod版本,两者都需要相同
  • 删除vqmod/vqcache中的文件并再次检查。还要查看是否生成了文件的vqmod副本。
  • 将任何vqmod xml文件移到vqmod文件夹之外并检查。如果一切正常,请将xml移回vqmod文件夹。我不知道原因,但它在某些情况下对我有效:)
  • –将这一行放在XML的顶部,使其有效且更兼容
  • 尝试VQMod管理器扩展。它可能会帮助你

参考链接:回答得很晚,但将来可能会帮助其他人: 末尾缺少一个

<input type="text" name="selection" value="<?php echo $selection; ?>" 
  id="selection"? 

添加的新字段是否显示在前端?验证有效吗?是的。。。它将显示在前端。。。我可以在该字段中输入值。。。也可以处理订单。。。我在订单表中添加了名为“selection”的额外字段。。。但我无法在数据库中看到该值。您是否检查了错误日志?而不是替换
$this->db->query(“插入到
..”)`在订单模型中,我建议在插入订单并检索新的
$Order\u id
后添加更新查询。无论如何,我在您的vQmod中没有发现任何问题,因此只有日志(vQmod或PHP错误)应该会显示问题。您确定DB字段
选择
的类型为string(VARCHAR,CHAR,TEXT)?因为您正试图在其中存储字符串值。。。
<input type="text" name="selection" value="<?php echo $selection; ?>" 
  id="selection"? >