I wrote this based on another mod with the intention of removing some checkout fields (address, company, post code & city) and adding my own custom fields (custom field should appear if a specific product is in the shopping cart). I installed it to give it a test but doesnt seem to be working. (I am using OC 2.2.0.0). What could be wrong?
Code: Select all
<modification>
<id><![CDATA[Remove unwanted checkout fields for opencart]]></id>
<version><![CDATA[1.0]]></version>
<opencart><![CDATA[2.2]]></opencart>
<vqmver><![CDATA[2.4]]></vqmver>
<author><![CDATA[Darth_D 16/08/2016 ]]></author>
<file path="catalog/controller/checkout/" name="payment_address.php">
<operation info="remove validate of address_1" error="abort" >
<search position="replace" offset="2" ><![CDATA[
if ((utf8_strlen(trim($this->request->post['address_1'])) < 3) || (utf8_strlen(trim($this->request->post['address_1'])) > 128)) {
]]></search>
<add><![CDATA[
]]></add>
</operation>
<operation info="remove validate of address_2" error="abort" >
<search position="replace" offset="2" ><![CDATA[
if ((utf8_strlen(trim($this->request->post['address_2'])) < 3) || (utf8_strlen(trim($this->request->post['address_2'])) > 128)) {
]]></search>
<add><![CDATA[
]]></add>
</operation>
<operation info="remove validate of city" error="abort" >
<search position="replace" offset="2" ><![CDATA[
if ((utf8_strlen(trim($this->request->post['city'])) < 2) || (utf8_strlen(trim($this->request->post['city'])) > 128)) {
]]></search>
<add><![CDATA[
]]></add>
</operation>
<operation info="remove validate of postcode" error="abort" >
<search position="replace" offset="2" ><![CDATA[
if ($country_info && $country_info['postcode_required'] && (utf8_strlen(trim($this->request->post['postcode'])) < 2 || utf8_strlen(trim($this->request->post['postcode'])) > 10)) {
]]></search>
<add><![CDATA[
]]></add>
</operation>
<operation info="Set checkbox Subscribe Newsletter checked default" error="abort" >
<search position="replace" ><![CDATA[
$data['newsletter'] = '';
]]></search>
<add><![CDATA[
$data['newsletter'] = '1';
]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/checkout/" name="payment_address.tpl">
<operation info="Default. telephone fields" error="log">
<search position="replace" offset="-1" ><![CDATA[
<label class="col-sm-2 control-label" for="input-telephone"><?php echo $entry_telephone; ?></label>
]]></search>
<add><![CDATA[
<div class="form-group">
<label class="col-sm-2 control-label" for="input-telephone"><?php echo $entry_telephone; ?></label>
]]></add>
</operation>
<operation info="Default. Hide fax" error="log">
<search position="replace" offset="-1" ><![CDATA[
<label class="col-sm-2 control-label" for="input-fax"><?php echo $entry_fax; ?></label>
]]></search>
<add><![CDATA[
<div class="form-group" style="display:none">
<label class="col-sm-2 control-label" for="input-fax"><?php echo $entry_fax; ?></label>
]]></add>
</operation>
<operation info="Default. hide Address block" error="log" >
<search position="replace" ><![CDATA[
<fieldset id="address">
]]></search>
<add><![CDATA[
<fieldset id="address" style="display:none">
]]></add>
</operation>
</file>
</modification>