Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to get/set customer data externally? 
 
rambutan
Jr. Member
 
Total Posts:  2
Joined:  2008-07-13
 

Hi.

I’m attempting to write an application that uses Magento’s customer tables for its user data, while trying not to touch any of Magento’s code.

I found this thread, but Moshe’s suggestions do not seem to be working for me. I figure maybe it’s because the thread is almost a year old, and things may have changed too much in the current release, which as of now is 1.0.19870.4.

When I try the following suggestions from Moshe…

require_once MAGENTO_ROOT_DIR.'/app/Mage.php';
Mage::app('base');

$customer Mage::getModel('customer/customer')->setData(array(....))->save();
$id $customer->getId();

I get the following uncaught exception:

Fatal error: Uncaught exception ‘Mage_Core_Model_Store_Exception’ in D:\workspace\public_html\store\app\code\core\Mage\Core\Model\App.php:1049
Stack trace:
#0 D:\workspace\public_html\store\app\code\core\Mage\Core\Model\App.php(554): Mage_Core_Model_App->throwStoreException()
#1 D:\workspace\public_html\store\app\Mage.php(192): Mage_Core_Model_App->getStore(NULL) #2 D:\workspace\public_html\store\app\Mage.php(197): Mage::getStoreConfig(’web/url/use_sto...’, NULL)
#3 D:\workspace\public_html\store\app\code\core\Mage\Core\Controller\Request\Http.php(110): Mage::getStoreConfigFlag(’web/url/use_sto...’)
#4 D:\workspace\public_html\store\app\code\core\Mage\Core\Model\App.php(233): Mage_Core_Controller_Request_Http->setPathInfo()
#5 D:\workspace\public_html\store\app\Mage.php(404): Mage_Core_Model_App->init(’base’, ‘store’, Array)
#6 D:\PDT-Workspace\MissionTags\trunk\public_h in D:\workspace\public_html\store\app\code\core\Mage\Core\Model\App.php on line 1049

The exception happens as soon as “Mage::app(’base’)” is called. I’m running the code off of XAMPP under Windows, but I did try running it in my test Linux server, and I get the same errors.

Has anyone had any success in achieving external access to Magento’s customer tables? Any help would be very much appreciated!

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

It’s seems that you don’t have a store call ‘base’; maybe try Mage::app() ; insteat.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rambutan
Jr. Member
 
Total Posts:  2
Joined:  2008-07-13
 

It works!!

Thank you, nicolas46!!! You are a life saver!!!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top