Active form yii2

I was trying to convert a functional application made with yii 1.4 yii2 but generates me the following error, not found 404

the action of the controller that appeal by form has remained the same




public function actionUpOrder()

    {


    //add product to session or create new one

    if(isset($_POST["type"]) && $_POST["type"]=='add' && $_POST["product_qty"]>0)

    {

        foreach($_POST as $key => $value){ //add all post vars to new_product array

            $new_product[$key] = filter_var($value, FILTER_SANITIZE_STRING);

        }

        //remove unecessary vars

        unset($new_product['type']);

        unset($new_product['return_url']); 

        

        


       

   $result= Yii::app()->db->createCommand('SELECT product_name, price FROM products WHERE product_code = :category')->bindValue('category',$_POST["product_code"])->queryAll();


    $rs0=array();

    foreach ($result as $item0) {

        

        

        //fetch product name, price from db and add to new_product array

        $new_product["product_name"] = $rs0[]=$item0['product_name']; 

        $new_product["product_price"] = $rs0[]=$item0['price'];

      


        

        if(isset($_SESSION["cart_products"])){  //if session var already exist

            if(isset($_SESSION["cart_products"][$new_product['product_code']])) //check item exist in products array

            {

                unset($_SESSION["cart_products"][$new_product['product_code']]); //unset old array item

            }           

        }

        $_SESSION["cart_products"][$new_product['product_code']] = $new_product; //update or create product session with new item  

    } 

}




//update or remove items 

if(isset($_POST["product_qty"]) || isset($_POST["remove_code"]))

{

    //update item quantity in product session

    if(isset($_POST["product_qty"]) && is_array($_POST["product_qty"])){

        foreach($_POST["product_qty"] as $key => $value){

            if(is_numeric($value)){

                $_SESSION["cart_products"][$key]["product_qty"] = $value;

            }

        }

    }

    //remove an item from product session

    if(isset($_POST["remove_code"]) && is_array($_POST["remove_code"])){

        foreach($_POST["remove_code"] as $key){

            unset($_SESSION["cart_products"][$key]);

        }   

    }

}







//back to return url

$return_url = (isset($_POST["return_url"]))?urldecode($_POST["return_url"]):''; //return url

header('Location:'.$return_url);

//header('Location:'.$return_url);




    }

]

in the view new code for yii2 :




<?php


use yii\helpers\Html;

use app\models\Products;

use yii\helpers\Url;

use yii\widgets\ActiveForm;

use yii\helpers\ArrayHelper;


?>

 <!-- header a -->

  <div id="tm-header-a" class="tm-block-header-a uk-block uk-block-default tm-block-fullwidth tm-grid-collapse ">

    <div class="uk-container uk-container-center">

      <section class="tm-header-a uk-grid" data-uk-grid-match="{target:'> div > .uk-panel'}">


        <div class="uk-width-1-1">

          <div class="uk-panel uk-text-center uk-contrast tm-overlay-secondary tm-header-height">

            <div class="tm-background-cover uk-cover-background uk-flex uk-flex-center uk-flex-middle" style="background-position: 50% 0px; background-image:url(images/background/bg-image-4.jpg)" data-uk-parallax="{bg: '-200'}">

              <div class="uk-position-relative uk-container">


                <div data-uk-parallax="{opacity: '1,0', y: '-50'}">


                  <div data-uk-scrollspy="{cls:'uk-animation-slide-top', delay:300}">

                    <h1 class="uk-module-title-alt uk-margin-top">Our Menu</h1>

                  </div>


                  <div data-uk-scrollspy="{cls:'uk-animation-slide-top', delay:800}">

                    <h5 class="uk-sub-title-small">The true taste of good design</h5>

                  </div>


                </div>

              </div>

            </div>

          </div>

        </div>

      </section>

    </div>

  </div>


<!----- CART ---->


<!-- View Cart Box Start -->

<?php


if(isset($_SESSION["cart_products"]) && count($_SESSION["cart_products"])>0)

