Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Heres a HARD one.. Can you figure this out


Retaliator127

Recommended Posts

Hello,

 

I have a recentely installed version on Oscommerce installed on my FTP server via Fantasico...

 

www.rc-wholesale.com

After that I restored a database backup I had from a prevous site. This is the problems that I got :(

 

When ever you go to place an order it goes through all the processes expect when it gets to the Order confirmation I get the following :

 

Billing Address (Edit)

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/host132/public_html/products/includes/functions/general.php on line 42

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/host132/public_html/products/includes/functions/general.php on line 42

 

Payment Method (Edit)

PayPal

 

 

So I went back and tried to enter a different address on the previous page where it says " Change Address " and this is what I got :

 

1062 - Duplicate entry '1-1' for key 1

 

insert into address_book (customers_id, entry_firstname, entry_lastname, entry_street_address, entry_postcode, entry_city, entry_country_id) values ('1', 'john', 'doe', '1287 a st', '70461', 'covington', '223')

 

[TEP STOP]

 

 

Please help me out with this one.. I am so stumped... If you want goto www.rc-wholesale.com and log in as a test customer and try to place an order.. watch what happens.. Any help would be great...

 

:) Also under the My store under the admin area I am getting this Below " My Store " and above the Edit boxes PLEASE HELP

 

 

Warning: Missing argument 2 for tep_get_zone_name() in /home/host132/public_html/products/admin/includes/functions/general.php on line 270

 

Warning: Missing argument 3 for tep_get_zone_name() in /home/host132/public_html/products/admin/includes/functions/general.php on line 270

Link to comment
Share on other sites

I am getting a similar error in my Admin section as well.

Warning: Missing argument 2 for tep_get_zone_name() in /var/www/html/catalog/admin/includes/functions/general.php on line 270

The setting for my store the Zone field is blank and I can not update it. I think the problem might lie in using an old database from a previous store install with possible some different contribution installed. The problem is that I don't know what contribution would have been installed. Any help with this problem would be appreciated.

Link to comment
Share on other sites

The one thing that I have found, there is a bug when a new user puts his/her address into the info for their account, the Box that has the default address is not checked by default, the users need to be sure to put the check in that box.

 

I've been trying to find where that is called, but haven't found this yet

SNAG-0052.jpg

 

See the box above I'm talking about that says Set as primary address, if this isn't checked, it even effects the ordering of the customer and also causes errors in the admin when you try to look at their info under customers in the admin.

 

This does need to be fixed as it should be set to checked by default when a new customer puts their info in and then unchecked if or when a customer wants to add another address. I haven't found a fix for this bug yet.

 

Not sure if this is causing your errors or not, but it's something to look at.

Best Regards

Link to comment
Share on other sites

I was receiving the same error during the confirmation page - reading the above post, I logged in, viewed and the edited my address by checking the box and the error was repaired. Now on to fixing the bug in general... at least now i know where to look! thanks!

Link to comment
Share on other sites

I was receiving the same error during the confirmation page - reading the above post, I logged in, viewed and the edited my address by checking the box and the error was repaired.  Now on to fixing the bug in general...  at least now i know where to look!  thanks!

The fix is easy

 

in the catalog/includes/modules/address_book_details.php

 

look for

 

<td colspan="2" class="main"><?php echo tep_draw_checkbox_field('primary', 'on', false, 'id="primary"') . ' ' . SET_AS_PRIMARY; ?></td>

 

and replace it with

 

<td colspan="2" class="main"><?php echo tep_draw_checkbox_field('primary', 'on', true, 'id="primary"') . ' ' . SET_AS_PRIMARY; ?></td>

 

and I think it'll take care of this problem forever, I hope :D

Best Regards

Link to comment
Share on other sites

I tried this fix by making the checkbox "checked" by default, as beardedone suggests.

 

The problem persists, though. (sad face)

 

I looked for help in the MySql support site and found this explanation

http://www.mysql.com/newsletter/2003-09/a0000000224.html

 

The update query needs to have an "Order by" qualifier....

INSERT INTO items VALUES (1,'bar'),(2,'qux');

 

Now, we want to add an entry named "foo" with an ID of 1, and shift all of the existing items up by one. Easy, you say - just add 1 to the id field values and then insert the new row:

 

UPDATE items SET id=id+1;

INSERT INTO items VALUES (1,'foo');

 

In theory, everything looks fine. In real life, however, the UPDATE query most probably bails out with the following error:

 

ERROR 1062: Duplicate entry '2' for key 1

 

This happens because key constraints are checked before updating each row (with MyISAM tables that are non-transactional, there's no other way, and for some reason InnoDB follows the same path). The update is done in the order the rows are stored in the table files, which, in case you haven't mixed DELETEs and INSERTs and caused the table to get fragmented, is the order you have inserted the rows into the table. So if MySQL starts to process the first row and tries to increment the id field by 1, the result of 2 already exists in the table and produces the error above, although it would be increased next and the final query result would not violate the key uniqueness.

 

But not to worry, MySQL has extended the UDPATE syntax with a possible ORDER BY clause, that will help us solve this problem. If we change the update query to:

 

UPDATE items SET id=id+1 ORDER BY id DESC;

 

With this ORDER BY clause, MySQL processes rows in descending order of id number: First, it updates 2 to 3, and then 1 to 2. Consequently, no duplicate-key violation occurs and the statement succeeds.

 

So I think the error is not coming from the checkbox -- it's somewhere in the "functions" files... there must be some function called by the address_book_details.php (or called somewhere else?) that handles the "insert into" and "update" in a way that doesn't work...at least, for those of us who are encountering this problem.

 

Does anyone else out there continue to have the 1062 error after changing the checkbox? Thanks --

Link to comment
Share on other sites

I found a fix that works for me, and it's this:

In the database, look in the address_book tables.

Look at addres_books_id

I thought it probably should not have any default value... (Mine was set at 1 for default value)

 

I changed it to --- default value (leave blank), and then I set the "extra" field to "auto increment."

 

Now it works, though. I hope this wasn't the wrong thing to do. I really know nothing about this stuff. ;)

Link to comment
Share on other sites

I found a fix that works for me, and it's this:

In the database, look in the address_book tables.

Look at addres_books_id

I thought it probably should not have any default value... (Mine was set at 1 for default value)

 

I changed it to --- default value (leave blank), and then I set the "extra" field to "auto increment."

 

Now it works, though. I hope this wasn't the wrong thing to do. I really know nothing about this stuff. ;)

I've noticed that in the database also there is nothing in the State area for any of the customers, but the info is there when I look at the invoices, I wonder where the state is stored for the customer info if not in the customer address_book database and why it's not in the customers data.

 

Interesting

Best Regards

Link to comment
Share on other sites

This same error message also seems to be happening to me when 2 people are trying to enter Option values in the admin. Any thoughts? :blink:

"Success has nothing to do with what you gain in life or accomplish for yourself. It's what you do for others."

 

- Danny Thomas, founder of St Jude Children's Research Hospital

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...