THELIA Forum

Welcome to the THELIA support and discusssion forum

Announcement

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

Offline


voici l'erreurs

2/2PropelException: Propel\Runtime\ActiveQuery\ModelCriteria::delete is unable to delete.
in /home/zzuutt/core/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/ModelCriteria.php line 1331
at ModelCriteria->delete(object(ConnectionWrapper)) in /home/zzuutt/core/lib/Thelia/Model/Base/CartQuery.php line 1166
at CartQuery->delete(object(ConnectionWrapper)) in /home/zzuutt/core/lib/Thelia/Model/Base/Cart.php line 958
at Cart->delete() in /home/zzuutt/core/lib/Thelia/Model/Cart.php line 73
at Cart->duplicate('547091c10db284.42883113', null, object(Currency), object(ContainerAwareEventDispatcher)) in /home/zzuutt/core/lib/Thelia/Cart/CartTrait.php line 116
at DataAccessFunctions->duplicateCart(object(ContainerAwareEventDispatcher), object(Cart), object(Session)) in /home/zzuutt/core/lib/Thelia/Cart/CartTrait.php line 68
at DataAccessFunctions->getCart(object(ContainerAwareEventDispatcher), object(Request)) in /home/zzuutt/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/cache/dev/smarty/compile/d997ece41f3e3d3f8b5396734aac2e2978232637.file.index.html.php line 211
at content_547091c0f290b6_70104466(object(Smarty_Internal_Template)) in /home/zzuutt/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php line 180
at Smarty_Internal_TemplateBase->fetch('file:index.html') in /home/zzuutt/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php line 336
at SmartyParser->internalRenderer('file', 'index.html', array()) in /home/zzuutt/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php line 353
at SmartyParser->render('index.html') in /home/zzuutt/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/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/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
at EventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167
at ContainerAwareEventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 134
at HttpKernel->handleRaw(object(Request), '1') in /home/zzuutt/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 73
at HttpKernel->handle(object(Request), '1', true) in /home/zzuutt/core/lib/Thelia/Core/TheliaHttpKernel.php line 81
at TheliaHttpKernel->handle(object(Request), '1', true) in /home/zzuutt/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php line 197
at Kernel->handle(object(Request)) in /home/zzuutt/web/index_dev.php line 38
1/2PropelException: Unable to execute DELETE statement [DELETE FROM `cart` WHERE cart.ID=:p1]
in /home/zzuutt/core/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/Criteria.php line 2406
at Criteria->doDelete(object(ConnectionWrapper)) in /home/zzuutt/core/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/ModelCriteria.php line 1325
at ModelCriteria->delete(object(ConnectionWrapper)) in /home/zzuutt/core/lib/Thelia/Model/Base/CartQuery.php line 1166
at CartQuery->delete(object(ConnectionWrapper)) in /home/zzuutt/core/lib/Thelia/Model/Base/Cart.php line 958
at Cart->delete() in /home/zzuutt/core/lib/Thelia/Model/Cart.php line 73
at Cart->duplicate('547091c10db284.42883113', null, object(Currency), object(ContainerAwareEventDispatcher)) in /home/zzuutt/core/lib/Thelia/Cart/CartTrait.php line 116
at DataAccessFunctions->duplicateCart(object(ContainerAwareEventDispatcher), object(Cart), object(Session)) in /home/zzuutt/core/lib/Thelia/Cart/CartTrait.php line 68
at DataAccessFunctions->getCart(object(ContainerAwareEventDispatcher), object(Request)) in /home/zzuutt/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/cache/dev/smarty/compile/d997ece41f3e3d3f8b5396734aac2e2978232637.file.index.html.php line 211
at content_547091c0f290b6_70104466(object(Smarty_Internal_Template)) in /home/zzuutt/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php line 180
at Smarty_Internal_TemplateBase->fetch('file:index.html') in /home/zzuutt/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php line 336
at SmartyParser->internalRenderer('file', 'index.html', array()) in /home/zzuutt/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php line 353
at SmartyParser->render('index.html') in /home/zzuutt/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/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/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
at EventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167
at ContainerAwareEventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in /home/zzuutt/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 134
at HttpKernel->handleRaw(object(Request), '1') in /home/zzuutt/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 73
at HttpKernel->handle(object(Request), '1', true) in /home/zzuutt/core/lib/Thelia/Core/TheliaHttpKernel.php line 81
at TheliaHttpKernel->handle(object(Request), '1', true) in /home/zzuutt/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php line 197
at Kernel->handle(object(Request)) in /home/zzuutt/web/index_dev.php line 38

Il faut supprimer ou vider le cookie thelia_cart
Pour que cela remarche

Last edited by zzuutt (22-11-2014 16:48:13)

Offline


j'ai verifie dans la table
le token duplicate existe

