Jump to content

shopping cart using array and code based with MVC


bornin90s

Recommended Posts

Hello guys i have an assignement where i have to create a store that use a session array to retrieve data input in a form,  and display it . But the shopping cart has to be built with MVC .And i'm a newbie in php so i need a little review of what i do so far.
 
So here is a little details of the assignement:
in the first place we have only a navbar that appears where there is two link ( both are dropdowns menu): Order and Product
When you click on ORDER the dropdown menu appears and you can read "Create" and "List" .
When you click on PRODUCT the dropdown menu appears and you can read "Create".
 
 
 
When you click on " Create" from the PRODUCT 's DROPDOWN you are redirect to a new page. On this new page there is a form where
you can input the reference, name, price and quantity of the product you want to add and there is a save button too.
When you click on save the informations are save in a array stored in data.php. Naturally before they get storedthe information input have to check if they are valid first.
 
And if you think the way i start the MVC you can if you wantplease give some tips or the way you would have done it 
This first one is what in my " routing.php
And the other  one for "userrooting.php


<?php

$module="ak";
if(isset($_GET['module'])){
    $module=$_GET['module'];
}
switch($module){
    case 'ak':
        /**
         *  Module Admin
         *  Controller
         *  Rooting
         */
        include_once SRC_CONTROLLER."commandeController.php";
         include_once SRC_CONTROLLER."produitController.php";
        include_once SRC_ROUTING."userrouting.php";
        break;


}
?>
[/code]


And this one for "userrooting.php
[code]
<?php
/*
 *Page  Affiché par defaut
 */
$lien=6;
if(isset($_GET['lien'])){
    $lien=$_GET['lien'];
}
switch($lien){
    case 1:
        $views=SRC_VIEWS."ak/ajoutCommande_layout.php";
        break;
    case 2:
        $views=SRC_VIEWS."ak/creerCommande_layout.php";


        break;
    case 3:
        $views=SRC_VIEWS."ak/editProduit_layout.php";
        break;
    case 4:
        $views=SRC_VIEWS."ak/listeCommande_layout.php";
        break;
    case 5:
        $views=SRC_VIEWS."ak/listeProduit_layout.php";
         break;
    case 6:
        $views=SRC_VIEWS."ak/newProduit_layout.php";
        break;
}
include_once($views);


?>

<?php
/*
 *Module AK Activate by default
 */
$module="ak";
if(isset($_GET['module'])){
    $module=$_GET['module'];
}
switch($module){
    case 'ak':
        /**
         *  Module AK
         *  Controller
         *  Rooting
         */
        include_once SRC_CONTROLLER."commandeController.php";
         include_once SRC_CONTROLLER."produitController.php";
        include_once SRC_ROUTING."userrouting.php";
        break;

}
?>



<?php

$lien=6;
if(isset($_GET['lien'])){
    $lien=$_GET['lien'];
}
switch($lien){
    case 1:
        $views=SRC_VIEWS."ak/ajoutCommande_layout.php";
        break;
    case 2:
        $views=SRC_VIEWS."ak/creerCommande_layout.php";

        break;
    case 3:
        $views=SRC_VIEWS."ak/editProduit_layout.php";
        break;
    case 4:
        $views=SRC_VIEWS."ak/listeCommande_layout.php";
        break;
    case 5:
        $views=SRC_VIEWS."ak/listeProduit_layout.php";
         break;
    case 6:
        $views=SRC_VIEWS."ak/newProduit_layout.php";
        break;
}
include_once($views);

?>

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.