public function getSelectedCombinationFromSession($productId)
    {
        $combination = null;

        if (!empty($productId)) {
            $items = Yii::$app->session[self::SESSION_KEY_SELECTED_COMBINATIONS];

            if (!empty($items)) {
                $combinationId = null;

                foreach ($items as $item) {
                    if ($item['productId'] == $productId) {
                        $combinationId = $item['combinationId'];
                    }
                }

                $combination = Combination::findOne($combinationId);
            }
        }

        return $combination;
    }
public function getSelectedCombinationFromSession($productId)
    {
        $combination = null;

        if (!empty($productId)) {
            $items = Yii::$app->session[self::SESSION_KEY_SELECTED_COMBINATIONS];

            if (!empty($items)) {
                $combinationId = null;

                foreach ($items as $item) {
                    if ($item['productId'] == $productId) {
                        $combinationId = $item['combinationId'];
                    }
                }

                $combination = Combination::findOne($combinationId);
            }
        }

        return $combination;
    }
public function getSelectedCombinationFromSession ( $ productId ) { $ combination = null ; if ( ! empty ( $ productId ) ) { $ items = Yii :: $ app -> session [ self :: SESSION_KEY_SELECTED_COMBINATIONS ] ; if ( ! empty ( $ items ) ) { $ combinationId = null ; foreach ( $ items as $ item ) { if ( $ item [ 'productId' ] == $ productId ) { $ combinationId = $ item [ 'combinationId' ] ; } } $ combination = Combination :: findOne ( $ combinationId ) ; } } return $ combination ; }
Gets last selected product combinations from session.

@param $productId [[Product]] id
@return null|Combination
Gets last selected product combinations from session .