Jump to content

Creating a warehouse I get needs company error


Recommended Posts

I need help figuring out an issue that I may have introduced but I still need to figure out how to fix it.

I have a site that is a multi-store and I have enabled the advanced-stock management. Now when I try to go add a new warehouse I get this error:

 

2 errors 

  1. company is required.
  2. The address is not correct. Please make sure all of the required fields are completed.

 

So now I'm trying to figure out why it is requiring company and company isn't even a field on the new Warehouse form. 

 

TIA,

Don

 

 

Link to comment
Share on other sites

Don,

 

This issue might have been logged in the issue database, but there are quite a few problems with adding Warehouses in general so I won't list those ticket numbers since it's not clear which is which (go to forge.prestashop.com and browse issues then search for "Warehouse Company")

 

I took a peek at the code for AdminWarehouseController and AdminAddressController and the issue is because company is an "optional" field that isn't supported well between the two. I believe it's required in the context of an address, but optional in the context of the company.

 

My first workaround attempted to just disregard the error message from the AdminAddressController, but that blows up in your face because the underlying address model will eventually throw an error as it constantly expects company to be populated. The easiest workaround until the two controllers play better is to simply hard code a dummy company to make everything happy, which is what I did for the time being:

 

Around line #523 in AdminWarehousesController.php you can add this line:

        $address->id_state = Tools::getValue('id_state', null);
        $address->city = Tools::getValue('city', null);
        $address->company = 'Dummy'; // FIXME fix warehouse not saving bug

Here is the GitHub source that appears to be the same in current development:

 

https://github.com/PrestaShop/PrestaShop/blob/development/controllers/admin/AdminAddressesController.php#L167

 

https://github.com/PrestaShop/PrestaShop/blob/development/controllers/admin/AdminWarehousesController.php

  • Like 2
Link to comment
Share on other sites

  • 10 months later...
  On 9/24/2013 at 8:33 PM, stnadmin said:

I need help figuring out an issue that I may have introduced but I still need to figure out how to fix it.

I have a site that is a multi-store and I have enabled the advanced-stock management. Now when I try to go add a new warehouse I get this error:

 

2 errors 

  1. company is required.
  2. The address is not correct. Please make sure all of the required fields are completed.

 

So now I'm trying to figure out why it is requiring company and company isn't even a field on the new Warehouse form. 

 

TIA,

Don

Some one can help us, I have a same problem please..........

  • Like 1
Link to comment
Share on other sites

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...