1

Im new at magento and am stuck trying to modify the "catalog_product_alert"

I need to update it so even if a product has a list of customers subscribed to the stock alert the alert email are NOT sent. Basically override the product_alert_cron frequency configuration

Is there a way to get the drop down to say never I tried creating a custom module where I added a config.xml file with the code below:

(Drop down defined: vendor/magento/module-product-alert/etc/adminhtml/system.xml)

 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <catalog>
            <productalert_cron>
                <frequency>
                Never
                </frequency>
            </productalert_cron>
        </catalog>
    </default>
</config>
2
  • Do you want to don't notify customers for specific product or disable the feature at all. It's not clear with your description. Please provide more details about expected result. Feel free to update question and post additional comment about this. Aug 6 at 23:13
  • @Victor Tihonchuk, I updated the question. Thanks for the help.
    – joguz
    Aug 8 at 0:47

1 Answer 1

0

Just for fun I'll provide few ways how to do this:

1. Disable extension

You can disable extension from your system at all, but EE extension Magento_CatalogStaging depends from it and you probably can have some issues with EE.

2. Disable functionality with configuration

You need to disable catalog/productalert/allow_price and catalog/productalert/allow_stock in configuration (See Stores -> Configuration -> Catalog -> Product Alerts (check for all stores)) and the system will run Magento\ProductAlert\Model\Observer::process but will not run send logic.

3. Create plugin

You can create plugin for around to Magento\ProductAlert\Model\Observer::process and don't run logic at all

4. Schedule to 30th Feb

You can change schedule into 30 Feb, but you need to reset config_path

<schedule>0 0 30 2 *</schedule>

5. Use 3rd party Cron Manager

Install something like EthanYehuda_CronJobManager https://magento.stackexchange.com/a/358615/91782 and manage your processes with.

Summary:

I think method 2 is best and easy for you

2
  • thanks for the help I was able to achieve stopping the cron job with your suggestion but Im still having trouble with the drop down, I edited the question above
    – joguz
    Aug 9 at 20:46
  • For implement something like Never you need to change source_model (declare new instead of \Magento\Cron\Model\Config\Source\Frequency) and backend_model to add Never option and process it. I don't see sense to do this. Aug 10 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.