Using Magento Api to create shell scripts seems to be easy, but there are too many things to take into account to get the most of it. In this case, I want to explain how to pass an argument from the command line when executing a magento shell script.

You have to call the script passing the argument title and argument value:

php shellscript.php --argument_title argument_value

Then, on the script code, you can retrieve this value using from your class using:

$this->getArg('argument_title')
Categories: Development

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.