public function addCommerceCheckoutStep($analytics = null, $orderModel = null, $step = 1, $option = "")
{
if ($orderModel) {
if ($analytics) {
// Add each line item in the transaction
// Two cases - variant and non variant products
$index = 1;
foreach ($orderModel->lineItems as $key => $lineItem) {
$this->addProductDataFromLineItem($analytics, $lineItem, $index, "");
$index++;
}
$analytics->setCheckoutStep($step);
if ($option) {
$analytics->setCheckoutStepOption($option);
}
// Don't forget to set the product action, in this case to CHECKOUT
$analytics->setProductActionToCheckout();
InstantAnalyticsPlugin::log("addCommerceCheckoutStep step: `" . $step . "` with option: `" . $option . "`", LogLevel::Info, false);
}
}
}