at Cart->duplicate('547091c10db284.42883113', ...

le cookie thelia_cart a la valeur

thelia_cart=547091310ff316.77524654; expires=Sun, 22 Nov 2015 13:35:48 GMT; path=/; domain=zzuutt.fr; HttpOnly

est aussi dans la table

par contre

at content_547091c0f290b6_70104466(object(Smarty_Internal_Template))....

si c'est un token '547091c0f290b6.70104466' il n'est pas dans la table

Offline


j'ai fait differents tests

j'ai plusieurs onglets ouverts
je fais un achat complet, arrive a la page pay je fais un retour arriere,
je ferme l'onglet pas le navigateur, j'ouvre de nouveau le site dans un nouvel onglet
il s'affiche

je fais un achat complet, arrive a la page pay je fais un retour arriere,
je ferme le navigateur, j'ouvre de nouveau le navigateur et le site
page blanche avec l'erreur

Offline


ce serait la fonction clearCustomerUser()
qui me pose probleme

je fais un achat complet, arrive a la page pay je fais un retour arriere,
je me deconnecte
page blanche avec l'erreur

Last edited by zzuutt (24-11-2014 13:53:45)

Offline


je n'arrive pas a suivre cette fonction

    public function clearCustomerUser()
    {
        return $this->remove('thelia.customer_user');
    }

apres ?

Offline


Comment ça, après ?


OpenStudio Toulouse

Offline


je cherche ou est le bug
le remove('thelia.customer_user');

pourquoi ne veut il pas fonctionner ?
je ne vois pas comment suivre les etapes

Offline


Cette méthode ne fait que retirer l'objet utilisateur front du contexte de sécurité.


OpenStudio Toulouse

Offline


si j'ai bien suivie  (voir message d'erreur #51)
c'est cette methode qui me pose pb

que faire ? comme test ?.....

Offline


Quand le client passe de la page order.delevery à  order . pay
Puis se deconnecte il y a le bug
Cela n'arrive pas à le supprimer
Le contexte de sécurité change???

Offline


Non, cette methode n'a rien à voir avec #51. Le problème c'est sans doute le delete d'un cart avec un id 0 ou obsolete. Il faudrait faire  un contrôle de l'id dans la méthode duplicate.


OpenStudio Toulouse

Offline


la ligne

Cart->duplicate('547091c10db284.42883113', null, object(Currency), object(ContainerAwareEventDispatcher)) in /home/zzuutt/core/lib/Thelia/Cart/CartTrait.php line 116

se fait bien je retrouve dans la table le token
c'est le delete qui bloque

Offline


ce que je constate lorsque je passe de la la page invoice a pay
la valeur du cart dans la table ne change pas
les ids de  address_delivery_id  et     address_invoice_id reste null

 id 	token     customer_id 	address_delivery_id 	address_invoice_id 	currency_id 	discount    ....
403 	5474357972bc13.93212469 	18 	NULL	NULL	1 	....

Offline


j'ai cette erreur dans les log

20: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT country.ID, country.AREA_ID, country.ISOCODE, country.ISOALPHA2, country.ISOALPHA3, country.BY_DEFAULT, country.SHOP_COUNTRY, country.CREATED_AT, country.UPDATED_AT FROM `country` WHERE country.BY_DEFAULT=1 LIMIT 1
21: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT `ID`, `TOKEN`, `CUSTOMER_ID`, `ADDRESS_DELIVERY_ID`, `ADDRESS_INVOICE_ID`, `CURRENCY_ID`, `DISCOUNT`, `CREATED_AT`, `UPDATED_AT` FROM `cart` WHERE `ID` = 403
22: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT cart.ID, cart.TOKEN, cart.CUSTOMER_ID, cart.ADDRESS_DELIVERY_ID, cart.ADDRESS_INVOICE_ID, cart.CURRENCY_ID, cart.DISCOUNT, cart.CREATED_AT, cart.UPDATED_AT FROM `cart` WHERE cart.TOKEN='5474357972bc13.93212469' LIMIT 1
23: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT config.ID, config.NAME, config.VALUE, config.SECURED, config.HIDDEN, config.CREATED_AT, config.UPDATED_AT FROM `config` WHERE config.NAME='cart.session_only' LIMIT 1
24: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT cart_item.ID, cart_item.CART_ID, cart_item.PRODUCT_ID, cart_item.QUANTITY, cart_item.PRODUCT_SALE_ELEMENTS_ID, cart_item.PRICE, cart_item.PROMO_PRICE, cart_item.PRICE_END_OF_LIFE, cart_item.PROMO, cart_item.CREATED_AT, cart_item.UPDATED_AT FROM `cart_item` WHERE cart_item.CART_ID=403
25: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: INSERT INTO `cart` (`ID`, `TOKEN`, `CURRENCY_ID`, `CREATED_AT`, `UPDATED_AT`) VALUES (NULL, '54743762e01634.22645918', 1, '2014-11-25 09:01:38', '2014-11-25 09:01:38')
26: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `BRAND_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product` WHERE `ID` = 3
27: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT product_i18n.ID, product_i18n.LOCALE, product_i18n.TITLE, product_i18n.DESCRIPTION, product_i18n.CHAPO, product_i18n.POSTSCRIPTUM, product_i18n.META_TITLE, product_i18n.META_DESCRIPTION, product_i18n.META_KEYWORDS FROM `product_i18n` WHERE product_i18n.ID=3 AND product_i18n.LOCALE IS NULL  LIMIT 1
28: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT config.ID, config.NAME, config.VALUE, config.SECURED, config.HIDDEN, config.CREATED_AT, config.UPDATED_AT FROM `config` WHERE config.NAME='default_lang_without_translation' LIMIT 1
29: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT lang.ID, lang.TITLE, lang.CODE, lang.LOCALE, lang.URL, lang.DATE_FORMAT, lang.TIME_FORMAT, lang.DATETIME_FORMAT, lang.DECIMAL_SEPARATOR, lang.THOUSANDS_SEPARATOR, lang.DECIMALS, lang.BY_DEFAULT, lang.POSITION, lang.CREATED_AT, lang.UPDATED_AT FROM `lang` WHERE lang.BY_DEFAULT=1 LIMIT 1
30: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT `ID`, `PRODUCT_ID`, `REF`, `QUANTITY`, `PROMO`, `NEWNESS`, `WEIGHT`, `IS_DEFAULT`, `EAN_CODE`, `CREATED_AT`, `UPDATED_AT` FROM `product_sale_elements` WHERE `ID` = 6
31: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT currency.ID, currency.CODE, currency.SYMBOL, currency.RATE, currency.POSITION, currency.BY_DEFAULT, currency.CREATED_AT, currency.UPDATED_AT FROM `currency` WHERE currency.BY_DEFAULT=1 LIMIT 1
32: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: SELECT product_price.PRODUCT_SALE_ELEMENTS_ID, product_price.CURRENCY_ID, product_price.PRICE, product_price.PROMO_PRICE, product_price.FROM_DEFAULT_CURRENCY, product_price.CREATED_AT, product_price.UPDATED_AT FROM `product_price` WHERE product_price.PRODUCT_SALE_ELEMENTS_ID=6 AND product_price.CURRENCY_ID=1 LIMIT 1
33: INFO [ConnectionWrapper.php:log()] {653} 2014-11-25 9:01:38: INSERT INTO `cart_item` (`ID`, `CART_ID`, `PRODUCT_ID`, `QUANTITY`, `PRODUCT_SALE_ELEMENTS_ID`, `PRICE`, `PROMO_PRICE`, `PROMO`, `CREATED_AT`, `UPDATED_AT`) VALUES (NULL, 405, 3, 1, 6, 58.99669999999999703277353546582162380218505859375, 38.16329999999999955662133288569748401641845703125, 1, '2014-11-25 09:01:38', '2014-11-25 09:01:38')

puis

34: ERROR [Propel.php:log()] {284} 2014-11-25 9:01:39: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`zzuutt`.`order`, CONSTRAINT `fk_order_cart_id` FOREIGN KEY (`cart_id`) REFERENCES `cart` (`id`))

