Post by marvmen21 » Sat Sep 10, 2011 7:27 am

New version for Opencart 1.5.X attached to the first post.

Let me know if you find errors or anything that can be done to improve it.

Marvin M.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by tehchieftain » Sat Sep 10, 2011 11:35 am

Thanks again Marvman.

This guy was cool enough to take the time to update the xml out of his own time to help me finish a project I am working on! You are the man!

Newbie

Posts

Joined
Sun Aug 28, 2011 5:34 am

Post by smitch6 » Mon Sep 19, 2011 1:04 am

Hi i uploaded this to vqmod/xml was that correct?
if so how do i add some questions etc as i can't find it on my admin panel anywhere sorry :)

www.pattestersuffolk.co.uk


Active Member

Posts

Joined
Sat Sep 17, 2011 2:46 pm


Post by SVN » Mon Sep 19, 2011 3:04 am

error

admin_controller_sale_customer.php on line 357Notice: Undefined index: expert_id in /home/users/.../vqmod/vqcache/vq-admin_controller_sale_customer.php
ckonig wrote:Thank you!
I totally forgot to mod the system/library files to add a get Method, thats a nice one! As said, i did almost the same work before, and I merged your contribution with mine. This way, I also got rid of your problem concerning the empty field in the frontend.
But I have a question about your query manipulation. Wouldn't it be better to only add the field to the begin of the query, ignoring what comes after, so i can copy & paste the script as often as I want to?
For example with the UPDATE query:

Code: Select all

<operation>
		<search position="replace"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET firstname = '" . $this->db->escape($data['firstname']) . "',]]></search>
		<add trim="true"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET expert_id = '" . $this->db->escape($data['expert_id']) . "', firstname = '" . $this->db->escape($data['firstname']) . "',]]></add>
	</operation>
In my opinion this can only work one time, if I want to use two instances of this mod, I need to change it to:

Code: Select all

<operation>
		<search position="replace"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET ]]></search>
		<add trim="true"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET expert_id = '" . $this->db->escape($data['expert_id']) . "', ]]></add>
	</operation>
This way I can use this script more than one and I dont have to mind what other scripts are doing with the query.

I also added the extra field into the backend views (list and detail view). If you're interested, here's my version (actually my field is called "expert_id"). I hope this helps.

User avatar
SVN
Active Member

Posts

Joined
Mon Jan 03, 2011 11:59 pm

Post by marvmen21 » Mon Sep 19, 2011 6:51 am

smitch6 wrote:Hi i uploaded this to vqmod/xml was that correct?
if so how do i add some questions etc as i can't find it on my admin panel anywhere sorry :)
what exactly do you want to do? The vqmod in my first post will add a new field called "cedula" to the registration form, cust edit, and to admin cust edit. You just need to substitute that for you custom field. Remember you also need to add the field to the database.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by marvmen21 » Mon Sep 19, 2011 6:54 am

SVN wrote:error

admin_controller_sale_customer.php on line 357Notice: Undefined index: expert_id in /home/users/.../vqmod/vqcache/vq-admin_controller_sale_customer.php
ckonig wrote:Thank you!
I totally forgot to mod the system/library files to add a get Method, thats a nice one! As said, i did almost the same work before, and I merged your contribution with mine. This way, I also got rid of your problem concerning the empty field in the frontend.
But I have a question about your query manipulation. Wouldn't it be better to only add the field to the begin of the query, ignoring what comes after, so i can copy & paste the script as often as I want to?
For example with the UPDATE query:

Code: Select all

<operation>
		<search position="replace"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET firstname = '" . $this->db->escape($data['firstname']) . "',]]></search>
		<add trim="true"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET expert_id = '" . $this->db->escape($data['expert_id']) . "', firstname = '" . $this->db->escape($data['firstname']) . "',]]></add>
	</operation>
In my opinion this can only work one time, if I want to use two instances of this mod, I need to change it to:

Code: Select all

<operation>
		<search position="replace"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET ]]></search>
		<add trim="true"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET expert_id = '" . $this->db->escape($data['expert_id']) . "', ]]></add>
	</operation>
This way I can use this script more than one and I dont have to mind what other scripts are doing with the query.

I also added the extra field into the backend views (list and detail view). If you're interested, here's my version (actually my field is called "expert_id"). I hope this helps.
Youre talking about the vqmod attached by ckonig?

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by SVN » Mon Sep 19, 2011 3:38 pm

