kitchenniche Posted July 13, 2005 Share Posted July 13, 2005 Hi there, At first, thanks for this contribution, this will prevent frustrated customers i already had on my site. It seems to work but when creating an account i have the following at the top of the "Your Address" box : '' . ENTRY_COUNTRY_TEXT . '': ''); ?> plus At the bottom of the same box there is: ENTRY_COUNTRY instead of just "Country" Does somebody have an idea? Thanks very much Quote HIM - Dark Light - Out on 26/09/05 Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2005 Share Posted July 13, 2005 Sorry I missed that one and it works like a charm! Thanks a lot for your quick response and great help!! - Orverda <{POST_SNAPBACK}> Hi Steve, I have also included "Gender" as a required field in all froms/pages related to customer address. When customers creat a new account (creat_account.php), change shipping or payment address (checkout_shipping_address.php , checkout_payment_address.php), the defualt setting for both male and female radio buttons are unchecked (not chosen) , which is exactly what I want. But when registered customers to add a new address to his/her address book (address_book_process.php), the FEMALE radio button in the address form is already checked as default. I have seen this problem in most of OSC powered stores I visited so far. I am trying to make the FEMALE button unchecked, but couldn't find any where in address_book_process.php that I could make the change. I know this post could be kind of "other topic", but I couldn't find any clues in entire forums, so I am hoping to get advises from you as to which files are related to this issue that I can work on. Thanks in advance for your help! - Orverda Quote Link to comment Share on other sites More sharing options...
stevel Posted July 13, 2005 Author Share Posted July 13, 2005 Sandra, It looks as if you made an error in includes/languages/english.php, where these values are defined. Perhaps there's an extra or missing quote somewhere, or these definitions removed? What you want is something like this: define('ENTRY_COUNTRY', 'Country:'); define('ENTRY_COUNTRY_ERROR', 'You must select a country from the Countries pull down menu.'); define('ENTRY_COUNTRY_TEXT', '* (Page will refresh when changed)'); Orverda, An interesting find. In includes/modules/address_book_details.php, this code is responsible for the behavior: if (ACCOUNT_GENDER == 'true') { if (isset($gender)) { $male = ($gender == 'm') ? true : false; } else { $male = ($entry['entry_gender'] == 'm') ? true : false; } $female = !$male; It attempts to detect whether Male was specified either in the form or coming from an existing entry. But then it blindly sets $female "not $male", even if the current entry has neither value set. Try this code instead: if (ACCOUNT_GENDER == 'true') { if (isset($gender)) { $male = ($gender == 'm') ? true : false; $female = !$male; } else { $male = ($entry['entry_gender'] == 'm') ? true : false; $female = ($entry['entry_gender'] == 'f') ? true : false; } I have not tested this, but I think it will do the right thing. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
kitchenniche Posted July 13, 2005 Share Posted July 13, 2005 Sandra, It looks as if you made an error in includes/languages/english.php, where these values are defined. Perhaps there's an extra or missing quote somewhere, or these definitions removed? What you want is something like this: define('ENTRY_COUNTRY', 'Country:'); define('ENTRY_COUNTRY_ERROR', 'You must select a country from the Countries pull down menu.'); define('ENTRY_COUNTRY_TEXT', '* (Page will refresh when changed)'); Hi Stevel, thanks for your prompt reply, I did not have "define('Entry_country", "country:'); this solved the problem at the bottom of the "your address box" but i still get the error '' . ENTRY_COUNTRY_TEXT . '': ''); ?> at the top of this box. You can see that on my create account page do you have any ideas? thanks very much Quote HIM - Dark Light - Out on 26/09/05 Link to comment Share on other sites More sharing options...
stevel Posted July 13, 2005 Author Share Posted July 13, 2005 You also need the define for ENTRY_COUNTRY_TEXT. Perhaps a syntax error causes it to not be seen. The error may be on an earlier line. Compare your english.php carefully against the pre-edited one provided in the contribution. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
kitchenniche Posted July 13, 2005 Share Posted July 13, 2005 You also need the define for ENTRY_COUNTRY_TEXT. Perhaps a syntax error causes it to not be seen. The error may be on an earlier line. Compare your english.php carefully against the pre-edited one provided in the contribution. <{POST_SNAPBACK}> Hi Stevel, I have copied all define-codes which are for the create account from the pre-edited one from the contribution and i still get the error. thanks in advance Quote HIM - Dark Light - Out on 26/09/05 Link to comment Share on other sites More sharing options...
stevel Posted July 13, 2005 Author Share Posted July 13, 2005 Oh, I see. You have a syntax error in create_account.php which is causing the PHP code to be put out as HTML rather than executed. My guess is that there's a missing or extra quote somewhere near where ENTRY_COUNTRY_TEXT appears in the source. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
kitchenniche Posted July 13, 2005 Share Posted July 13, 2005 Oh, I see. You have a syntax error in create_account.php which is causing the PHP code to be put out as HTML rather than executed. My guess is that there's a missing or extra quote somewhere near where ENTRY_COUNTRY_TEXT appears in the source. <{POST_SNAPBACK}> Stevel, thanks a lot, you were right and it solved my problem. there was a bit of a mess in create_account.php probably because i just copied the code from the installation file. Thanks a lot for your help and for this great contribution Sandra Quote HIM - Dark Light - Out on 26/09/05 Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2005 Share Posted July 13, 2005 Orverda, An interesting find. In includes/modules/address_book_details.php, this code is responsible for the behavior: if (ACCOUNT_GENDER == 'true') { if (isset($gender)) { $male = ($gender == 'm') ? true : false; } else { $male = ($entry['entry_gender'] == 'm') ? true : false; } $female = !$male; It attempts to detect whether Male was specified either in the form or coming from an existing entry. But then it blindly sets $female "not $male", even if the current entry has neither value set. Try this code instead: if (ACCOUNT_GENDER == 'true') { if (isset($gender)) { $male = ($gender == 'm') ? true : false; $female = !$male; } else { $male = ($entry['entry_gender'] == 'm') ? true : false; $female = ($entry['entry_gender'] == 'f') ? true : false; } I have not tested this, but I think it will do the right thing. <{POST_SNAPBACK}> Hi Steve, The new code above is working great. Though "wrong topic", I am so glad I aksed the right person - You Are the Solution. Thank You! - Orverda Quote Link to comment Share on other sites More sharing options...
Sid04 Posted July 14, 2005 Share Posted July 14, 2005 Steve, I was wondering if you could tell me teh advantages of your contribution over the following one: http://www.oscommerce.com/community/contributions,2148 Reason being, it only mods 3 files. I currently have a seperate pricing per customer contrib. installed, and im half afraid yours may interfere. I was modding the first file in your install list, and its already dealing with some of the same lines modded in the seperate pricing contribute. Your input is appreciated, thanks. <{POST_SNAPBACK}> Quote Link to comment Share on other sites More sharing options...
stevel Posted July 14, 2005 Author Share Posted July 14, 2005 That contribution is a simpler one for stores that sell to primarily one country. One major difference is that if the customer changes the country, the state list does not change to be that of the new country. The customer would have to submit the form, get an error, and then correct the state. Whereas in my contrib, the list refreshes automatically. If you sell to one or two countries only it's a bit simpler than Country-State Selector, but it's not as "general purpose". Pick whichever one best meets your needs. I doubt you'd see much conflict between C-S Selector and a separate pricing contrib. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Sid04 Posted July 17, 2005 Share Posted July 17, 2005 this is what im mainly worried about in the first file im changing..... as per directions for the address_book_process.php file: Line 191 Replace: if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) {with: // +Country-State Selector } if ($refresh) { // Recreate $entry from post values collected above $entry = array( 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_state' => "", 'entry_zone_id' => (int)0, 'entry_country_id' => (int)$country); if (ACCOUNT_GENDER == 'true') $entry['entry_gender'] = $gender; if (ACCOUNT_COMPANY == 'true') $entry['entry_company'] = $company; if (ACCOUNT_SUBURB == 'true') $entry['entry_suburb'] = $suburb; } else // -Country-State Selector if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) { at that place in my file I apparently already had edited for SPPC: // BOF Separate Pricing Per Customer if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) { $entry_query = tep_db_query("select entry_gender, entry_company, entry_company_tax_id, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$HTTP_GET_VARS['edit'] . "'"); // EOF Separate Pricing Per Customer how exactly should i implement your code into this....just simply do replace the line as stated in your directions or will it mess up the SPPC mod and lose my "company tax id" field? Thanks Quote Link to comment Share on other sites More sharing options...
stevel Posted July 17, 2005 Author Share Posted July 17, 2005 The code you show from SPPC starts at the line after //- Country-State Selector in the above excerpt. There is no conflict here. I included that last line to make it easy to see where it goes - it doesn't get changed in my contrib. As for the "company tax id" field, you'd want to add it in the places that the other ACCOUNT_ fields are manipulated, including the excerpt above. So you would add a line of the form: 'entry_company_tax_id' => $company_tax_id, to the array constructor. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Sid04 Posted July 17, 2005 Share Posted July 17, 2005 yes, I realize that the one line that is in the SPPC mod is the same line that is replaced in your mod(but isnt modified). My concern is the following line in the SPPC mod.......im wondering if that will conflict with yours....?? The SPPC line that resides after yours is: $entry_query = tep_db_query("select entry_gender, entry_company, entry_company_tax_id, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$HTTP_GET_VARS['edit'] . "'"); Quote Link to comment Share on other sites More sharing options...
Sid04 Posted July 17, 2005 Share Posted July 17, 2005 also, is there anywhere else in your mofified code that I need to modify to incorporate for the added "company tax id" field asneed by the SPPC mod? Thanks for your time! Quote Link to comment Share on other sites More sharing options...
stevel Posted July 18, 2005 Author Share Posted July 18, 2005 Any place you see ACCOUNT_COMPANY, add a line for the company tax id field. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Sid04 Posted July 18, 2005 Share Posted July 18, 2005 yes, I realize that the one line that is in the SPPC mod is the same line that is replaced in your mod(but isnt modified). My concern is the following line in the SPPC mod.......im wondering if that will conflict with yours....?? The SPPC line that resides after yours is: ? ?$entry_query = tep_db_query("select entry_gender, entry_company, entry_company_tax_id, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$HTTP_GET_VARS['edit'] . "'"); <{POST_SNAPBACK}> Quote Link to comment Share on other sites More sharing options...
Sid04 Posted July 18, 2005 Share Posted July 18, 2005 I found the following references of "ACCOUNT COMPANY" throughout the install file.... if (ACCOUNT_COMPANY == 'true') $entry['entry_company'] = $company; twice: if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']); so I simply add "'entry_company_tax_id' => $company_tax_id," after each of those? Quote Link to comment Share on other sites More sharing options...
stevel Posted July 18, 2005 Author Share Posted July 18, 2005 No. You need to look at what each line is doing for the "company" field and do the same thing for company_tax_id. It's not the same line of code everywhere. In the cases above, you could duplicate the line and replace "company" (lowercase only) with "company_tax_id" and it should work. But you will need to apply some thought to the process. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Sid04 Posted July 19, 2005 Share Posted July 19, 2005 (edited) I could use alittle more info, if you would be so nice. I only see the "ACCOUNT_COMPANY" reference in three files: address_book_process.php checkout_payment_address.php checkout_shipping_address.php The first looks like it is used to keep the entered info on the page there after the page refreshes. The second two look like the display the comapny info during checkout. Well, the value im interested in adding doesnt need displayed during checkout....so should I skip adding it to the checkout_payment_address.php and checkout_shipping_address.php files? Im really not sure what the address_book_process.php page is even for, so im unsure if I should bother adding the company_tax_id field there or not. All of the above got me wondering.....if the ACCOUNT_COMPANY firls is in these files, why wouldnt it be in other files where the company info field is located, such as the create_account page? I guess im just trying to understand more about how this contribution functions related to the company fields, both for incorporating the company_tax_id field i need(or dont need) to add as well as for helping to learn more about PHP. You can obviously tell im no wizard...it takes me awhile to rough through this stuff. Thanks for your time. Edited July 19, 2005 by Sid04 Quote Link to comment Share on other sites More sharing options...
stevel Posted July 19, 2005 Author Share Posted July 19, 2005 Sorry, I should have been more clear. It's any place there is a variable or field containing "company". Not all of them are protected by a test on ACCOUNT_COMPANY. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Sid04 Posted July 20, 2005 Share Posted July 20, 2005 what are the : if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']); lines in the checkout_payment_address.php and checkout_shipping_address.php files actually doing? I may not even want to add the company tax id section to these depending on what they are there for. Basically, the customer needs to be able to enter the tax id on the create account page page upon registering and has to be able to edit it in their account info section. Quote Link to comment Share on other sites More sharing options...
stevel Posted July 20, 2005 Author Share Posted July 20, 2005 Those lines are executed when the user submits the page, and sets the variable ($company) in this case from whatever the user put in for the Company field in the form. It skips this if the Company field was disabled in admin. If you are adding fields to the form, then you need lines similar to this to transfer the information from the form to the variable. You don't have to protect the assignment with an if test if you know you'll always want it. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Sid04 Posted July 20, 2005 Share Posted July 20, 2005 currently the company_tax_id field is not included in the checkout pages for the user to alter at that point, so I guess I dont need to add it to your contribution on those pages either? Also, on the address_book_process page....the company_tax_id field can not be altered. It is shown as text, but not in a box that you can change it. Does that matter as far as adding it to your contribution.......do i need to since its not a editable field on that page? What does the address_book_details page deal with? I cant seem to find it >_< Quote Link to comment Share on other sites More sharing options...
stevel Posted July 20, 2005 Author Share Posted July 20, 2005 address_book_details is in includes/modules. It is common functionality for address book pages. If the company_tax_id is a field in the address book record, then you would add it at least as a hidden form field and a variable so that it gets written to the database properly. Your interest is in making sure the data gets carried along and written to the order record properly. Quote Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.