1 <?php
2 3 4 5 6
7 class FavoriteProducts extends DataObjectDecorator {
8
9 function () {}
10
11 function AddToFavoriteLink() {
12 return FavoritePage::find_link('additem', $this->owner->ID);
13 }
14
15 function DeleteFavoriteLink() {
16 return FavoritePage::find_link('deleteitem', $this->owner->ID);
17 }
18
19
20
21 function IsFavorite() {
22 $IDs = FavoritePage::get_user_favorites();
23 $IDs = explode(',', $IDs);
24 $isFavorite = array_search($this->owner->ID, $IDs);
25 return ($isFavorite === false) ? false : true;
26 }
27
28
29 function isFavoriteProduct() {
30 return $this->owner->IsFavorite();
31 }
32 }
33
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-