Post by darth_danny » Tue Aug 16, 2016 8:19 pm

Hi,

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>

New member

Posts

Joined
Wed Jul 27, 2016 5:41 pm

Post by sculptex » Wed Aug 17, 2016 12:14 am

First off, oc version 2.2+ needs the latest vqmod version (2.6.1).

If you have that then;

You have not stated in what way it is not working correctly. Any vqmod errors? Are the fields still visible? Does the json error still occur if the fields are blank?

Look in your vqcache folder and check the mods have 'taken' correctly.

I see the way you have used offsets should work but checking the whole lines in this way is often problematic as a single character difference can cause it to fail. another approach might be to wait until after the validation checks and just clear all the errors that you want excluded?

ImageImage


User avatar
Active Member

Posts

Joined
Tue Sep 13, 2011 3:07 am
Location - UK

Post by darth_danny » Wed Aug 17, 2016 5:27 pm

I am using 2.6.0. How do I check for vqmod errors? Sorry pretty new to this. The fields are still visible

New member

Posts

Joined
Wed Jul 27, 2016 5:41 pm

Post by sculptex » Wed Aug 17, 2016 6:03 pm

error logs should be in following folder
vqmod/logs

the cache files produced should be in
vqmod/vqcache

ImageImage


User avatar
Active Member

Posts

Joined
Tue Sep 13, 2011 3:07 am
Location - UK

Post by darth_danny » Wed Aug 17, 2016 6:23 pm

Hi, the logs do not reference the mod I created at all

New member

Posts

Joined
Wed Jul 27, 2016 5:41 pm

Post by sculptex » Wed Aug 17, 2016 6:56 pm

then there is no error.

so does the following file exist?
vqmod/vqcache/vq2-catalog_controller_checkout_payment_address.php

ImageImage


User avatar
Active Member

Posts

Joined
Tue Sep 13, 2011 3:07 am
Location - UK

Post by darth_danny » Wed Aug 17, 2016 7:03 pm

No it doesnt

New member

Posts

Joined
Wed Jul 27, 2016 5:41 pm

Post by sculptex » Wed Aug 17, 2016 7:07 pm

then I suspect theres something wrong with your vqmod setup, or theres some cache in place therefore bypassing a fresh page generation?

are there any other scripts working?

try a very simple script to start

if you upgraded to 2.6.0 recently or upgraded your site recently, did you re-run vqmod/install/

ImageImage


User avatar
Active Member

Posts

Joined
Tue Sep 13, 2011 3:07 am
Location - UK

Post by darth_danny » Wed Aug 17, 2016 7:28 pm

No upgrade. DOwnloaded and installed 2.6.0. Let me try a simple script to start with

New member

Posts

Joined
Wed Jul 27, 2016 5:41 pm
Who is online

Users browsing this forum: No registered users and 73 guests