How can I list content in cms edit page from other table?
Which function should be overwritten?
I want to change the table where the content in wysiwyg editor is getting from another table.
How can i change this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityHow can I list content in cms edit page from other table?
Which function should be overwritten?
I want to change the table where the content in wysiwyg editor is getting from another table.
How can i change this?
You have to first create a .phtml file anywhere inside "app/design/frontend/yourpackage/yourtheme/template
", you can create phtml in any sub-directory of this folder but as you're gonna use to get custom data so put this phtml inside "page" or "catalog/product" subdirectory.
In that phtml you can use magento getSingleton object to fire a custom query to get content from custom table.
Put below code in the phtml file and save it.
<!-- language: lang-php -->
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$query = 'SELECT * FROM ' . $resource->getTableName('custom_table_name');
$results = $readConnection->fetchAll($query);
//display however you like the values of $results
And then you can call this phtml file in your CMS page as below:
{{block type="core/template" template="path_to_file/filename.phtml"}}
(*path_to_file with respect to template folder)
(You can use any block type depending on your look-and-feel requirements). And you're all set.
Happy coding :)