Caveats: There's no designed way to do what you're asking in the system. The following should work, but I've never tried it out extensively on a production system, and there may be situations where it will cause more trouble that it's worth. Only proceed if you're comfortable debugging problems related to the changing the rewrites of a working system.
Step 1 is undoing the rewrite. The Magento configuration tree can be changed at runtime. So, if you run the following code
$config = Mage::getConfig();
$config->setNode(
'global/blocks/catalog/rewrite/product_list_toolbar',
'Mage_Catalog_Block_Product_List_Toolbar'
);
Then Magento will instantiate the original Mage_Catalog_Block_Product_List_Toolbar
block for the remainder of the request.
Step 2 is deciding where to call this in your module. Since this is just for your controller and it's rewriting a block that won't be instantiated until the end of your controller, I'd add a method to your controller class something like this
protected function _undoRewrites()
{
$config = Mage::getConfig();
$config->setNode(
'global/blocks/catalog/rewrite/product_list_toolbar',
'Mage_Catalog_Block_Product_List_Toolbar'
);
}
and then just call this method at the start of each of your actions
public function indexAction()
{
$this->_undoRewrites();
$test = Mage::getSingleton('core/layout')->createBlock('catalog/product_list_toolbar');
var_dump($test);
}
This may seem a little clunky, but I think it's a good idea to be clunky (i.e. obvious) when you're being clever with Magento's system objects. Another place for this could be the controller_action_predispatch
or controller_action_predispatch_front_controller_action
events and/or applied conditionally.
Just remember the rewrite won't be undone until this method is called. That means if you attempt to instantiate a block before calling _undoRewrites
, the rewritten class will be used to instantiate the object.
There should be no reason at all to change the DS
.
DIRECTORY_SEPARATOR
is a predefined PHP constant that is set by your PHP installation itself.
If it is returning the wrong value, it is because your PHP installation is wrong.
Don't adjust Magento to suit a broken PHP install.
Best Answer
The answer is obviously, Yes, You Can. :)
If you disable this third party extension either via editing code or via admin, then magento will start to use its default helper/Model class. Yes Magento is smart enough to to do that.
In order to disable this extension via admin, you need to go
In order to disable via xml file, you need to find activation file of the extension. Most probably it's name would be
Kadro_PIO.xml
. So go toapp\etc\modules\Kadro_PIO.xml
and then changeEdit
From your comment, it seems that, the extension do other jobs for you. So my solution will not help you, since it disable that extension fully.
If you just need to avoid the rewrite part, then the fastest and easiest way will be comment out that rewrite part in the extension's
config.xml
file.But this is not the proper way to do this. If you need to do this in clear way, then I will suggest you to create a small custom module that will rewrite the extension's rewrite model file.
For this your module
config.xml
should holds this partFile :
app\code\local\Namespace\Modulename\etc\config.xml
File :
app\code\local\Namespace\Modulename\Model\Product\Image.php