Source of file ProductGroupSearchPage.php
Size: 2,176 Bytes - Last Modified: 2021-12-23T10:39:35+00:00
/var/www/docs.ssmods.com/process/src/src/Pages/ProductGroupSearchPage.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 | <?php namespace Sunnysideup\Ecommerce\Pages; use SilverStripe\ORM\DataObject; /** * This page manages searching for products. * * @author Nicolaas [at] Sunny Side Up .co.nz */ class ProductGroupSearchPage extends ProductGroup { protected static $main_search_page; /** * @var ProductGroupSearchPage */ protected static $mainSearchPageCache; /** * @var int */ private static $maximum_number_of_products_to_list_for_search = 500; /** * @var string */ private static $best_match_key = 'bestmatch'; private static $table_name = 'ProductGroupSearchPage'; private static $icon = 'sunnysideup/ecommerce:client/images/icons/productgroupsearchpage-file.gif'; private static $description = 'This page allowing the user to search for products.'; private static $singular_name = 'Product Search Page'; private static $plural_name = 'Product Search Pages'; public function i18n_singular_name() { return _t('ProductGroupSearchPage.SINGULARNAME', 'Product Search Page'); } public function i18n_plural_name() { return _t('ProductGroupSearchPage.PLURALNAME', 'Product Search Pages'); } /** * Standard SS function, we only allow for one Product Search Page to exist * but we do allow for extensions to exist at the same time. * * @param \SilverStripe\Security\Member $member * @param mixed $context * * @return bool */ public function canCreate($member = null, $context = []) { return ProductGroupSearchPage::get()->exists() ? false : $this->canEdit($member); } /** * @return null|ProductGroupSearchPage */ public static function main_search_page() { return DataObject::get_one(ProductGroupSearchPage::class); } /** * return ID of the only ProductGroupSearchPage. */ public static function main_search_page_id(): int { $page = self::main_search_page(); return $page ? $page->ID : 0; } public function getMyLevelOfProductsToShow(?int $defauult = 99): int { return -2; } } |