{   ?>

    <div style="display:none">

        <?php


    echo '<div class="cart-view-table-front" id="view-cart">';

    echo '<h3>Il Menu che stai Ordinando</h3>';


     ActiveForm::begin([

    'id' => 'product-form',

    'action' => 'uporder']),

    'enableAjaxValidation' => true,

       

    ]); 

    

    echo '<table width="100%"  cellpadding="6" cellspacing="0">';

    echo '<tbody>';


    $total =0;

    $b = 0;




    foreach ($_SESSION["cart_products"] as $cart_itm)

    {

        $product_name = $cart_itm["product_name"];

        $product_qty = $cart_itm["product_qty"];

        $product_price = $cart_itm["product_price"];

        $product_code = $cart_itm["product_code"];

    $io = 'ciao';

        echo '<tr>';

        echo '<td>Qty <input type="text" size="2" maxlength="2" name="product_qty['.$product_code.']" value="'.$product_qty.'" /></td>';

        echo '<td>'.$product_name.'</td>';

        echo '<td><input type="checkbox" name="remove_code[]" value="'.$product_code.'" /> Remove</td>';

    echo '</tr>';

      $subtotal = ($product_price * $product_qty);

    $total = ($total + $subtotal);

   

    }

    echo '<td colspan="4">';?>

    <button type="submit">Aggiorna</button><?php  echo CHtml::link("Ordina",array('products/cart'),array('class'=>'button')) ?>

    <?php 

    echo '</td>';

    echo '</tbody>';

    echo '</table>';

    

    $current_url = urlencode($url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);

    echo '<input type="hidden" name="return_url" value="'.$current_url.'" />';

    ActiveForm::end();


    echo '</div>';

    //echo '</div>';

}

?>

<!-- View Cart Box End -->

    <button style="display:none" type="submit">Aggiorna</button><?php  //echo CHtml::link("Ordina",array('products/cart'),array('class'=>'button')) ?>

</div>

<!-- Products List Start -->

     <!-- top-a -->

  <div id="aperitivi" class="tm-block-top-a uk-block uk-block-default blank-a">

    <div class="uk-container uk-container-center">

      <section class="tm-top-a uk-grid" data-uk-grid-match="{target:'> div > .uk-panel'}" data-uk-grid-margin>


        <div class="uk-width-1-1">

          <div class="uk-panel">


            <div class="uk-text-center">

              <!--<div data-uk-scrollspy="{cls:'uk-animation-slide-top', delay:100}">

                <img class="" src="images/demo/menu/food-1.png" alt="appetizers" width="300" height="220">

              </div>-->

              <br>

              <h3 class="uk-h2 uk-module-title-alt">Antipasti</h3>

              <h5 class="uk-margin-top-remove uk-margin-large-bottom">served with bread and butter</h5>

            </div>


            <div class="uk-grid uk-grid-width-medium-1-2 uk-grid-width-large-1-3" data-uk-grid-margin>

           

            <?php foreach (Products::findAll(['ordinamento' => 1,'attivo'=>'si']) as $prodotto) {?>

     

   <?php ActiveForm::begin([

    'id' => 'product-form',

    'action' => 'uporder',

    'enableAjaxValidation' => false,

        

    ]); ?>

              <div class="uk-panel uk-panel-space">

                <div class="tm-menu-item tm-menu-compound">

                  <h3 class="tm-menu-name"><?php echo $prodotto->product_name ?></h3>

              

                  <span class="tm-menu-dots"></span>

                  <span class="tm-menu-price"><?php echo $prodotto->price ?></span>

                  <span style="display:none"class="tm-menu-desc"><?php echo $prodotto->product_desc ?></span>

                </div>

    <?php

    echo Html::dropDownList('product_qty', null,['1'=>'1','2'=>'2'],['id'=>$prodotto->product_code,'class'=>'drop']) ?>

    <input type="hidden" name="product_code" value="<?php echo $prodotto->product_code ?>" />

    <input type="hidden" name="type" value="add" />

    <button type="submit" class="add_to_cart uk-button-color uk-button">Aggiungi</button>

    <input type="hidden" name="return_url" value="<?php 

    $current_url = urlencode($url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);

    echo $current_url; ?>" />

               

              </div>


              <?php ActiveForm::end(); ?>


              <?php } ?>

            </div>

          </div>

        </div>

      </section>

    </div>

  </div>



when click button aggiungi, the error is:

Page not found.

The above error occurred while the Web server was processing your request.

Please contact us if you think this is a server error. Thank you.

I tried plugging in action uporder echo "test"; but the error is the same

why?

http://www.yiiframework.com/doc-2.0/guide-structure-controllers.html#controller-ids




<?php ActiveForm::begin([

    'id' => 'product-form',

    // 'action' => 'uporder',

    'action' => 'up-order',

    'enableAjaxValidation' => false,