Jump to content

An error occurred while creating object. carrier


Recommended Posts

That is the full error I get,

it is in the BO when trying to add a carrier. when I click save it says "An error occurred while creating object. carrier"

I have included a screen shot of the error.

Thanks
nick


Could you add this lines to your /admin1425/tabs/AdminCarriers.php after line 223 ?
    
print_r($_POST['groupBox']);
exit;


Than retry to create or update a carrier. It may give me some tips about this bug. Please let me know the printed code

may be like Array ( [0] => 1 ) Array ( [0] => 1 ) )

Link to comment
Share on other sites

Hi,

I have pasted the code as requested and nothing has happends, no more details have appeared.
my line 223 is <input type="hidden" name="is_module" value="1">

is this correct.

Thanks
nick

Im sorry i give wrong line number
it must be line 262
before
foreach ($groups as $group)

Link to comment
Share on other sites

Hi,

I have taken the code out of admincarriers.php and tried again .

this is the message im getting now.

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home2/first4kn/public_html/testsite.co.uk/admin1234/tabs/AdminCarriers.php on line 264

I hope this is what you are after.

Thanks
Nick

Link to comment
Share on other sites

Hi,

I have taken the code out of admincarriers.php and tried again .

this is the message im getting now.

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home2/first4kn/public_html/testsite.co.uk/admin1234/tabs/AdminCarriers.php on line 264

I hope this is what you are after.

Thanks
Nick


Yes as I predicted line 264
$_POST['groupBox'] variable must be an array but not

I advice remove whole line 264 at /Your Admin Dir /tabs/AdminCarriers.php
if (in_array($group['id_group'], $_POST['groupBox']))


Error will be fixed but every carrier will be enabled for all customer groups.

Link to comment
Share on other sites

If you sure remove
if (in_array($group['id_group'], $_POST['groupBox']))

If sure someting goes wrong on your database.
Adding
define('_PS_DEBUG_SQL_', true);



top of the /tabs/AdminCarriers.php. may be shows more detail.



I have done this, it has made no difference, im not getting anymore information appearing.

Nick
Link to comment
Share on other sites

I am having the same problem,"An error occurred while updating object. carrier" with no extra info. Bit of an arse ache as I was hoping to get 1.4.3 back up and live in the coming few days..

More info when I turned on debug:

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/diaphrag/public_html/admins/tabs/AdminCarriers.php on line 264

Link to comment
Share on other sites

I am having the same problem,"An error occurred while updating object. carrier" with no extra info. Bit of an arse ache as I was hoping to get 1.4.3 back up and live in the coming few days..

More info when I turned on debug:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/diaphrag/public_html/admins/tabs/AdminCarriers.php on line 264


This error explains as I sad the $_POST['groupBox'] variable must be an array but isnt at line 264. I guess the check boxes named with groupBox (<input name="groupBox[]"... ) converts to none array if you have only one group.
Link to comment
Share on other sites

Right, a quick fix thanks to mr6 on the french IRC chat room... just edit the correct variables u need into phpmyadmin, thus bypassing the shodding presta SQL hookups :D wa-la! it works! messy but effective :)

hope this helps someone else! feel free to pm me if anyone needs a hand with the phpmyadmin

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hi Paul,

Can you tell me which tables/rows i have to edit in the prestashop database?
I want to add free shipping to the Uk 1-3 working day delivery.
Europe £8.50 5-10 working days
All other international destinations £19.50 5-10 working days

Any help Muchly appreciated
Cheers

EDIT:
Not to worry i found the part i needed to fix.

I replaced the whole "ps_carrier" table with one from a fresh install of 1.4.3 via PHPmyadmin.

Of course i now have to fill in the information for the carriers themselves but at least i can actually save.

Hopefully thats helpful to someone. Let me know if anyone needs more details or if i just didnt really explain it very well and ill try and share what i found.

Good luck

Link to comment
Share on other sites

Update, Neil's fix of using a fresh ps_carrier table seems to work a treat! On analysis there are a few rows in there which aren't included in some of the older db's i guess. Maybe an oversight in the update process of not updating said table?

Thanks for the fix Neil!

Link to comment
Share on other sites

  • 1 month later...

Hi all,

 

I've the same problem as mentionned above :

 

Warning: in_array() expects parameter 2 to be array, null given in /customers/7/4/9/n-e-d.be/httpd.www/admin/tabs/AdminCarriers.php on line 272 Warning: in_array() expects parameter 2 to be array, null given in /customers/7/4/9/n-e-d.be/httpd.www/admin/tabs/AdminCarriers.php on line 272

 

I tried to replace the file admincarriers with the one from PS1.4.4.1 but it does nothing.

 

I understood that you replaced the whole ps_carrier table but don't know how to do this :-(

Could you please help me with that point?

 

Thanks in advance,

 

Nextgen

 

EDIT : My PS is PS 1.4.2.5

Link to comment
Share on other sites

Hi nextgen, I didn't specifically recreate the tables, I just merely went through them using phpmyadmin to edit the sql DB to be holding the information that it needed as the main problem was the settings I was changing were not getting saved. So essentially you just have to manually edit it instead of using the presta back office GUI.

Link to comment
Share on other sites

  • 4 months later...

I also had this problem and finally figured out a solution after debugging prestashop. There's actually a bug in prestashop DB class. To fix the bug, open prestashop\classes\Db.php file, find autoexecute function and replace:

 

 

foreach ($values AS $key => $value)

$query .= '\'' . $value .'\',';

with



foreach ($values AS $key => $value)
$query .= '\'' . (is_bool($value) ? ($value ? '1' : '0') : $value) .'\',';

 

and

 

 

foreach ($values AS $key => $value)
$query .= '`'.$key.'` = \''.$value.'\',';

with

 

 

foreach ($values AS $key => $value)
$query .= '`'.$key.'` = \''.(is_bool($value) ? ($value ? '1' : '0') : $value).'\',';

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...