Yep, sorry, forgot to mention.
I was talking about the Expert ID.

OC 1.4.9.6
marvmen21 wrote:
SVN wrote:error

admin_controller_sale_customer.php on line 357Notice: Undefined index: expert_id in /home/users/.../vqmod/vqcache/vq-admin_controller_sale_customer.php
ckonig wrote:Thank you!
I totally forgot to mod the system/library files to add a get Method, thats a nice one! As said, i did almost the same work before, and I merged your contribution with mine. This way, I also got rid of your problem concerning the empty field in the frontend.
But I have a question about your query manipulation. Wouldn't it be better to only add the field to the begin of the query, ignoring what comes after, so i can copy & paste the script as often as I want to?
For example with the UPDATE query:

Code: Select all

<operation>
		<search position="replace"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET firstname = '" . $this->db->escape($data['firstname']) . "',]]></search>
		<add trim="true"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET expert_id = '" . $this->db->escape($data['expert_id']) . "', firstname = '" . $this->db->escape($data['firstname']) . "',]]></add>
	</operation>
In my opinion this can only work one time, if I want to use two instances of this mod, I need to change it to:

Code: Select all

<operation>
		<search position="replace"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET ]]></search>
		<add trim="true"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "customer SET expert_id = '" . $this->db->escape($data['expert_id']) . "', ]]></add>
	</operation>
This way I can use this script more than one and I dont have to mind what other scripts are doing with the query.

I also added the extra field into the backend views (list and detail view). If you're interested, here's my version (actually my field is called "expert_id"). I hope this helps.
Youre talking about the vqmod attached by ckonig?

User avatar
SVN
Active Member

Posts

Joined
Mon Jan 03, 2011 11:59 pm

Post by victor.gatto » Tue Sep 27, 2011 7:03 am

you forgot to add the new field in the checkout registration??!?

Active Member

Posts

Joined
Thu Sep 01, 2011 9:14 am

Post by marvmen21 » Wed Sep 28, 2011 12:06 am

victor.gatto wrote:you forgot to add the new field in the checkout registration??!?
You're right! Thanks. Right now I don't have time to update it, I'll work on it as soon as I get some time free. I'll add it to the checkout registration and also the guest check out.
Last edited by marvmen21 on Wed Sep 28, 2011 11:57 am, edited 1 time in total.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by victor.gatto » Wed Sep 28, 2011 8:56 am

marvmen21 wrote:
victor.gatto wrote:you forgot to add the new field in the checkout registration??!?[/uquote]
You're right! Thanks. Right now I don't have time to update it, I'll work on it as soon as I get some time free. I'll add it to the checkout registration and also the guest check out.


thanks heaps :)

Active Member

Posts

Joined
Thu Sep 01, 2011 9:14 am

Post by marvmen21 » Tue Oct 04, 2011 12:16 pm

It was not working properly in the backend with the recently released version (oc 1.5.1.3) since there were two small changes in the controller file. New version New_Field_Registration_Form_1.0.3.xml attached to the first post.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by clapiana » Tue Oct 04, 2011 1:54 pm

what would a sample sql statement be to update a 1.5.1.3 db?

thanks

New member

Posts

Joined
Thu Sep 01, 2011 6:22 pm

Post by marvmen21 » Tue Oct 04, 2011 2:14 pm

Hi, it depends on the field you want to add, but generally it would be..

Code: Select all

ALTER TABLE `customer` ADD `name of your field` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ;
You could also add it manually.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by marvmen21 » Tue Oct 04, 2011 2:59 pm

New Version attached to first post. New_Field_Registration_Form_1.0.4.xml for OC 1.5.1.3

As victor.gatto notticed, I had forgotten the checkout/registration form...
victor.gatto wrote:you forgot to add the new field in the checkout registration??!?
So this is the updated version to include the "new field" to the checkout/registration form. Some might say it's also important to include the "new field" to the guest/registration form, and I first tried (you can see the commented parts in the xml file), but then decided not to since you're not going to be able to get that information because the cust is not creating any account. The only way would be to get the order_info form to show it in your backend which would take another bunch of files to modify. Anyways, It depends on the field and the information you're collecting from it, In my case, I just need it for people who actually create the account.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by victor.gatto » Wed Oct 05, 2011 6:19 am

hey marv, thanks for the updates!

Active Member

Posts

Joined
Thu Sep 01, 2011 9:14 am

