如何在opencart 2.0 checkout / registration页面中删除表单字段?

时间:2015-06-23 19:32:54

标签: php opencart opencart2.x

我正在尝试从opencart 2.0x结帐和注册页面中删除一些字段,例如传真,邮政编码。我似乎找不到合适的扩展名,所以我想从代码级别进行编辑。

任何人都可以指导我到一个起点吗?

2 个答案:

答案 0 :(得分:2)

  1. 在account / register.tpl中搜索字段并将其删除。
  2. 如果该字段是必填字段,您还必须在寄存器控制器中搜索它并从validate()函数中删除其验证。

答案 1 :(得分:2)

您可以制作新文件

  

除去-fields.ocmod.xml

并输入此代码

<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Remove Field From Checkout Page</name>
<code>removeextrafield</code>
<version>1.0</version>
<author>Anuj Khandelwal</author>
<link>http://themextension.com</link>

<file path="catalog/view/theme/*/template/account/register.tpl">
    <operation>
        <search index="2"><![CDATA[
            <div class="form-group">
        ]]></search>
        <add position="replace"><![CDATA[
            <div class="form-group" style="display: none;>
        ]]></add>
    </operation>
</file>

<file path="catalog/view/theme/*/template/account/address_form.tpl">
    <operation>
        <search index="1"><![CDATA[
            <div class="form-group">
        ]]></search>
        <add position="replace"><![CDATA[
            <div class="form-group" style="display: none;>
        ]]></add>
    </operation>
</file>

<file path="catalog/view/theme/*/template/affiliate/{edit,register}.tpl">
    <operation>
        <search index="3"><![CDATA[
            <div class="form-group">
        ]]></search>
        <add position="replace"><![CDATA[
            <div class="form-group" style="display: none;>
        ]]></add>
    </operation>
    <operation>
        <search><![CDATA[
            $entry_address_1;
        ]]></search>
        <add position="replace" trim="true"><![CDATA[
            $text_your_address;
        ]]></add>
    </operation>
</file>

<file path="catalog/view/theme/*/template/checkout/{guest_shipping,payment_address,shipping_address}.tpl">
    <operation>
        <search index="1"><![CDATA[
            <div class="form-group">
        ]]></search>
        <add position="replace"><![CDATA[
            <div class="form-group" style="display: none;>
        ]]></add>
    </operation>
</file>

<file path="catalog/view/theme/*/template/checkout/{guest_shipping,payment_address,shipping_address}.tpl">
    <operation>
        <search index="1"><![CDATA[
            <div class="form-group">
        ]]></search>
        <add position="replace"><![CDATA[
            <div class="form-group" style="display: none;>
        ]]></add>
    </operation>
</file>

<file path="catalog/view/theme/*/template/checkout/{register,guest}.tpl">
    <operation>
        <search><![CDATA[
            <div class="form-group">
        ]]></search>
        <add position="replace"><![CDATA[
            <div class="form-group" style="display: none;>
        ]]></add>
    </operation>
</file>

<file path="catalog/view/theme/*/template/account/{register,address_form}.tpl">
    <operation>
        <search><![CDATA[
            $entry_address_1;
        ]]></search>
        <add position="replace" trim="true"><![CDATA[
            $text_your_address;
        ]]></add>
    </operation>
</file>

<file path="catalog/view/theme/*/template/checkout/{register,guest,guest_shipping,payment_address,shipping_address}.tpl">
    <operation>
        <search><![CDATA[
            $entry_address_1;
        ]]></search>
        <add position="replace" trim="true"><![CDATA[
            $text_your_address;
        ]]></add>
    </operation>
</file>

</modification>