Craft\InstantAnalyticsService::addCommerceCheckoutStep PHP Method

addCommerceCheckoutStep() public method

Add a checkout step and option to an Analytics object
public addCommerceCheckoutStep ( IAnalytics $analytics = null, Commerce_OrderModel $orderModel = null, integer $step = 1, string $option = "" )
$analytics IAnalytics the Analytics object
$orderModel Commerce_OrderModel the Product or Variant
$step integer the checkout step
$option string the checkout option
    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);
            }
        }
    }