-1

I am trying to remove some fields from opencart 2.0x checkout and registration page, like fax, postal code. I can't seem to find the right extension so I'd like to go editing from the code level.

Can anyone guide me to a starting point?

β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
user3385915
  • 29
  • 2
  • 5

2 Answers2

2
  1. Search for the field in account/register.tpl and delete it.
  2. If the field is mandatory, you will also have to search for it in register controller and delete its validation from validate() function.
2

You can make new file

remove-fields.ocmod.xml

and put this code

<?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>
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
webdevanuj
  • 675
  • 12
  • 22