symonup Posted September 3, 2019 Share Posted September 3, 2019 Witam, chciałbym stworzyc prosta funkcje dodajaca produkt o okreslonym atrybucie do koszyka, jednak w trakcie wykonywania ponizszego kodu, otrzymuje blad krytyczny znajdujacy sie ponizej, jednak mimo bledu, odswiezajac w innej karcie koszyk, produkt zostal dodany prawidlowy, ilosc, produkt i atrybut. prosze o pomoc, w czym tkwi problem? require_once('config/config.inc.php'); require_once('classes/Cart.php'); function addProductToCart($id, $productAttributeID) { $context = Context::getContext(); $id_cart = $context->cookie->__get('id_cart'); $cart = new Cart($id_cart); $cart->updateQty(1, (int)$id, (int)$productAttributeID); $cart->update(); Tools::redirect('order'); } addProductToCart(41, 518); Quote Fatal error: Uncaught PrestaShopException: Błąd krytyczny in /home/symon/php/39/pet-food-shop/classes/Tools.php:1109 Stack trace: #0 /home/symon/php/39/pet-food-shop/classes/Product.php(3153): ToolsCore::displayError() #1 /home/symon/php/39/pet-food-shop/classes/Product.php(4741): ProductCore::getPriceStatic(41, false, 518, 6, NULL, false, true, 1) #2 /home/symon/php/39/pet-food-shop/classes/Cart.php(811): ProductCore::getProductProperties(1, Array) #3 /home/symon/php/39/pet-food-shop/classes/Cart.php(1456): CartCore->getProducts(true) #4 /home/symon/php/39/pet-food-shop/addProductToCart.php(17): CartCore->updateQty(1, 41, 518) #5 /home/symon/php/39/pet-food-shop/addProductToCart.php(34): addProductToCart(41, 518) #6 {main} thrown in /home/symon/php/39/pet-food-shop/classes/Tools.php on line 1109 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now