Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,199 of 9,199 pages
About the help in other languages
All help pages

Wish list: removeItem() only removes its own items

Read this page if you have code that calls eZWishList::removeItem(), or a shop template or module that posts item ids to the wish list page. Before, the wish list removed every product collection item whose id it was…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/bc/6.0/wish-list-remove-item.md

On this page

Wish list: removeItem() only removes its own items

Read this page if you have code that calls eZWishList::removeItem(), or a shop template or module that posts item ids to the wish list page. Before, the wish list removed every product collection item whose id it was given, whether the item belonged to that wish list, to a basket, to an order or to another user's wish list, and an id that named no item ended in a fatal error.

In short

What changedeZWishList::removeItem() is an instance method. It removes the item only when the item belongs to the product collection of that wish list, and returns true if it removed the item, false otherwise. The remove action of shop/wishlist takes only positive whole numbers from the posted list.
Who is affectedCode that calls eZWishList::removeItem() statically (it now ends in an Error), or that relies on it removing items of other collections or on it failing for an unknown id. The shipped wish list page needs no change.
How to checkgrep -rn "eZWishList::removeItem" kernel extension design
How to fixFetch the wish list and call the method on it: $wishList->removeItem( $itemID ). Check the returned boolean where it matters.

Details

eZBasket::removeItem() has always compared the item's productcollection_id with the basket's own. The wish list did not, so every caller had to remember the check, and the page itself did not make it.

  • Items of another wish list, a basket or an order are left alone, and false is returned.
  • An unknown id returns false instead of failing on a missing object.
  • The remove action ignores posted values that are not positive whole numbers, and a posted list that is not a list at all, instead of passing them on.

Option rows of a removed item are not removed with it. That is unchanged and equal to the basket.

Option comparison

When an item is added to the basket or the wish list, the stored options of an existing item are compared with the posted ones to decide whether it is the same item. The comparison now lives in eZShopFunctions::isSameOptionSelection() and is shared by both. An attribute the posted list names no option for explicitly means another selection; before, the comparison read the missing key and raised an "Undefined array key" warning. In the basket, a missing option for a validated attribute is passed to validateAddToBasket() as null for the same reason, and in the wish list an option field that is not a list counts as no options.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x