I am brand new to Magento module development, and I need some help getting started. My goal is relatively simple: I'd like to create a module which fetches all products with a custom attribute 'amazon_ready' set to true, saves these out to a file, and then sets that attribute for all those products back to false. I'd like this to happen every 24 hours.
So far, I have set up a simple cron module using the example found here.
<?php
namespace SuttersMill\AmazonCron\Cron;
use \Psr\Log\LoggerInterface;
class Test {
protected $logger;
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* Write to system.log
*
* @return void
*/
public function execute()
{
$this->logger->info('Cron Works');
// Code to pull in product entities from datastore.
}
}
How do I get all products where the custom attribute is set to true? Any pointers in the right direction would be immensely helpful.