THELIA Forum

Welcome to the THELIA support and discusssion forum

Announcement

Rejoignez la communauté sur le Discord Thelia : https://discord.gg/YgwpYEE3y3

Offline


Bonjour,

j'ai constamment cette erreur
si je ferme le navigateur alors que je suis sur les pages order

Whoops, looks like something went wrong.
2/2 PropelException: Propel\Runtime\ActiveQuery\ModelCriteria::delete is unable to delete.

    in /home/zzuutt/www/shop/core/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/ModelCriteria.php line 1331
    at ModelCriteria->delete(object(ConnectionWrapper)) in /home/zzuutt/www/shop/core/lib/Thelia/Model/Base/CartQuery.php line 1166
    at CartQuery->delete(object(ConnectionWrapper)) in /home/zzuutt/www/shop/core/lib/Thelia/Model/Base/Cart.php line 958
    at Cart->delete() in /home/zzuutt/www/shop/core/lib/Thelia/Model/Cart.php line 73
    at Cart->duplicate('543f81190f9479.07317482', null, object(Currency), object(ContainerAwareEventDispatcher)) in /home/zzuutt/www/shop/core/lib/Thelia/Cart/CartTrait.php line 116
    at DataAccessFunctions->duplicateCart(object(ContainerAwareEventDispatcher), object(Cart), object(Session)) in /home/zzuutt/www/shop/core/lib/Thelia/Cart/CartTrait.php line 68
    at DataAccessFunctions->getCart(object(ContainerAwareEventDispatcher), object(Request)) in /home/zzuutt/www/shop/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php line 192
    at DataAccessFunctions->cartDataAccess(array('attr' => 'count_item'), object(Smarty_Internal_Template)) in /home/zzuutt/www/shop/cache/dev/smarty/compile/7cdb5325aaa09ffe20fa1c3b03d44239741b7482.file.index.html.php line 208
    at content_543f8118ddf5f4_72805962(object(Smarty_Internal_Template)) in /home/zzuutt/www/shop/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php line 180
    at Smarty_Internal_TemplateBase->fetch('file:index.html') in /home/zzuutt/www/shop/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php line 336
    at SmartyParser->internalRenderer('file', 'index.html', array()) in /home/zzuutt/www/shop/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php line 353
    at SmartyParser->render('index.html') in /home/zzuutt/www/shop/core/lib/Thelia/Core/EventListener/ViewListener.php line 73
    at ViewListener->onKernelView(object(GetResponseForControllerResultEvent))
    at call_user_func(array(object(ViewListener), 'onKernelView'), object(GetResponseForControllerResultEvent)) in /home/zzuutt/www/shop/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 164
    at EventDispatcher->doDispatch(array(array(object(ViewListener), 'beforeKernelView'), array(object(ViewListener), 'onKernelView')), 'kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/www/shop/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
    at EventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/www/shop/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167
    at ContainerAwareEventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/www/shop/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 134
    at HttpKernel->handleRaw(object(Request), '1') in /home/zzuutt/www/shop/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 73
    at HttpKernel->handle(object(Request), '1', true) in /home/zzuutt/www/shop/core/lib/Thelia/Core/TheliaHttpKernel.php line 81
    at TheliaHttpKernel->handle(object(Request), '1', true) in /home/zzuutt/www/shop/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php line 197
    at Kernel->handle(object(Request)) in /home/zzuutt/www/shop/web/index_dev.php line 38

1/2 PropelException: Unable to execute DELETE statement [DELETE FROM `cart` WHERE cart.ID=:p1]

    in /home/zzuutt/www/shop/core/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/Criteria.php line 2406
    at Criteria->doDelete(object(ConnectionWrapper)) in /home/zzuutt/www/shop/core/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/ModelCriteria.php line 1325
    at ModelCriteria->delete(object(ConnectionWrapper)) in /home/zzuutt/www/shop/core/lib/Thelia/Model/Base/CartQuery.php line 1166
    at CartQuery->delete(object(ConnectionWrapper)) in /home/zzuutt/www/shop/core/lib/Thelia/Model/Base/Cart.php line 958
    at Cart->delete() in /home/zzuutt/www/shop/core/lib/Thelia/Model/Cart.php line 73
    at Cart->duplicate('543f81190f9479.07317482', null, object(Currency), object(ContainerAwareEventDispatcher)) in /home/zzuutt/www/shop/core/lib/Thelia/Cart/CartTrait.php line 116
    at DataAccessFunctions->duplicateCart(object(ContainerAwareEventDispatcher), object(Cart), object(Session)) in /home/zzuutt/www/shop/core/lib/Thelia/Cart/CartTrait.php line 68
    at DataAccessFunctions->getCart(object(ContainerAwareEventDispatcher), object(Request)) in /home/zzuutt/www/shop/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php line 192
    at DataAccessFunctions->cartDataAccess(array('attr' => 'count_item'), object(Smarty_Internal_Template)) in /home/zzuutt/www/shop/cache/dev/smarty/compile/7cdb5325aaa09ffe20fa1c3b03d44239741b7482.file.index.html.php line 208
    at content_543f8118ddf5f4_72805962(object(Smarty_Internal_Template)) in /home/zzuutt/www/shop/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php line 180
    at Smarty_Internal_TemplateBase->fetch('file:index.html') in /home/zzuutt/www/shop/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php line 336
    at SmartyParser->internalRenderer('file', 'index.html', array()) in /home/zzuutt/www/shop/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php line 353
    at SmartyParser->render('index.html') in /home/zzuutt/www/shop/core/lib/Thelia/Core/EventListener/ViewListener.php line 73
    at ViewListener->onKernelView(object(GetResponseForControllerResultEvent))
    at call_user_func(array(object(ViewListener), 'onKernelView'), object(GetResponseForControllerResultEvent)) in /home/zzuutt/www/shop/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 164
    at EventDispatcher->doDispatch(array(array(object(ViewListener), 'beforeKernelView'), array(object(ViewListener), 'onKernelView')), 'kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/www/shop/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
    at EventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/www/shop/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167
    at ContainerAwareEventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/www/shop/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 134
    at HttpKernel->handleRaw(object(Request), '1') in /home/zzuutt/www/shop/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 73
    at HttpKernel->handle(object(Request), '1', true) in /home/zzuutt/www/shop/core/lib/Thelia/Core/TheliaHttpKernel.php line 81
    at TheliaHttpKernel->handle(object(Request), '1', true) in /home/zzuutt/www/shop/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php line 197
    at Kernel->handle(object(Request)) in /home/zzuutt/www/shop/web/index_dev.php line 38

il faut que je supprime le cookie Thelia_cart
pour que le site refonctionne

une idee  du pourquoi du comment ?

Offline


As-tu réalisé un module qui manipule le Cart ?


OpenStudio Toulouse

Offline


J'ai le même soucis sur mon site en dev...
L'erreur est apparu plusieurs jours/semaines après alors que je bosse dessus depuis un moment.
Aucun module rajouté ne manipule le Cart..

Offline


non je n'ai rien rajoute
sur le serveur de prod, je n'ai pas ce soucis
j'espere que quand  je vais transferer mes pages  cela ne va pas infecter le serveur de prod

je continue mon investigation

les 2 serveurs sont en v2.0.4

Offline


Ce bug intervient lorsque le client se connecte et garde la page ouverte
lorsque la session est cloturee par le serveur
si le client rafraichit la page il obtient une page blanche (avec cette erreur)
pour resoudre le pb il faut supprimer le cookie thelia_cart
dur dur de dire au client de vider ses cookies

y aurait il une autre solution ?

Offline


J'ai constaté le même problème, si l'on a un panier, valide la livraison:
- On s'arrete là
- Ou si on a un retour négatif du paiement

Le lendemain, erreur...

Pour le moment, j'utilise la même solution...
mais difficile à expliquer au client qu'il n'avait qu'à aller au bout du paiement. :-)

Offline


je constae l'erreur aussi
lorsque le client laisse la page ouverte exemple '/account' avec quelque chose dans le panier
la session expire
le client revient, clique n'importe ou
page blanche

seul moyen d'afficher le site supprimer ou vider le cookie thelia_cart

on ne peut pas demander au client de faire cette manip

une solution ?

cote admin il n'y a pas ce probleme

Last edited by zzuutt (20-11-2014 13:28:02)

Offline


Effectivement, le cookie de panier peut expirer avant le cookie de session. On a corrigé le problème en 2.1...


OpenStudio Toulouse

Offline


quelle est la correction apportee ou chercher sur gihub ?  pour  l'appliquer sur la 2.0.4

Merci

Last edited by zzuutt (20-11-2014 14:15:28)

Offline


La correction n'est pas triviale. Voilà la PR associée: https://github.com/thelia/thelia/pull/829


OpenStudio Toulouse

Offline


merci bcp Roadster31

Offline


je peux appliquer le fix directement sur 2.0.4
ou certaines fonctions ne sont valables que sur 2.1

Offline


Je pense que tu dois pouvoir l'appliquer à la 2.0.4, mais à la main, en appliquant les modifs de la PR aux fichier 2.0.4


OpenStudio Toulouse

Offline


je viens d'appliquer les modifs (pas toutes) certaines concernent le hook ou le produit virtuel
je vais tester wink

Last edited by zzuutt (20-11-2014 17:43:18)

Offline


j'ai cette erreur

ErrorException: Catchable Fatal Error: Argument 2 passed to Thelia\Core\Template\Smarty\Plugins\Security::__construct() must implement interface Symfony\Component\EventDispatcher\EventDispatcherInterface, instance of Thelia\Core\Security\SecurityContext given, called in /home/zzuutt/www/shop/cache/dev/CoreDevDebugProjectContainer.php on line 1168 and defined in /home/zzuutt/www/shop/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php line 31

Last edited by zzuutt (20-11-2014 15:45:16)

Offline


Oui, c'est bien là la difficulté: appliquer les modifs de la 2.1 en les adaptant à Thelia 2.0.4, sachant que les API ont un peu évolué entre 2.0.4 et 2.1.

Que la force soit avec toi.


OpenStudio Toulouse

Offline


Y a t il une solution d'adaptation pour la 2.0.4
je ne me vois pas mettre en ligne avec ce bug

Offline


Essaie de créer la variable cart.session_only, et de la mettre à 1. De cette manière, le cart aura la même durée de vie que la session, et ça résoudra peut-être le problème.


OpenStudio Toulouse

Offline


merci je teste

Avec la valeur cart.session_only = 1
le cookie thelia_cart n'est pas cree

lorsque le client met un produit dans le panier
puis se connecte
le panier se vide

une autre solution ?

Last edited by zzuutt (21-11-2014 08:44:27)

Offline

Offline


je cherche une solution intermediaire (en attendant la 2.1)
si au lieu que getCart() return null
on teste que le cookie existe et on l'efface

est ce logique??

Offline


Tu peux faire les modifs que tu veux en attendant la mise à jour de la 2.1, comme par exemple créer un Cart s'il est null...


OpenStudio Toulouse

  • manu
  • faï tot petar miladiu

Offline


Nous avons des sites en prod qui tournent en 2.0.* et nous ne rencontrons pas ce soucis.

Tu as changé une configuration concernant les sessions sur ton serveur ?


http://doc.thelia.net/
http://thelia.net/modules
http://raynaud.io
PGP public Key : 0xC6E546A6

Offline


non rien du tout

puis je avoir une adresse de site pour tester
car je me tire les cheveux et en plus j'en ai plus bcp

Last edited by zzuutt (21-11-2014 10:09:33)

Offline


quand je regarde la function getCar()
elle me parait coherente

    public function getCart(EventDispatcherInterface $dispatcher, Request $request)
    {
        $session = $request->getSession();

        if (null !== $cart = $session->getCart()) {
            return $cart;
        }

        if ($request->cookies->has("thelia_cart")) {
            //le cookie de panier existe, on le récupère
            $token = $request->cookies->get("thelia_cart");

            $cart = CartQuery::create()->findOneByToken($token);

            if ($cart) {
                //le panier existe en base
                $customer = $session->getCustomerUser();

                if ($customer) {
                    if ($cart->getCustomerId() != $customer->getId()) {
                        //le customer du panier n'est pas le mm que celui connecté, il faut cloner le panier sans le customer_id
                        $cart = $this->duplicateCart($dispatcher, $cart, $session, $customer);
                    }
                } else {
                    if ($cart->getCustomerId() != null) {
                        //il faut dupliquer le panier sans le customer_id
                        $cart = $this->duplicateCart($dispatcher, $cart, $session);
                    }
                }

            } else {
                $cart = $this->createCart($session);
            }
        } else {
            //le cookie de panier n'existe pas, il va falloir le créer et faire un enregistrement en base.
            $cart = $this->createCart($session);
        }
        $session->setCart($cart->getId());

        return $cart;
    }