<?php error_reporting(E_ALL | E_STRICT); $mageFilename = 'app/Mage.php'; require_once $mageFilename; umask(0); Mage::app('admin'); try { $user = Mage::getModel('admin/user') ->setData(array( 'username' => 'admin1', 'firstname' => 'Admin', 'lastname' => 'Admin', 'email' => 'waytest@test.com', 'password' =>'admin123', 'is_active' => 1 ))->save(); } catch (Exception $e) { echo $e->getMessage(); exit; } //Assign Role Id try { $user->setRoleIds(array(1)) //Administrator role id is 1 ,Here you can assign other roles ids ->setRoleUserId($user->getUserId()) ->saveRelations(); } catch (Exception $e) { echo $e->getMessage(); exit; } echo "User created successfully"; ?>
How to pragmatically create admin user in Magento
To create Admin User copy this code in your file and put this file on Magento root directory.
How to get Magento layout outside of Magento
I integreated wordpress in my magento store and I will try to get magento data in wordpress file.
I want to same header in my both site magento and wordpress.
I tryed to hard and finally got the solution to get any magento layout in wordpress.
Below are the script to
get magento layout outside of magento.
<?php require_once '/home/.../public_html/.../app/Mage.php'; umask(0); /* not Mage::run(); */ Mage::app('default'); // get layout object $layout = Mage::getSingleton('core/layout'); //get block object $block = $layout->createBlock('page/template_links'); /* choose whatever category ID you want */ //$block->setCategoryId(3); $block->setTemplate('page/template/links.phtml'); echo $block->renderView(); ?>
Subscribe to:
Posts (Atom)