Zen Cart Logo
Forums / General Questions / Can someone Upgrade This

Can someone Upgrade This

Locked

Views: 2,674

Results 1 to 20 of 27
This thread is locked. New replies are disabled.
8 Apr 2007, 2:14 AM
#1
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Can someone Upgrade This

http://www.zen-cart.com/archived_contributions/other/taxid_v1.0.zip

Ive been playing around for 2 hours now and i cant get it to work

The Admin Edits worked and i got under Admin Customer

Company
Company name:
Tax ID Number: * Required

But i cant get it under Create Account

8 Apr 2007, 2:24 AM
#2
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

Ok i got it under the customer creat account page

BUT

When i create account and input a TAX ID Number, it dont show o nthe admin side, just a blank box

8 Apr 2007, 2:32 AM
#3
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

This is what i have in tpl_modules_create_account

<fieldset> <legend><?php echo CATEGORY_COMPANY; ?></legend> <label class="inputLabel" for="company"><?php echo ENTRY_COMPANY; ?></label> <?php echo zen_draw_input_field('company', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', '40') . ' id="company"') . (zen_not_null(ENTRY_COMPANY_TEXT) ? '<span class="alert">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?> <label class="inputLabel" for="taxid"><?php echo ENTRY_TAXID; ?></label> <?php echo zen_draw_input_field('taxid', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_taxid', '40') . ' id="taxid"') . (zen_not_null(ENTRY_TAXID_TEXT) ? '<span class="alert">' . ENTRY_TAXID_TEXT . '</span>': ''); ?> </fieldset>

This is What i did in Admin/customers.php

IN THE FILE - admin/customers.php

FIND

if (customers_email_address == "" || customers_email_address.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_EMAIL_ADDRESS; ?>";
error = 1;
}

ADD THIS AFTER

if (entry_taxid == "" || entry_taxid.length < <?php echo ENTRY_TAXID_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_TAXID; ?>";
error = 1;
}


FIND

<?php if ($error == true) { if ($entry_company_error == true) { echo zen_draw_input_field('entry_company', $cInfo->entry_company, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', 50)) . ' ' . ENTRY_COMPANY_ERROR; } else { echo $cInfo->entry_company . zen_draw_hidden_field('entry_company'); } } else { echo zen_draw_input_field('entry_company', $cInfo->entry_company, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', 50)); } ?></td>
      </tr>

ADD THIS AFTER

      <tr>
        <td class="main"><?php echo ENTRY_TAXID; ?></td>
        <td class="main">
<?php if ($error == true) { if ($entry_taxid_error == true) { echo zen_draw_input_field('entry_taxid', $cInfo->entry_taxid, 'maxlength="25"') . ' ' . ENTRY_TAXID_ERROR; } else { echo $cInfo->entry_taxid . zen_draw_hidden_field('entry_taxid'); } } else { echo zen_draw_input_field('entry_taxid', $cInfo->entry_taxid, 'maxlength="25"', true); } ?> </tr>

FIND

    $entry_country_id = zen_db_prepare_input($_POST['entry_country_id']);

ADD THIS AFTER

    $entry_taxid = zen_db_prepare_input($_POST['entry_taxid']);

FIND

                           'entry_country_id' => $entry_country_id);

AND REPLACE WITH

                            'entry_country_id' => $entry_country_id,
		                	'entry_taxid' => $entry_taxid);

	if  (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_taxid'] = $entry_taxid;

FIND

                                      a.entry_company, a.entry_street_address, a.entry_suburb,

AND REPLACE WITH

                                      a.entry_company, a.entry_taxid, a.entry_street_address, a.entry_suburb,

FIND:

          case "company":
          $disp_order = "a.entry_company";
          break;
          case "company-desc":
          $disp_order = "a.entry_company DESC";
          break;

ADD THIS AFTER:

          case "taxid":
          $disp_order = "a.entry_taxid";
          break;
          case "taxid-desc":
          $disp_order = "a.entry_taxid DESC";
          break;

FIND:

<td class="dataTableHeadingContent" align="left"> <?php echo (($_GET['list_order']=='company' or $_GET['list_order']=='company-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_COMPANY . '</span>' : TABLE_HEADING_COMPANY); ?><br> <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=company', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='company' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a>  <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=company-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='company-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a> </td>

ADD THIS AFTER:

<td class="dataTableHeadingContent" align="left"> <?php echo (($_GET['list_order']=='taxid' or $_GET['list_order']=='taxid-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_TAXID . '</span>' : TABLE_HEADING_TAXID); ?><br> <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=taxid', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='taxid' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a>  <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=taxid-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='taxid-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a> </td>

FIND:
$new_fields=', c.customers_telephone, a.entry_company, a.entry_street_address, a.entry_city, a.entry_postcode, c.customers_authorization, c.customers_referral';

IN-LINE FIND:
a.entry_company,

ADD AFTER:
a.entry_taxid,


FIND:
$customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_group_pricing, a.entry_country_id, a.entry_company, ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created " . $new_fields . " from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_INFO . " ci on c.customers_id= ci.customers_info_id left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id " . $search . " order by $disp_order";

IN-LINE FIND:
a.entry_company,

ADD AFTER
a.entry_taxid,


FIND:

<td class="dataTableContent"><?php echo $customers->fields['entry_company']; ?></td>

ADD THIS AFTER:

<td class="dataTableContent"><?php echo $customers->fields['entry_taxid']; ?></td>

Can someone please help

8 Apr 2007, 2:42 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

Who owns the taxid? The customer or the customer's address?

As in I have 1 customer record but 7 addresses ...

Who owns the TAXID?

8 Apr 2007, 2:56 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

If the taxid belongs to the customer then the taxid belongs in the customers table and not the address_book table ...

It looks like you have put the field in the address_book table vs the customers table ...

That means if I am the customer and have 7 addresses then I can have 7 taxid numbers ... :eek:

8 Apr 2007, 2:58 AM
#7
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

I did whatever the instuctions of that mod above told me to

ALTER TABLE zen_address_book ADD COLUMN entry_taxid varchar(10) NOT NULL default '' AFTER entry_zone_id;

Table structure for table zen_configuration

INSERT INTO zen_configuration VALUES ('', 'Minimum Tax ID Number Length', 'ENTRY_TAXID_MIN_LENGTH', '0', 'min length of Tax ID number', 1, 3, '2004-10-15 13:27:30', '0000-00-00 00:00:00', NULL, NULL);

What can i do to make it work, with the coding i have done??

8 Apr 2007, 3:07 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

Personally I do not know if that is the solution for you ...

You have to decide if the customer owns the taxid or the customers address ...

Advantage if customer owns the taxid there can be only one ... disadvantage what if I want to shop personally where I do not have a taxid and what if I want to shop for my business where my taxid can be used ...

Advantage if the address_book owns the taxid I can have my personal address without a taxid and my business address with a taxid ... disadvantage I have to remember to switch between the addresses and not mix them up ...

This is a business decision that you may wish to discuss with your accountant to see which is better for your business ...

As to how to fix all of this based on what you have ... I would literally need to sit down with the code and write or fix the errors ... and at the moment I do not have the free time for it and cannot see the obvious errors just reading the screen ...

If you add the taxid in the create account ... is the data in the database?

If you edit the account in the catalog ... is the data on the screen when you hit edit?

If you see it and hit update ... is it still in the database?

If you hit edit again, does it still appear on the screen?

When you look in the admin ... are you seeing it in the listing of the customer information on the customers.php page?

If you hit edit does it vanish?

If you hit update does it clear the data out of the database?

8 Apr 2007, 3:19 AM
#9
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

I just want a customer to input there tax id, so it belongs t othe customer not the address.

If i add the data i nthe admin side under a customer, the data sticks.

But when creating a naccoutn and entering i nthe tax id number, it dont hsow up in the admin

8 Apr 2007, 3:23 AM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

Type slowly ...

Are you saying that a given customer as in customers_id 32 can have exactly 1 taxid and that this is associated with his customers account and does not take into account his address_book?

If this is correct then you are using the wrong database ...

You appear to be storing the data to the customer's address_book table (many records per customer) and not to the customers table (1 record per customer) ...

8 Apr 2007, 3:25 AM
#11
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

Yes thats what i want

How would i go about changing it

8 Apr 2007, 3:30 AM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

Start over ... :eek:

You can follow the code that you added and fix it ...

In the same files, follow the field for customers_fax or the word fax ...

The field needs to be in the customers table not the address_book ...

I believe that you are not inserting the information on the create_account/edit in the catalog so it never gets into the database table ... you want things referencing the TABLE_CUSTOMERS not the TABLE_ADDRESS_BOOK ...

Where ever you see anything about the fax or customers_fax you need to add in there a customers_taxid or whatever you want to call it ... I'd call it customers_taxid to maintain the pattern ...

8 Apr 2007, 3:40 AM
#13
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

boy oh boy lol, maybe i can just live with out it, never figured it would be so hard, other carts ive been with was one of 2 file edits

8 Apr 2007, 3:42 AM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

It isn't hard to write ... just have to follow the patterns and use the right database tables ...

First you need to think out ... what is the right way to do this for your business?

Then trace or follow (clone) the correct field ...

8 Apr 2007, 3:58 AM
#15
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

i just did a quick fix

Since i dont use the Fax number field, i just renamed that to tax id and moved it up under Company name

8 Apr 2007, 4:01 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

Not the ideal method but it works in a pinch ...

8 Apr 2007, 4:05 AM
#17
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

Ok now one last thing, when you go in the admin under customers it has

ID# Last Name
Asc Desc First Name
Asc Desc Company
Asc Desc Account Created
Asc Desc Last Login
Asc Desc Pricing Group
Asc Desc Authorized
Asc Desc Action

How can i get the fax field(new tax id) to show up in there, so i dont have to go into customer

8 Apr 2007, 4:13 AM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

Clone a set ... follow the pattern and it all slips in there nice and neat ...

Those are made so there is not a lot of thinking needed ... find the set for company ... and you should see the pattern to it for the titles and the select and the order etc.

8 Apr 2007, 4:19 AM
#19
cntgifts avatar

cntgifts

Totally Zenned

Join Date:
Sep 2005
Posts:
836
Plugin Contributions:
0

Re: Can someone Upgrade This

Is it this spot

case "id-asc":
$disp_order = "ci.customers_info_date_account_created";
break;
case "firstname":
$disp_order = "c.customers_firstname";
break;
case "firstname-desc":
$disp_order = "c.customers_firstname DESC";
break;
case "group-asc":
$disp_order = "c.customers_group_pricing";
break;
case "group-desc":
$disp_order = "c.customers_group_pricing DESC";
break;
case "lastname":
$disp_order = "c.customers_lastname, c.customers_firstname";
break;
case "lastname-desc":
$disp_order = "c.customers_lastname DESC, c.customers_firstname";
break;
case "company":
$disp_order = "a.entry_company";
break;
case "company-desc":
$disp_order = "a.entry_company DESC";
break;
case "login-asc":
$disp_order = "ci.customers_info_date_of_last_logon";
break;
case "login-desc":
$disp_order = "ci.customers_info_date_of_last_logon DESC";
break;
case "approval-asc":
$disp_order = "c.customers_authorization";
break;
case "approval-desc":
$disp_order = "c.customers_authorization DESC";
break;
default:
$disp_order = "ci.customers_info_date_account_created DESC";

If so i made one like company

case "fax":
$disp_order = "a.entry_fax";
break;
but it didnt work

8 Apr 2007, 4:22 AM
#20
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can someone Upgrade This

Break down ... look in the database tables for the fax number which is in the customers table and called customers_fax ...

a. is usually a database that starts with an A

c. is usually a database that starts with a C ...

Now take a few moments and look at your database tables ... where are you really storing this data?

Where would you then pull the data from?

How should the data be pulled so that it comes from the right database table?

Take your time ... this is not a timed test ... :cool: