1 | <?php |
||
9 | class ProductGroupSearchPage extends ProductGroup |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * standard SS variable. |
||
14 | * |
||
15 | * @static String | Array |
||
16 | */ |
||
17 | private static $icon = 'ecommerce/images/icons/productgroupsearchpage'; |
||
18 | |||
19 | /** |
||
20 | * Standard SS variable. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private static $description = 'This page allowing the user to search for products.'; |
||
25 | |||
26 | /** |
||
27 | * Standard SS variable. |
||
28 | */ |
||
29 | private static $singular_name = 'Product Search Page'; |
||
30 | public function i18n_singular_name() |
||
31 | { |
||
32 | return _t('ProductGroupSearchPage.SINGULARNAME', 'Product Search Page'); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Standard SS variable. |
||
37 | */ |
||
38 | private static $plural_name = 'Product Search Pages'; |
||
39 | public function i18n_plural_name() |
||
40 | { |
||
41 | return _t('ProductGroupSearchPage.PLURALNAME', 'Product Search Pages'); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Standard SS function, we only allow for one Product Search Page to exist |
||
46 | * but we do allow for extensions to exist at the same time. |
||
47 | * |
||
48 | * @param Member $member |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | public function canCreate($member = null) |
||
53 | { |
||
54 | return ProductGroupSearchPage::get()->filter(array('ClassName' => 'ProductGroupSearchPage'))->Count() ? false : $this->canEdit($member); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Can product list (and related) be cached at all? |
||
59 | * |
||
60 | * @var bool |
||
61 | */ |
||
62 | protected $allowCaching = false; |
||
63 | |||
64 | /** |
||
65 | * This is a KEY method that overrides the standard method! |
||
66 | * @return [type] [description] |
||
67 | */ |
||
68 | public function getGroupFilter() |
||
69 | { |
||
70 | $resultArray = $this->searchResultsArrayFromSession(); |
||
71 | $this->allProducts = $this->allProducts->filter(array('ID' => $resultArray)); |
||
72 | |||
73 | return $this->allProducts; |
||
74 | } |
||
75 | |||
76 | |||
77 | /** |
||
78 | * returns the SORT part of the final selection of products. |
||
79 | * |
||
80 | * @return string | Array |
||
81 | */ |
||
82 | protected function currentSortSQL() |
||
83 | { |
||
84 | $sortKey = $this->getCurrentUserPreferences('SORT'); |
||
85 | |||
86 | return $this->getUserSettingsOptionSQL('SORT', $sortKey); |
||
87 | } |
||
88 | |||
89 | public function childGroups($maxRecursiveLevel, $filter = null, $numberOfRecursions = 0) |
||
93 | } |
||
94 | |||
95 | class ProductGroupSearchPage_Controller extends ProductGroup_Controller |
||
96 | { |
||
97 | /** |
||
98 | * standard SS variable. |
||
151 |