-2

Give me idea for creating cron script for importing product csv file

2
  • Can you please check this link - Aug 26, 2022 at 7:30
  • not a good approach to import products through crons, try through system configuration,
    – IZANOVA
    Aug 26, 2022 at 17:24

1 Answer 1

0

Can you please look into this one - Blog

Can you please check this link

To create a cronjob:

app/code/Test/HelloWorld/etc/crontab.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job instance="Test\HelloWorld\Cron\Test" method="execute" name="test_helloworld_cron">
            <schedule>* * * * *</schedule>
        </job>
    </group>
</config>

app/code/Test/HelloWorld/Cron/Test.php

<?php

namespace Test\HelloWorld\Cron;

class Test
{

    public function execute()
    {

        $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/cron.log');
        $logger = new \Zend\Log\Logger();
        $logger->addWriter($writer);
        $logger->info(__METHOD__);

        return $this;

    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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