Jump to content
symonup

Fatal erro przy dodawaniu produktu do koszyka Prestashop 1.7

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

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

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More