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 simulate a user action
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

I want to write a script which do exactly the same action as the one I get when I go to this URL :

http://magento_perso/index.php/synorder/order/importcsv

How can I do this please ? (dispatchEvent.... some think like that ?...)

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Unirgy
Guru
 
Avatar
Total Posts:  478
Joined:  2007-09-07
 

i’m not sure if it’s going to work, but you can try this:

<?php

// replace with location to your mage.php
require_once "app/Mage.php"

Mage::app();

Mage::app()->getRequest()
    ->
setModuleName('synorder')
    ->
setControllerName('order')
    ->
setActionName('importcsv');

Mage::app()->getFrontController()->dispatch();
 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

Thanks you very much, It works

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

Before to dispach the event in had to login, if I don’t do this my script doesn’t work, I only see the “Log into Magento Admin Page” but nothing more.

Did someone know how to login into Magento Admin Page with some lines of php code ? please

[update]

I found :

$session = new Mage_Admin_Model_Session();
$session->login("username""pass");
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top