Zen Cart Logo
Forums / General Questions / Can I re-use Customer Referral and Customer Nick for something else?

Can I re-use Customer Referral and Customer Nick for something else?

Views: 642

Results 1 to 4 of 4
27 Jun 2015, 12:41 AM
#1
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

Can I re-use Customer Referral and Customer Nick for something else?

I've always been skeptical to insert extra fields into my DB, I refuse to do it because I don't want the headache of upgrading and having to worry about customizations.

I've literally modified all plugins to use defines instead of SQL entries. It just avoids complications and allows me to sleep at night.

That being said :D

I noticed that Customers Nick field is, completely useless to me in its original usage, and I'd like to put it to some good use. I want to use the Nick field for customers to be able to put more information about their business. GST Number for example, P.O. Box, Company registration details - anything they want that should appear on the invoice.

The customers nick, being a 96-character field is looking especially handsome - I want to use it.

Has anyone managed this? Looking at the code there are some serious issues from what I can see.

Firstly, it's a required field.

Secondly, it's tied to MyBB being enabled, which is easily by-passable by simply editing out some if statements here and there.

My thoughts are, if I was to leave PHP linkage disabled, and then comment out: if ($phpBB->phpBB['installed'] == true) { ### }

in tpl_modules_create_account.php - would I have to worry about anything being executed on behalf of the nick? I don't want it to execute any of the code pertaining to phpbb - so I assume leaving it disabled would avoid it executing things such as: if ($phpBB && $phpBB->phpBB['installed'] == true) { ### } that's in modules/create_account.php.

Obviously, I would have to start coding into the order/invoice sections code to echo the nick in a manner I would like.

And I have no intention of allowing them to edit this information by themselves once they've signed up with it, once they've put it in, it's done. Only I can change it, only I will change it manually, at their request.

Perhaps there is some other way. I noticed the cc_type, cc_owner and cc_number fields that are practically unique to each order, could perhaps be better than using the nick field. A customer could for example have different companies, giving them the opportunity to re-enter these fields for each order placed. And I understand cc_type,name,number are practically useless now what with PAS and so on? To be honest, I would prefer the customer being able to enter these every time, it would be practical and less of a headache in the long-run.

Any info would be awesome thanks :)

27 Jun 2015, 12:59 AM
#2
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

Re: Can I re-use Customer Referral and Customer Nick for something else?

I've taken a look at the Checkout Gift Message module.

I'm thinking of using this module as a boilerplate to insert info into the cc fields. The gift message module uses sessions to store the data during the checkout process. I think this could be ideal.

Any advice Zen dev team :D

28 Jun 2015, 2:49 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I re-use Customer Referral and Customer Nick for something else?

Two approaches:

  1. Add new fields for your specific use
  • then the data never clashes with original core code
  • requires a bit of new code to manage inserting and reading data for those fields
  • upgrades are less painful because you simply need to identify your custom code
  1. Re-use existing fields
  • Requires careful study of existing core code to specifically hack out the normal operation and substitute with something else
  • Requires careful treatment during upgrades to once again hack out normal operation to replace it with your customizations ... every time you upgrade
  • Must carefully manage code in plugins to also not clash with original code or mistakenly use the data in those fields for the original purpose for which those fields exist in the first place.

I usually recommend the first approach since it's less painful down the road, and requires very little study to ensure no clashes with core code, since your fields are only used by you.

29 Jun 2015, 4:53 PM
#4
yaseent avatar

yaseent

Zen Follower

Join Date:
Mar 2009
Posts:
169
Plugin Contributions:
1

Re: Can I re-use Customer Referral and Customer Nick for something else?

DrByte:

Two approaches:

  1. Add new fields for your specific use
  • then the data never clashes with original core code
  • requires a bit of new code to manage inserting and reading data for those fields
  • upgrades are less painful because you simply need to identify your custom code
  1. Re-use existing fields
  • Requires careful study of existing core code to specifically hack out the normal operation and substitute with something else
  • Requires careful treatment during upgrades to once again hack out normal operation to replace it with your customizations ... every time you upgrade
  • Must carefully manage code in plugins to also not clash with original code or mistakenly use the data in those fields for the original purpose for which those fields exist in the first place.

I usually recommend the first approach since it's less painful down the road, and requires very little study to ensure no clashes with core code, since your fields are only used by you.

Thanks DrByte - I did take another look at some of the files and noticed that the cc fields are referenced to quite a bit - so I shall take your advice.

I'll simply take the gift message module, duplicate and customize accordingly.

Thanks.