[Skip to main content](#vessel-content)

#   retirer un $row-&gt;product\_id du cart

##

- **[erickb](/forum/user/4069-erickb "View erickb's Profile")**
- [![erickb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4069-erickb "View erickb's Profile") Topic Author
- [ Away](/forum/user/4069-erickb)

Less More

- Posts: 2704
- Thank you received: 74
-
-

14 years 1 week ago -  14 years 1 week ago [\#77054](#77054) by [erickb](/forum/user/4069-erickb "View erickb's Profile")  *[retirer un $row-&gt;product\_id du cart](/forum/5-support-en-francais-french-support-/75877-retirer-un-row-product-id-du-cart#77054 "Sous certaines conditions je voudrais automatiquement retirer certains produits du cart  comment faire ça dans a boucle du cart.php ?  par exemple :  mais ça ne marche pas  ou bien quelle autre méthode hors de la boucle pour retirer un $row-&gt;product&#95;id du cart définitivement (pas juste l'affichage) ?  je voudrais eviter un DELETE FROM ##&#95;&#95;cart&#95;product WHERE cart&#95;product&#95;id = $row-&gt;cart&#95;product&#95;id ou $i  merci")* was created by *[erickb](/forum/user/4069-erickb "View erickb's Profile")*

Sous certaines conditions je voudrais automatiquement retirer certains produits du cart

comment faire ça dans a boucle du cart.php ?

par exemple :
Code:

foreach($this-&gt;rows as $i =&gt; $row){ if( $row-&gt;product_id== 300 &amp;&amp; $macondition == 0){ unset($this-&gt;rows[$i]); } }

mais ça ne marche pas

ou bien quelle autre méthode hors de la boucle pour retirer un $row-&gt;product_id du cart définitivement (pas juste l'affichage) ?

je voudrais eviter un DELETE FROM ##__cart_product WHERE cart_product_id = $row-&gt;cart_product_id ou $i

merci

Last edit: 14 years 1 week ago by [erickb](/forum/user/4069-erickb "View erickb's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU4NzctcmV0aXJlci11bi1yb3ctcHJvZHVjdC1pZC1kdS1jYXJ0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

14 years 1 week ago [\#77116](#77116) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[retirer un $row-&gt;product\_id du cart](/forum/5-support-en-francais-french-support-/75877-retirer-un-row-product-id-du-cart#77116 "Sous certaines conditions je voudrais automatiquement retirer certains produits du cart  comment faire ça dans a boucle du cart.php ?  par exemple :  mais ça ne marche pas  ou bien quelle autre méthode hors de la boucle pour retirer un $row-&gt;product&#95;id du cart définitivement (pas juste l'affichage) ?  je voudrais eviter un DELETE FROM ##&#95;&#95;cart&#95;product WHERE cart&#95;product&#95;id = $row-&gt;cart&#95;product&#95;id ou $i  merci")*

Bonsoir,

Je pencherais pour l'utilisation du trigger onBeforeCartUpdate.
Ce trigger a pour paramètres : &amp;$cartClass, &amp;$cart, $product_id, $quantity, $add, $type, $resetCartWhenUpdate, $force, &amp;$do

Il est ainsi possible de gérer le contenu du cart avant sa sauvegarde en base de données.

Cordialement,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU4NzctcmV0aXJlci11bi1yb3ctcHJvZHVjdC1pZC1kdS1jYXJ0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[erickb](/forum/user/4069-erickb "View erickb's Profile")**
- [![erickb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4069-erickb "View erickb's Profile") Topic Author
- [ Away](/forum/user/4069-erickb)

Less More

- Posts: 2704
- Thank you received: 74
-
-

14 years 1 week ago -  14 years 1 week ago [\#77117](#77117) by [erickb](/forum/user/4069-erickb "View erickb's Profile")  Replied by *[erickb](/forum/user/4069-erickb "View erickb's Profile")* on topic *[retirer un $row-&gt;product\_id du cart](/forum/5-support-en-francais-french-support-/75877-retirer-un-row-product-id-du-cart#77117 "Sous certaines conditions je voudrais automatiquement retirer certains produits du cart  comment faire ça dans a boucle du cart.php ?  par exemple :  mais ça ne marche pas  ou bien quelle autre méthode hors de la boucle pour retirer un $row-&gt;product&#95;id du cart définitivement (pas juste l'affichage) ?  je voudrais eviter un DELETE FROM ##&#95;&#95;cart&#95;product WHERE cart&#95;product&#95;id = $row-&gt;cart&#95;product&#95;id ou $i  merci")*

et il n'y a aucune fonction à la volée ? la même qui est utilisée quand on clique sur le bouton supprimer d'un produit du cart, quelle fonction hikashop est appelée ?

sinon le plus simple est *DELETE FROM #\_\_hikashop\_cart\_product WHERE cart\_product\_id = $row-&gt;cart\_product\_id*  non ?

merci

Last edit: 14 years 1 week ago by [erickb](/forum/user/4069-erickb "View erickb's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU4NzctcmV0aXJlci11bi1yb3ctcHJvZHVjdC1pZC1kdS1jYXJ0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

14 years 1 week ago [\#77124](#77124) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[retirer un $row-&gt;product\_id du cart](/forum/5-support-en-francais-french-support-/75877-retirer-un-row-product-id-du-cart#77124 "Sous certaines conditions je voudrais automatiquement retirer certains produits du cart  comment faire ça dans a boucle du cart.php ?  par exemple :  mais ça ne marche pas  ou bien quelle autre méthode hors de la boucle pour retirer un $row-&gt;product&#95;id du cart définitivement (pas juste l'affichage) ?  je voudrais eviter un DELETE FROM ##&#95;&#95;cart&#95;product WHERE cart&#95;product&#95;id = $row-&gt;cart&#95;product&#95;id ou $i  merci")*

Bonsoir,

Il est aussi possible de faire la modification du cart et d'appeler la fonction $cartClass-&gt;save($cart);
Mais cela fera surement plus de requête que de faire le "DELETE" à la main.

Cordialement,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU4NzctcmV0aXJlci11bi1yb3ctcHJvZHVjdC1pZC1kdS1jYXJ0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[erickb](/forum/user/4069-erickb "View erickb's Profile")**
- [![erickb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/4069-erickb "View erickb's Profile") Topic Author
- [ Away](/forum/user/4069-erickb)

Less More

- Posts: 2704
- Thank you received: 74
-
-

14 years 1 week ago [\#77125](#77125) by [erickb](/forum/user/4069-erickb "View erickb's Profile")  Replied by *[erickb](/forum/user/4069-erickb "View erickb's Profile")* on topic *[retirer un $row-&gt;product\_id du cart](/forum/5-support-en-francais-french-support-/75877-retirer-un-row-product-id-du-cart#77125 "Sous certaines conditions je voudrais automatiquement retirer certains produits du cart  comment faire ça dans a boucle du cart.php ?  par exemple :  mais ça ne marche pas  ou bien quelle autre méthode hors de la boucle pour retirer un $row-&gt;product&#95;id du cart définitivement (pas juste l'affichage) ?  je voudrais eviter un DELETE FROM ##&#95;&#95;cart&#95;product WHERE cart&#95;product&#95;id = $row-&gt;cart&#95;product&#95;id ou $i  merci")*

ok je delete

merci Jerome

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU4NzctcmV0aXJlci11bi1yb3ctcHJvZHVjdC1pZC1kdS1jYXJ0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.054 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
