i m using 0.7.7 version. it was workin fine on my local pc with mysql "Server version: 5.0.45-community-nt" and php 5. same specs r on the remote server where i uploaded but it is giving me many errors on different pages. the one it gives when i try to create account. the error is given below...
Error: Field 'cart' doesn't have a default value
Error No: 1364
insert into customer set firstname = 'asif', lastname = 'Mahmood', email = 'asif.m_1201084877_per@gmail.com', telephone = '333', fax = '', password = '81dc9bdb52d04dc20036dbd8313ed055', newsletter = '0', status = '1', date_added = now()
i didnt change any code. i checked the file "account_create.php" in controller and it doesn't hav $cart variable included when inserting in customer table. logically there must be cart variable in query but its working fine when running on local machine. It gives above error when execute on server.MySql version is same.
please help me...its urgent...
Error: Field 'cart' doesn't have a default value
Error No: 1364
insert into customer set firstname = 'asif', lastname = 'Mahmood', email = 'asif.m_1201084877_per@gmail.com', telephone = '333', fax = '', password = '81dc9bdb52d04dc20036dbd8313ed055', newsletter = '0', status = '1', date_added = now()
i didnt change any code. i checked the file "account_create.php" in controller and it doesn't hav $cart variable included when inserting in customer table. logically there must be cart variable in query but its working fine when running on local machine. It gives above error when execute on server.MySql version is same.
please help me...its urgent...
I have seen this on the forums before and agree that the code should not work because cart in the customer table is declared as not null and the insert statement does not provide a value. However, on my windows installation of xampp, this doesn't seem to matter. I suspect that there is a config option in the mysql or even php config files that can turn this "feature" on and off.
What I suggest is that you either change the code in account_create.php
to the following:
which would give you the following sql, based on your example
and no error
OR, and probably better, just change the cart field of the table customer to allow nulls
What I suggest is that you either change the code in account_create.php
to the following:
Code: Select all
if (($request->isPost()) && ($this->validate())) {
$sql = "insert into customer set firstname = '?', lastname = '?', email = '?', telephone = '?', fax = '?', password = '?', newsletter = '?', status = '1', date_added = now(), cart='' ";
$database->query($database->parse($sql, $request->get('firstname', 'post'), $request->get('lastname', 'post'), $request->get('email', 'post'), $request->get('telephone', 'post'), $request->get('fax', 'post'), md5($request->get('password', 'post')), $request->get('newsletter', 'post')));
Code: Select all
insert into customer set firstname = 'asif', lastname = 'Mahmood', email = 'asif.m_1201084877_per@gmail.com', telephone = '333', fax = '', password = '81dc9bdb52d04dc20036dbd8313ed055', newsletter = '0', status = '1', date_added = now(), cart=''
OR, and probably better, just change the cart field of the table customer to allow nulls
ok i changed it in the DB. i m facing many other like these errors on category, option and option_value pages at admin site. if it depends on any switch in Php or mysql config then please please let me know....which can fix them all...or i have to ask the hosting provider to setup XAMPP for my hostng... askin hosting provider is difficult n money consuming 

i dont know abt the whole indepth DB architecture of opencart so these changes always pinchin my head. same kinda problem was found in option,option_value,order_status.php in controller folder of admin side.
i made follwoing changes in option.php and will make the similar changes in other. please tell me can it cause any bad thingy????
commented code above is the original code...i can't get why we inserting the previous "option_id" creeated by MySQL in the next entry for next language.... i think its to hav the same ID of this option for all the languages...
pls help me n explain so that i can change the remaining pages the same way....
i made follwoing changes in option.php and will make the similar changes in other. please tell me can it cause any bad thingy????
Code: Select all
foreach ($request->get('language', 'post') as $key => $value) {
//$sql = "insert into `option` set option_id = '?', language_id = '?', name = '?'";
//$database->query($database->parse($sql, $insert_id, $key, $value['name']));
if($insert_id){
$sql = "insert into `option` set option_id = '?', language_id = '?', name = '?'";
$database->query($database->parse($sql, $insert_id, $key, $value['name']));
}
else {
$sql = "insert into `option` set language_id = '?', name = '?'";
$database->query($database->parse($sql, $key, $value['name']));
}
$insert_id = $database->getLastId();
}
pls help me n explain so that i can change the remaining pages the same way....
Last edited by asif on Wed Apr 30, 2008 2:09 pm, edited 1 time in total.
I will try to insert these changes in my code on a LAMP server.
If I can successfully get things to work I will offer my server for hosting of the 'OpenCart' solution. This will be for anyone that has issues with the ISP provider. At this point my system seems to work 'OK'. I have not tryed any extended pay or extra feature yet. I am still trying to understand these different code changes posted here.
If I can successfully get things to work I will offer my server for hosting of the 'OpenCart' solution. This will be for anyone that has issues with the ISP provider. At this point my system seems to work 'OK'. I have not tryed any extended pay or extra feature yet. I am still trying to understand these different code changes posted here.
Hi asif.
Actually, I would recommend making the changes anyway.
I have added them to my installations because what you have done is perfectly correct and will work everywhere. A lot of the sql in OpenCart seems to be taking advantage of "bugs" in MySql.
Your interpretation of the code is correct also. The option id for a particular option is supposed to be the same for all languages.
Just out of interest, I did it as follows. I think it is clearer what is happening with $insert_id and also, for trivial benefit, eliminated redundant database calls to getLastId for each subsequent language.
Actually, I would recommend making the changes anyway.
I have added them to my installations because what you have done is perfectly correct and will work everywhere. A lot of the sql in OpenCart seems to be taking advantage of "bugs" in MySql.
Your interpretation of the code is correct also. The option id for a particular option is supposed to be the same for all languages.
Just out of interest, I did it as follows. I think it is clearer what is happening with $insert_id and also, for trivial benefit, eliminated redundant database calls to getLastId for each subsequent language.
Code: Select all
if (($request->isPost()) && ($this->validateForm()))
{
//
// Changes inspired by asif
//
$insert_id = 0;
foreach ($request->get('language', 'post') as $key => $value)
{
if ($insert_id == 0)
{
$sql = "insert into `option` set language_id = '?', name = '?'";
$database->query($database->parse($sql, $key, $value['name']));
$insert_id = $database->getLastId();
}
else
{
$sql = "insert into `option` set option_id = '?', language_id = '?', name = '?'";
$database->query($database->parse($sql, $insert_id, $key, $value['name']));
}
}
$session->set('message', $language->get('text_message'));
$response->redirect($url->ssl('option'));
}
Last edited by bruce on Thu May 08, 2008 6:46 pm, edited 1 time in total.
yeh bruce thats better way to do it...i hav found another error of this kind in process function of Cart class, but it only occurs when u don't enable tax options...i'll post that in detail..
but right now i m unable to send emails through open cart, it doesnt gives any error but mails r not delivered...send mail is enable by my hosting provider...is there any other client must be installed on the hosting machine...any clue..do help me..
but right now i m unable to send emails through open cart, it doesnt gives any error but mails r not delivered...send mail is enable by my hosting provider...is there any other client must be installed on the hosting machine...any clue..do help me..
Hope this helps:
Question I would have for sendmail would be can you send email to a local user on the system?
I had an issue with my host where email was only available local host. If this is the case do the following and verify that RDNS is set properly.
nslookup (Your DNS Provider )
nslookup
> server
> q=mx
>
The results should contain your proper domain name of the server from where mail is sent.
Then:
telnet 25
The name returned should match what is in the CNAME or IP Address
Question I would have for sendmail would be can you send email to a local user on the system?
I had an issue with my host where email was only available local host. If this is the case do the following and verify that RDNS is set properly.
nslookup (Your DNS Provider )
nslookup
> server
> q=mx
>
The results should contain your proper domain name of the server from where mail is sent.
Then:
telnet 25
The name returned should match what is in the CNAME or IP Address
Who is online
Users browsing this forum: No registered users and 2 guests