Start a new topic

New store via Magento setup script causes errors

Hi,

We're creating a new store scope via a Magento setup script and have noticed that the Searchanise module assumes that this will happen from the admin interface which also means that it's assumed that there will be an admin session with an email attached.

When doing this via a setup script, there is no authenticated admin user so fetching an email address from that user is impossible (see below).

Fatal error: Call to a member function getEmail() on null in <snip>/app/code/community/Simtech/Searchanise/Helper/ApiSe.php on line 1134

Are there plans to support store scope creation from a setup script and then authenticate with the API separately? For example; let the store get created in a disabled state in the script, the admin user then has to login and enable that store which triggers the API call.

In the meantime we'll have to implement a similar solution as a local override.

Thanks,
Todd.

Hi,


Thank you for your message. We need to discuss your request with our developers and will get back to you a bit later.

Hello!


Thank you for your time and patience.


It seems that the issue is caused by a bug. Our developers are working on this issue. It will be fixed in one of the future versions of the Searchanise extension.


Thank you.

Thanks for the quick replies Alexey!


Sounds good, glad I could help! I'll include the local fix for now and look out for future Searchanise versions for an upgrade path!


Todd.

Dear Todd,


Thank you for the information about this issue. We appreciate it so much.


Have a nice day!

Dear Todd,


Please try the following solution:


1. Open the app/code/community/Simtech/Searchanise/Helper/ApiSe.php file.

2. Replace the following part of code:


public static function signup($curStore = null, $showNotification = true, $flSendRequest = true)

{


with this one:


public static function signup($curStore = null, $showNotification = true, $flSendRequest = true)

{

    if (php_sapi_name() == 'cli') {

        return false;

    }


Please let us know if it helps.


Thank you.

Thanks Alexey.


I ended up going with a plugin before the `signup` method that checks if there's an active session and that the user is actually present and if so we follow back to the Searchanise code and continue as usual, otherwise we return false and the admin must manually save the store to enable Searchanise which seems to be working as expected and allows the Searchanise functionality to remain intact.


Todd.

Dear Todd,


Feel free to contact us in case you need any further assistance.


Thank you.

Login or Signup to post a comment