pineoclean Posted August 7, 2022 Share Posted August 7, 2022 Hi i want to modify how the frontend Categories widget works I thought id be able to extend the existing Categories widget class and override the pageName functions by creating a new file (CategoriesNEW.php) containing : namespace frontend\design\boxes; use common\classes\design\boxes\categories class CategoriesNEW extends Categories { public static function pageName($categories_id, $countSubCategories) { //new code } } But it did not work... What is the best way to do this ? Quote Link to comment Share on other sites More sharing options...
osCommerce-Official Posted August 7, 2022 Share Posted August 7, 2022 @Ivan Holbi could you please respond with a wiki link? Quote Link to comment Share on other sites More sharing options...
pineoclean Posted August 8, 2022 Author Share Posted August 8, 2022 Sorry im new to this framework, I have looked at the wiki documentation but its not clear to me. Can you give me some step by step instructions on how to extend this class ? Quote Link to comment Share on other sites More sharing options...
Ivan Holbi Posted August 8, 2022 Share Posted August 8, 2022 Hi, We checked and your use is not correct (use common\classes\design\boxes\categories). We would recommend to try at least as follows: use frontend\design\boxes\Categories; Best regards, Ivan osCommerce-Official 1 Quote Link to comment Share on other sites More sharing options...
pineoclean Posted August 9, 2022 Author Share Posted August 9, 2022 Sorry i must have copied one of my earlier attempts. Lets try this again Im trying to override the run function in the frontend/design/boxes/Categories.php So i copy the the Categories.php to CategoriesNew.php and update the class to extend Categories namespace frontend\design\boxes; use Yii; use frontend\design\boxes\Categories; class CategoriesNew extends Categories { public function run() { global $current_category_id, $breadcrumb; //Something New ...... } } But it does not work, Should this work , or is this the wrong approach to modify existing widgets ? Quote Link to comment Share on other sites More sharing options...
osCommerce-Official Posted August 10, 2022 Share Posted August 10, 2022 @Sergey Dunaevcould you please advise here? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.