Post by marvmen21 » Fri Oct 07, 2011 10:43 am

New_Field_Registration_Form_1.1.xml

This new version now adds the "new field" to the affiliate/register & edit and to the backend. This is actually the vqmod I am using in my store, and that's why it adds the field called "cedula" at the beginning, just before "Name". You can change the position as you need.

Attachments

For OC 1.5.1.3. Now adds the field to the affiliate registration, edit, and back-end affiliate

Last edited by marvmen21 on Sat Oct 15, 2011 5:26 am, edited 1 time in total.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by marvmen21 » Wed Oct 12, 2011 10:15 am

I just spotted one error, check below and update your file. (this error is only in the last version posted)

Code: Select all

 <!--SYSTEM=>LIBRARY FILES-->
<file name="system/library/affiliate.php">
	 <operation><search position="before"><![CDATA[
				$this->fax = $customer_query->row['fax'];
 ]]></search><add><![CDATA[
				$this->cedu = $customer_query->row['cedu'];
	]]></add></operation>
Instead of customer_query, it should be affiliate_query.

Code: Select all

<file name="system/library/affiliate.php">
	 <operation><search position="before"><![CDATA[
				$this->fax = $affiliate_query->row['fax'];
 ]]></search><add><![CDATA[
				$this->cedu = $affiliate_query->row['cedu'];
	]]></add></operation>[/quote]

EDIT
No need to correct that, I've updated the file.
Last edited by marvmen21 on Sat Oct 15, 2011 5:24 am, edited 1 time in total.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by newpt » Wed Oct 12, 2011 6:29 pm

Hello,

Noob alerte! Sorry, but I am having difficulties to understand the correct way to implement new fields.
I think I installed without any problems Vqmod, also the last New_Field_Registration_Form_1.1.xml form.

But how can I add a new field? I read that comment "<!--Copy and paste the code to add new fields, rememeber to add them to the database, too -->", so what does it really say? to copy all the code between <modification> or just a part of the code?

Also in the database, where do I insert the new field name?

Sorry I am very confused.

Hope you can help me.
Thanks.

Newbie

Posts

Joined
Wed Oct 12, 2011 6:22 pm

Post by robbiecs » Wed Oct 12, 2011 8:49 pm

hello! this extension is able for version 1.4.9.1???

User avatar
Active Member

Posts

Joined
Sat Oct 24, 2009 5:29 am


Post by marvmen21 » Wed Oct 12, 2011 8:58 pm

Hi newpt, it's not that difficult once you understand the structure. You can read about that here http://forum.opencart.com/viewtopic.php?f=29&t=2648
The first thing you need to know is what kind of fields and where you want to add them. Knowing that will tell you what table in the database you need to add it and which files to modify.

In the case of this vqmod, this adds a new required field called "cedula" ( ID) just before "Name" in all registration pages except in the guest checkout. The mod is "plug and play" so by putting it in the xml folder, it will make all the modifications required. You can go to account/create in your website and see the field that was added. You may get errors since you also need that field in the database. To do that, you can use the following query to alter the customer table in the database

Code: Select all

ALTER TABLE `customer` ADD `cedu` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
After that, you should have no problems. If you are adding just one field, you could use this vqmod almost as it is. Just change the language parts to change the name of the field, and if you want to change the positions, just change the code it is searching in the .tpl files.
Now,if you want to add more than one field, let's say... a new field called "abc" just before "fax" , You will need to modify the code between the search tag to look for the position and add the field exactly where you want it, and add or copy paste code in all the operations you find in the vqmod. Basically, to add a new field you need to add code to all these files:Template files, controller files, mode files, and language files, and some files in the system/library.
This would the example on how to add abc to the template file.

Code: Select all

 <!--###CATALOG=>VIEW FILES###-->
                            <!--standard register-->
<file name="catalog/view/theme/default/template/account/register.tpl">
<operation><search position="before"><![CDATA[
          [b]<td><?php echo $entry_fax; ?[/b]></td>
 ]]></search><add><![CDATA[
 <tr>
          <td><span class="required">*</span> <?php echo $entry_abc; ?></td>
          <td><input type="text" name="abc" value="<?php echo $abc; ?>" />
            <?php if ($error_abc) { ?>
            <span class="error"><?php echo $error_abc; ?></span>
            <?php } ?></td>
        </tr>
     ]]></add></operation></file>

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am
Who is online

Users browsing this forum: No registered users and 2 guests