public function addToProductCompare($compare_action_model)
    {
        $errors = $this->error();

        if (empty($errors)) {
            $submitted = $this->getSubmitted();
            $result = $compare_action_model->add($submitted['product'], $submitted);
        } else {
            $result = array(
                'redirect' => '',
                'severity' => 'warning',
                'message' => $this->format($errors)
            );
        }

        if ($this->isAjax()) {
            $this->outputJson($result);
        }

        $this->redirect($result['redirect'], $result['message'], $result['severity']);
    }
public function addToProductCompare($compare_action_model)
    {
        $errors = $this->error();

        if (empty($errors)) {
            $submitted = $this->getSubmitted();
            $result = $compare_action_model->add($submitted['product'], $submitted);
        } else {
            $result = array(
                'redirect' => '',
                'severity' => 'warning',
                'message' => $this->format($errors)
            );
        }

        if ($this->isAjax()) {
            $this->outputJson($result);
        }

        $this->redirect($result['redirect'], $result['message'], $result['severity']);
    }
public function addToProductCompare ( $ compare_action_model ) { $ errors = $ this -> error ( ) ; if ( empty ( $ errors ) ) { $ submitted = $ this -> getSubmitted ( ) ; $ result = $ compare_action_model -> add ( $ submitted [ 'product' ] , $ submitted ) ; } else { $ result = array ( 'redirect' => '' , 'severity' => 'warning' , 'message' => $ this -> format ( $ errors ) ) ; } if ( $ this -> isAjax ( ) ) { $ this -> outputJson ( $ result ) ; } $ this -> redirect ( $ result [ 'redirect' ] , $ result [ 'message' ] , $ result [ 'severity' ] ) ; }
Adds a submitted product to comparison
@param \gplcart\core\models\ProductCompareAction $compare_action_model
Adds a submitted product to comparison