ou se trouve cette requete pour que je fasse un echo des variables ?

je vois que cette relation a ete rajoute dans la mise a jour 2.0.4.sql

# =========================
# Add relation between order and cart
# =========================
ALTER TABLE `order`
  ADD CONSTRAINT `fk_order_cart_id`
    FOREIGN KEY (`cart_id`) REFERENCES `cart`(`id`)
;

solution ? je tourne sous MySQL : delete qqch = Null  ??

Last edited by zzuutt (25-11-2014 10:16:06)

Offline


j'ai supprime la CONSTRAINT

ALTER TABLE `order` DROP FOREIGN KEY `fk_order_cart_id` 

tout est redevenu en ordre

un patch est en cours......

Offline


Il ne faut pas faire ça, tu brises la cohérence de la base.


OpenStudio Toulouse

Offline


ok mais faire quoi ??

Offline


Revoir la duplication du cart.


OpenStudio Toulouse

Offline


j'avoue que c'est a la limite de mes competences
je suis a une anne lumiere de ton savoir,  je ne t'envoie pas de fleurs c'est la realite!

ayant en plus la pression (j'aurais du mettre en ligne Lundi dernier)

  • manu
  • faï tot petar miladiu

Offline


En attendant la version 2.0.5 voilà un patch qui règle le soucis : https://github.com/thelia/thelia/pull/926


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

Offline


Essaie de commenter la ligne 73 de Model\Cart.php :

// $this->delete();

La table cart prendra sans doute un peu d'embonpoint au fil du temps, mais c'est pas grave.


OpenStudio Toulouse

Offline


vu le nombre de client qu'il va y avoir............ et que surtout le patch va arriver tres tres vite wink
j'aurais tendance a garder la constraint
et desactiver le delete

  • manu
  • faï tot petar miladiu

Offline