1 | <?php |
||
13 | class Sitewards_B2BProfessional_Helper_Category extends Sitewards_B2BProfessional_Helper_Core |
||
14 | { |
||
15 | /** |
||
16 | * Path for the config for extension active by category |
||
17 | */ |
||
18 | const CONFIG_EXTENSION_ACTIVE_BY_CATEGORY = 'b2bprofessional/activatebycategorysettings/activebycategory'; |
||
19 | |||
20 | /** |
||
21 | * Path for the config for activated categories |
||
22 | */ |
||
23 | const CONFIG_EXTENSION_ACTIVATED_CATEGORIES = 'b2bprofessional/activatebycategorysettings/activecategories'; |
||
24 | |||
25 | /** |
||
26 | * Variable for if the extension is active by category |
||
27 | * |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $bExtensionActiveByCategory; |
||
31 | |||
32 | /** |
||
33 | * Check to see if the website is set-up to require a user login to view pages |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function isExtensionActivatedByCategory() |
||
41 | |||
42 | /** |
||
43 | * For a product get all the parent and children product ids when they are set |
||
44 | * |
||
45 | * @param Mage_Catalog_Model_Product $oProduct |
||
46 | * @return int[] |
||
47 | */ |
||
48 | protected function getChildrenAndParentIds(Mage_Catalog_Model_Product $oProduct) |
||
58 | |||
59 | /** |
||
60 | * Validate that the category of a give product is activated in the module |
||
61 | * |
||
62 | * @param Mage_Catalog_Model_Product $oProduct |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function isCategoryActiveByProduct(Mage_Catalog_Model_Product $oProduct) |
||
85 | |||
86 | /** |
||
87 | * Check that at least one of the given category ids is active |
||
88 | * |
||
89 | * @param int[] $aCategoryIds |
||
90 | * @return bool |
||
91 | */ |
||
92 | public function hasActiveCategory($aCategoryIds) |
||
102 | |||
103 | /** |
||
104 | * Get all category ids activated via the system config |
||
105 | * - Include the children category ids |
||
106 | * |
||
107 | * @return int[] |
||
108 | */ |
||
109 | protected function getActiveCategories() |
||
119 | |||
120 | /** |
||
121 | * Get an array of category ids activated via the admin config section |
||
122 | * |
||
123 | * @return int[] |
||
124 | */ |
||
125 | protected function getExtensionActivatedCategoryIds() |
||
134 | |||
135 | /** |
||
136 | * From given category id load all child ids into an array |
||
137 | * |
||
138 | * @param int[] $aCategoryIds |
||
139 | * @return int[] |
||
140 | */ |
||
141 | protected function addCategoryChildren($aCategoryIds) |
||
154 | |||
155 | /** |
||
156 | * From an array of all product ids get all unique entries in the product category table |
||
157 | * |
||
158 | * @param int[] $aProductIds |
||
159 | * @param int[] $aCurrentCategories |
||
160 | * @return int[] |
||
161 | */ |
||
162 | protected function getAllCategoryIds($aProductIds, $aCurrentCategories) |
||
173 | } |