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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.