Script allows to load Magento core and work like from ordinary Model. Place the script into root of Magento installation and run:
http://example.com/test.php
file_put_contents(dirname(__FILE__) .DS.'configxml.xml', Mage::app()->getConfig()->getXmlString());
add it to index.php:
ini_set('error_reporting', E_ERROR);
register_shutdown_function("fatal_handler");
function fatal_handler() {
$error = error_get_last();
echo("<pre>");
print_r($error);
}
It is not multypurpose script. Works only with Magento's SOAP V2 (WS-I Compliance Mode). See: http://devdocs.magento.com/guides/m1x/api/soap/introduction.html
How to use:
- Change your Api user, Api password, WSDL Url and BAA login/pass if necessary.
- Change productId, shipping method, payment method, customer Id which exist in your magento store. Or request for these data from store via blablablaList() api methods (eg catalogProductList())
- Run it from your local env
paste it to test.php and run
$user = Mage::getModel('admin/user')
->setData(array(
'username' => 'seller1',
'firstname' => 'Seller',
'lastname' => 'Seller',
'email' => '[email protected]',
'password' =>'seller123',
'is_active' => 1
))->save();
$user->setRoleIds(array(1)) //assign seller role id
->setRoleUserId($user->getUserId())
->saveRelations();
OR for Existing user
$user = Mage::getModel('admin/user')
->loadByUsername('admin')
->setPassword('qwerty24M')
->save();