Hi,
I get below error in the admin Add Shipment page when trying to add a tracking number and clicking on Submit Shipment button.
Customer website ID must be specified when using the website scope
Solved! Go to Solution.
Hi @Sunil Patel,
Thank you for your suggestion. I placed the debug code in the loadByEmail method of Customer.php file located in /app/code/core/Mage/Customer/Model/Resource.
An extension that was installed to subscribe customers to newsletter was throwing this exception:
$customer = Mage::getModel('customer/customer')->loadByEmail($customerEmail); //error
This is how I was able to fix:
$customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($customerEmail);
Hi @sv_mage,
How that Custoemr was created?
It seems Magento can't identify the website for the user. Did you created with the order on-the-fly?
Hi Damian,
Customers are creating these orders from the front-end on the website.
I just found that the customer ID is saved as NULL in the order record in "sales_flat_order" table. Could this be the problem?
Please ignore my null customer id observation - those are guest users and this issue happens with all users.
Hello @sv_mage
http://freegento.com/doc/df/d5f/_customer_2_model_2_entity_2_customer_8php-source.html
Mage_Customer_Model_Entity_Customer
Can you check that file and error msg coming from that file
You can debug using below code add before that msg
foreach(debug_backtrace() as $t) { if(isset($t['function'])) echo $t['file'] . ' line ' . $t['line'] . ' calls ' . $t['function'] . "()<br/>"; }
exit;
And check which class called that method, maybe custom module doing that.
Hope it will help you.
Hi @Sunil Patel,
Thanks for your response. The customer.php file in the path you mentioned was an empty class defined as below:
class Mage_Customer_Model_Entity_Customer extends Mage_Customer_Model_Resource_Customer{}
There is another Customer.php in this path - /app/code/core/Mage/Customer/Model/Convert/Adapter
and I added your debug code above the call to loadByEmail method. I did not see that getting executed anywhere. I have tried creating a new order and processing the invoice and shipment for the order. I still get the same error message on click on Submit Shipment.
This is the screenshot of the message.
Is there a way to track where the global message is getting populated from?
Thank you!
Hello @sv_mage
Try to find using grep command that msg and check how many files contain that msg. and debug it.
Hopefully, it will help you.
Hi @Sunil Patel,
Thank you for your suggestion. I placed the debug code in the loadByEmail method of Customer.php file located in /app/code/core/Mage/Customer/Model/Resource.
An extension that was installed to subscribe customers to newsletter was throwing this exception:
$customer = Mage::getModel('customer/customer')->loadByEmail($customerEmail); //error
This is how I was able to fix:
$customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($customerEmail);