cancel
Showing results for 
Search instead for 
Did you mean: 

LocalizedException: “An item needs to be selected. Select and try again.”

LocalizedException: “An item needs to be selected. Select and try again.”

I am trying to customize email extension by adding it to newsletter subscribers, and when I select/check subscribers and send email, I get error as the title suggests.

 

It also doesn't show me the number of selected Emails, whereas in "Customer" tab, I am able to see in a "confirm" message the number of selected customers.

 

I think somehow in Newsletter its not sending POST request to massSend.php, somehow massSend.php is being triggered with empty data.

 

Error:

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): An item needs to be selected. Select and try again.

Exception #0 (Magento\Framework\Exception\LocalizedException): An item needs to be selected. Select and try again.
#1 MageVision\MassEmailCustomers\Controller\Adminhtml\Email\MassSend->execute() called at [vendor/magento/framework/App/Action/Action.php:108]

I have added necessary classes to the PHP i think, my code is below https://github.com/nix0x00/newsletter_subscribers/blob/master/massSend.php I assume its being thrown from line :119 `$this->send($item);

 

Can anyone please suggest me whats wrong here?

**My XML file is:**

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="adminhtml.newslettrer.subscriber.grid.massaction">
<arguments>
<argument name="options" xsi:type="array">
<item name="mass_email_customer" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Email to Customers</item>
<item name="url" xsi:type="string">massemailcustomers/email/massSend</item>
<item name="confirm" xsi:type="string" translate="true">Are you sure you want to send an email to the selected subscriber(s)?</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>

 

Also, here you can get the extension which I have customized. 

 

newsletter_subscriber_block.xml  is located under /view/admin*/layout*/

massSend.php file is located in Controller directory.