Jump to content
  • 0
Alfredo Chitela

Botao finalizar compra com num carrinho de compra

Question

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        session_start();
       
        define("DIR", dirname(__FILE__));
        define("DS", DIRECTORY_SEPARATOR);

        include_once DIR . DS . 'App' . DS . 'Loader.php';
        $loader = new App\Loader();
        $loader->register();

        $pdo = new \PDO("mysql:host=localhost;dbname=shop", "root", "");
        $productRepository = new App\Model\Product\ProductRepositoryPDO($pdo);


        $page = isset($_GET['page']) ? $_GET['page'] : '';
        $action = isset($_GET['action']) ? $_GET['action'] : 'index';

        switch ($page) {
            case 'cart':
                $sessionCart = new App\Model\Shopping\CartSession();
                $cart = new App\Controller\Cart($productRepository, $sessionCart);
                call_user_func_array(array($cart, $action), array());
                break;

            default:
                $home = new App\Controller\Home($productRepository);
                call_user_func_array(array($home, $action), array());
        }
        ?>
    </body>
</HTML>

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.