Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to override and extend widget


pineoclean

Recommended Posts

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 ? 

Link to comment
Share on other sites

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 ?

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...