As part of the scheduled product upload process through Rapidflow, cron jobs need to be set up to coincide with the csv uploads from Commerce5. 


During setup Red Rook will provide the schedule for when the cron should run as well as the profiles that should run as part of the task but it is the responsibility of the Web Developer to configure the PHP file that will be used in the cron.



A typical PHP cron file for Magento 1 will look similar to this:


<?php
 
// initialize Magento environment
include_once "app/Mage.php";
Mage::app('admin')->setCurrentStore(0);
 
$helper = Mage::helper('urapidflow');

// Import Products:
$helper->run(3);

// Import Extra:
$helper->run(8);



Here we are using the Rapidflow profile ID (3 for Products, 8 for Extra) to specify the profiles that should run. The profile ID can be found on the Rapidflow page in the Magento admin under System > Rapidflow:


Other profiles can be added or removed using this format as needed. Profiles can also be specified using the profile name; Unirgy provides examples for this method here: https://secure.unirgy.com/wiki/urapidflow/run_scheduled




Magento 2


A typical profile for Magento 2 will look similar to this:


<?php
/**
* Created by pp
* @project magento202
* default file path /magento202/app/code/Unirgy/RapidFlow/misc/rf.php
*/

use Magento\Framework\ObjectManagerInterface;

try {
//    if you move this file, adjust bootstrap.php path
    require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
    echo <<<HTML
{$e->getMessage()}
</div>
HTML;
    exit(1);
}

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'admin'; // change this to appropriate store if needed.
$params[\Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM] = true;
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params); // bootstrap

/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');

// configure environment
$om = $bootstrap->getObjectManager();
$areaList = $om->get('Magento\Framework\App\AreaList');
$areaCode = $areaList->getCodeByFrontName('admin');
/** @var \Magento\Framework\App\State $state */
$state = $om->get('Magento\Framework\App\State');
$state->setAreaCode($areaCode);
/** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */
$configLoader = $om->get('Magento\Framework\ObjectManager\ConfigLoaderInterface');
$om->configure($configLoader->load($areaCode));

function rfImportProducts(ObjectManagerInterface $om)
{
    runRfProfile($om, "5");
}

function rfImportExtra(ObjectManagerInterface $om)
{
    runRfProfile($om, "6");
}

/**
* Function to
* @param ObjectManagerInterface $om
* @param string|int $profile
*/
function runRfProfile(ObjectManagerInterface $om, $profile)
{
    /** @var \Unirgy\RapidFlow\Helper\Data $helper */
    $helper = $om->get('\Unirgy\RapidFlow\Helper\Data');
    $helper->run($profile);
}

rfImportProducts($om); 
rfImportExtra($om); 


Here we define the rfImportProducts and rfImportExtra functions with the correct profile (5 for Import Products, 6 for Import Extra) and then call those functions at the end of the file. Other profiles can be added or removed using this format as needed.


Unirgy's M2 template/example can be found here: https://secure.unirgy.com/wiki/urapidflow/run_scheduled/m2