tec Posted September 29, 2005 Share Posted September 29, 2005 On my check out shipping page, i have the Gift wrap mod installed, if i wanted to add the fields- Is this for a male or female? - What is the occassion? - WHat do you wish the gift card to say? would i do it the same way but only to the checkout shipping page? and what table would i edit in the DB to add these new fields? I also need to have it shown on the Admin Orders Status Page and shown within the order confirmation email sent to both customer and store owner. Should i assume that you cannot put extra fields like the ones above on the check out page? Link to comment Share on other sites More sharing options...
qhordern Posted October 2, 2005 Share Posted October 2, 2005 Sorry, which code do I need to add in the invoice.php? How did you go with the added filed for the invoice. I am trying to do the exact same thing . I have tried adding the same fields but it doesnt seem to work. did you get it to work? if so what did you add to invoice.php? Q Link to comment Share on other sites More sharing options...
kdeleon Posted October 7, 2005 Share Posted October 7, 2005 How did you go with the added filed for the invoice. I am trying to do the exact same thing . I have tried adding the same fields but it doesnt seem to work. did you get it to work? if so what did you add to invoice.php? Q Yes...I would like to know this as well, Thanks! Link to comment Share on other sites More sharing options...
harky Posted February 14, 2006 Share Posted February 14, 2006 Oh Great this script is good for a beginner like me.. but can someone teach me how to make my field *REQUIRED? Link to comment Share on other sites More sharing options...
Guest Posted March 15, 2006 Share Posted March 15, 2006 Hi was hoping somebody could help me. Can anyone explain how I can add these new fields to the invoice, should have been straightforward but somehow I managed to mess it up and cant get them to show :/ Many Thanks Link to comment Share on other sites More sharing options...
tec Posted April 16, 2006 Share Posted April 16, 2006 if i wanted the customer to be able to choose a salutation, would doing what everyone is talking about be the best way to do it? Link to comment Share on other sites More sharing options...
tec Posted April 21, 2006 Share Posted April 21, 2006 ok, lets try another one, I want the customer to be able to choose whether or not they would like to put in there middle initial can I do this by following the methods decribed? Link to comment Share on other sites More sharing options...
Duket Posted May 4, 2006 Share Posted May 4, 2006 Hi; I went through the steps but I got this error msgs; 1054 - Unknown column 'customers_CRN' in 'field list' Can any one help?? Link to comment Share on other sites More sharing options...
julia Posted May 6, 2006 Share Posted May 6, 2006 Hi; I went through the steps but I got this error msgs; 1054 - Unknown column 'customers_CRN' in 'field list'Can any one help?? Its been soooo long since I did this, but I do remember getting that error alot... There are so many places that you can make a misspelling, or interchange the variable name with the wron thing . So..my suggestion would be look very carefuly at ever little change that you made. Im my case it was always.... that. I added 22 custom fields... The drop downs are a real treat! Hope this helps. Julie Link to comment Share on other sites More sharing options...
nikmark Posted July 5, 2006 Share Posted July 5, 2006 What if you wanted to add custom form fields. radio buttons, drop down boxes, to the product_info.php page (much like http://drumsforyou.com/product_info3.php?products_id=33 ) and have the form input displayed on the shopping_cart.php page? What pages would you have to edit or modify ? Any help much appreciated Mark Link to comment Share on other sites More sharing options...
mdrayner Posted November 2, 2006 Share Posted November 2, 2006 Does any one know how to get this info into the invoice?? I have been trying to do this for ages and just cannot get it to work. Link to comment Share on other sites More sharing options...
ossory Posted December 7, 2006 Share Posted December 7, 2006 Hi Guys, I'm new to php and have come across problem adding customer fields. I'm getting: Parse error: syntax error, unexpected T_DOUBLE_ARROW in .............. I can't see that i'm doing anything wrong. Any advise would great. Thanks Link to comment Share on other sites More sharing options...
ossory Posted December 11, 2006 Share Posted December 11, 2006 Hi Guys, I'm new to php and have come across problem adding customer fields. I'm getting: Parse error: syntax error, unexpected T_DOUBLE_ARROW in .............. I can't see that i'm doing anything wrong. Any advise would great. Thanks Sorted...... Link to comment Share on other sites More sharing options...
ossory Posted December 11, 2006 Share Posted December 11, 2006 I'm getting a entry_" "_ text after my entry fields. Everything seems to work well apart from these unwanted pieces of text.. Anyone able to help? Link to comment Share on other sites More sharing options...
pburt Posted July 19, 2007 Share Posted July 19, 2007 Whew - from 2004.... I hope someone is still monitoring this thread... Keeping in mind that Im new to php.... I made these changes and the form worked well. But all kinds of other problems started happening... so I had to start from scratch and re-enter my whole shopping cart anew... (don't laugh at me please!) It took me days. I thought it would be easier to simply change 'FAX NUMBER' to Reseller ID.... I don't need the customer's fax number. My thought was to 1 change the database column in the phpmyadin 2 go to the pages mentioned in this guide and every mention of change fax or fax number to customer id. I also need to have the Customer ID REQUIRED so I think I can turn on "required" in the adm panel. Can anyone tell me if this will work? Because I am a wholesaler - i need to have the state reseller id number to exclude taxes. Please respond as soon as you can before I screw up this installation! or email me tee hee... pam Link to comment Share on other sites More sharing options...
OwossoBorn Posted October 6, 2007 Share Posted October 6, 2007 Since this forum has so little threads on creating a new field, I thought I'd tag onto this thread. :-" I had changed the "Comment" field, throughout the checkout process, into storing the date for "ship at a later date" if the customer wanted to ship later. Now, I've been told to add in a "Message" field! Rather than try to figure out what I had changed to put the "...later date" back to comments and THEN figure out how to insert an actual "ship at a later date" field, I think it'd be faster/easier to simply add a "Message" text field into the database. (whew) So, how would I go about this? Since I didn't actually add a field before, I have no idea what that takes or which files need to be edited. Anyone have any idea which database I'd add a new Message field to and which files would have to be edited so the customer can enter a message on the checkout_shipping.php page and have it show up on the checkout_confirmation.php page as well as in the admin area so we notice it?? Thanks!! Link to comment Share on other sites More sharing options...
kustomjs Posted October 8, 2007 Share Posted October 8, 2007 so would I be able to upload a file to the customer details with this or not? Link to comment Share on other sites More sharing options...
MaryKH Posted November 3, 2007 Share Posted November 3, 2007 Anybody have any idea how to get this info in the order email received? Link to comment Share on other sites More sharing options...
stonjie Posted November 15, 2007 Share Posted November 15, 2007 Anybody have any idea how to get this info in the order email received? I'm not exactly sure. But I think it goes something like this: Customer goes through checkout once confirmed the information goes over to the orders table (i still want to find out how so I can make a new table there and call from it) Then in the orders.php file all this information is called from the table. once I figure out (or get told) how I'll post it here. If you want to put it in the email that they receive in needs to go in checkout_process. have a look at this forum post Link to comment Share on other sites More sharing options...
stonjie Posted November 27, 2007 Share Posted November 27, 2007 Anybody have any idea how to get this info in the order email received? Okay, I have a solution of sorts. Thanks to my friends Malcolm & Aaron. BACKUP FIRST. 4 files need to be changed: catalog/checkout_process.php catalog/includes/classes/order.php catalog/admin/orders.php catalog/admin/includes/classes/order.php I haven't looked at the invoice file because we don't need it. My theory is it would be similar to the orders.php file. (Don't quote me on that) I didn't have any trailing text (cms in the example) after my field so that needs to be added. I had called my field vip_number (not customer_vip_number), so just change that as necessary. All line numbers used are from the original clean files. SQL: Make a field in your orders table, copying the field you put in the customers table. So now you have 2 fields in 2 tables that can get the same info. But first you will need to add a new field to the database in phpMyAdmin. Click on customers, scroll down to the bottom and look for "Add New Field". Add 1 field At End of Table. Enter "height" into the Field name, make sure VARCHAR is selected, and make the Length 3 (this could be any lenth, the default is 32 in oSc, but for my purposes height rarely exceeds 999cms wink.gif) Hit OKAY and you are done! in catalog/checkout_process.php: Find (around line 56): $sql_data_array = array('customers_id' => $customer_id, Add Before: $vip_number_query = tep_db_query("select vip_number from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'"); $vip_number_query_array = tep_db_fetch_array($vip_number_query); $vip_number = $vip_number_query_array['vip_number']; This is the database query. It is linked to the customer id number Find (around line 95): 'currency_value' => $order->info['currency_value']); Replace with: 'currency_value' => $order->info['currency_value'], 'vip_number' => $vip_number); Find (around line 240): if ($order->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n"; } Replace with: if ($order->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\nEmail: " . "\n" . ENTRY_VIP_NUMBER_TEXT . $vip_number . "\n\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n"; } This is the text you defined in the language file at the start. If you don't want the double space remove one of the \n. \n = New line. Save in catalog/includes/classes/order.php Find (around line 35): $order_query = tep_db_query("select customers_id, customers_name, Somewhere in this section, before the from TABLE, put your field name. for example i put in vip_number after the last_modified: ... last_modified, vip_number from ... Find (around line 66): $this->customer = array('id' => $order['customers_id'], I changed the last line (line 77) of this to: 'email_address' => $order['customers_email_address'], 'vip_number' => $order['vip_number']); Save This would now send the email with the custom field in the email. The process is the same to see it on the admin side. In catalog/admin/orders.php Find (around line 27): $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); Add Before: $vip_number_query = tep_db_query("select vip_number from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'"); $vip_number_query_array = tep_db_fetch_array($vip_number_query); $vip_number = $vip_number_query_array['vip_number']; This is the same code as we put in checkout_process.php Find (around line 138): <tr> <td class="main" valign="top"><b><?php echo ENTRY_CUSTOMER; ?></b></td> <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td> </tr> Because of the way we wanted it displayed i put the vip number next to the Customer: . I Replaced the above with the following, you might want to play with this to suit your needs. <tr> <td class="main" valign="top"><b><?php echo ENTRY_CUSTOMER . $order->customer['vip_number']; ?></b></td> <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td> </tr> Find (around line 356): $orders_query_raw = "select o.orders_id, o.customers_name, add in your field name in all three $orders_query_raw, mine was o.vip_number. this is the field that was created in the orders table. OPTIONAL Find (around line 376): <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $orders['customers_name']; ?></td> Replace with: <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $orders['customers_name'] . ' - ' . $orders['vip_number']; ?></td> This adds a - and the field info to the top part of admin/orders.php. we did this so we could see it at a glance. example: Customers Order Total Date Purchased Status TJ Alderson - 1234 $10.00 28/11/2007 10:00:17 Received Save In catalog/admin/includes/classes/order.php Find (around line 26): function query($order_id) { $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); $order = tep_db_fetch_array($order_query); Add your field in the $order_query. I dumped it beside last_modified again: ... last_modified, vip_number from... Find (around line 57): 'email_address' => $order['customers_email_address']); Since I wanted it for the customer info I put it inside the $this->customer = array('name' => $order['customers_name'], Replace with: 'email_address' => $order['customers_email_address'], 'vip_number' => $order['vip_number']); Save and upload the 4 files. Please note: I am not an expert, I know that it can be done differently (perhaps even better), this is what works for me. If this looks scary, go learn some more php and then come back. I don't think I can help with any problems, plus I should get back to work now. I tested this on a local version of oscommerce before I put it live. Link to comment Share on other sites More sharing options...
saifulwahab Posted February 1, 2008 Share Posted February 1, 2008 I have added 8 new custom fields. but when customer fill out registration form they got this message 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Girth, Chest Girth, Yoke Width, Arm Length_left, Shirt Length, Wrist Girth_Left,' at line 1 insert into customers (customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax, Neck Girth, Chest Girth, Yoke Width, Arm Length_left, Shirt Length, Wrist Girth_Left, Waist Girth, Hip Girth, Upper Arm Girth_Left, customers_newsletter, customers_password, customers_gender, customers_dob) values ('Shahzad', 'Ansari', '[email protected]', '0300570579', '', '', '', '', '', '', '', '', '', '', '1', '2998ed57f0db503e808b347fa2d485a0:ec', 'm', '19800823') [TEP STOP] Many thanks, Link to comment Share on other sites More sharing options...
dustin.tennill Posted February 16, 2008 Share Posted February 16, 2008 Hello, This post was very helpful ... I had exactly this need and this seems to work fine so far. Does anyone know what might need to be changed to NOT allow the customer to update a couple of the newly added fields? I want to add a "membership level" field, and a "membership expires" date field. I have mostly completed a working membership module for oscommerce, and I was afraid of changing the oscommerce code so did it without changing anything other than adding db tables and adding new php files (one change to the application_top.php file gets it included and working). It works fine, but it's a bit complicated and I have the opportunity to rewrite this for another customer - so I am going to fix it (I hope). I would like to move the membership settings into the user model/table and just wanted to make sure that there wasn't anything else I needed to do when messing with the oscommerce base code. Here is what I think I should do: Follow all the instructions in this article, but when I get to step three I just change any of the code that refers to changing this information so it only displays it on the user page. Anyone else see an issue with this? Is there anywhere else a user might be able to change/see their information? Thanks for any help you can provide ... I will post my membership code once I have it cleaned up a bit. Link to comment Share on other sites More sharing options...
gregp Posted March 27, 2008 Share Posted March 27, 2008 OK I'm really stumped on this one now :( I've gone through the instructions a few times over to add a field named how_heard to the create_account.php page but I can't get any data from that field to go into the db. When I use the account_edit.php page, same thing exactly. If I manually enter something into the relevant database field and view that customer's record in account_edit.php, the data shows up in the right field but the db contents don't change if I then modify the contents of the field in that form. Basically it's not writing anything to the db from my new fields, but is reading back OK. Here's what I've got so far which applies to this field: * I've got a varchar(50) database field named: customers_how_heard * The stuff at the top of the file includes: $how_heard = tep_db_prepare_input($HTTP_POST_VARS['how_heard']); * The sql_data_array includes: 'customers_how_heard' => $how_heard, * The account_query includes: customers_how_heard, * The actual form field itself is formed by: <td class="main"><?php echo tep_draw_input_field('how_heard', $account['customers_how_heard']); ?></td> As far as I can tell I've done exactly the same as 'fax' yet the info's only going one way. All the other fields work, so I could use the fax field for what I want instead, but I'd rather get it working properly than use a workaround. Ultimately I want to use radio buttons or a dropdown list but a text field will do to start with. Any help greatly appreciated, thanks! Greg Link to comment Share on other sites More sharing options...
cowcents Posted April 8, 2008 Share Posted April 8, 2008 Hello All, I am trying to add 'company_type' to my account info page. Got that working just fine..., but I can't get the 'company _type' to show up in my admin customer info. I have been trying for the past MANY hours and have re-done the admin/customer.php page MANY times hoping to get it right, but no luck..... Any help would be appreciated! Chantal >_< Link to comment Share on other sites More sharing options...
timmle Posted July 9, 2008 Share Posted July 9, 2008 This was a really good tutorial. Thankyou. How would i make this a drop down menu with a large selection (10-20) options, instead of a text input field??? Please can someone help with this...I have made it place a drop down menu inplace of the text field which is now blank, i just need to know how to link it to a list of options using the database. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.