Jump to content

Edit History

beaudenheijer

beaudenheijer

In the newer version of prestashop i encountered a weird bug when you add the cart tot the back-end. the debug mode screenshot is below. and the code is below the screenshot.

image.thumb.png.46dc12d8d15442248c47868137d34c67.png

require 'config/config.inc.php';
require 'init.php';

session_start();

try
{
        $id = isset($_SESSION['Cart_ID']) ? (int)$_SESSION['Cart_ID'] : null;

        $cart = new Cart($id, null);

        $cart->save(); // problem is just in this line

        $_SESSION['Cart_ID'] = $cart->id;

        if($_SERVER['REQUEST_METHOD'] === "POST")
        {
            if(isset($_POST['add_to_cart'], $_POST['id_product']) || !empty($_POST['id_product']))
            {
                $cart->updateQty(1, $_POST['id_product']);
                $cart->update();
                header("Location: index.php");
            }
        }
 }
 catch (PrestaShopException $e)
 {
 	echo $e;
 }

 

beaudenheijer

beaudenheijer

In the newer version of prestashop i encountered a weird bug when you add the cart tot the back-end. the debug mode screenshot is below. and the code is below the screenshot.

image.thumb.png.46dc12d8d15442248c47868137d34c67.png

require 'config/config.inc.php';
require 'init.php';

session_start();

try
{
        $id = isset($_SESSION['Cart_ID']) ? (int)$_SESSION['Cart_ID'] : null;

        $cart = new Cart($id, null);

        $cart->save();

        $_SESSION['Cart_ID'] = $cart->id;

        if($_SERVER['REQUEST_METHOD'] === "POST")
        {
            if(isset($_POST['add_to_cart'], $_POST['id_product']) || !empty($_POST['id_product']))
            {
                $cart->updateQty(1, $_POST['id_product']);
                $cart->update();
                header("Location: index.php");
            }
        }
 }
 catch (PrestaShopException $e)
 {
 	echo $e;
 }

 

×
×
  • Create New...