I ha created a new magento module. It shows info like for example Sales/Orders grid, then on click of order there is edit(in original magento view) tabs. I have created some tabs and I want one of them to be grid, like in orders shipment, creditmemos or invoices.
How do I do that?
It's not really too much different then adding a grid to any other page. I know when I was building a module I dug into the Google Base addon that is native to Magento, I found a lot of good code there to help me understand how to implement different aspects of an admin module.
For instance my tab block overides grid, like so:
class Ssi_Crm_Block_Quotes_Edit_Tab_Bom_Product extends Mage_Adminhtml_Block_Widget_Grid
This class then overrides the standard grid functions such as _prepareCollection() and _prepareColumns() stuff that you can find documented elsewhere.
Related
I am currently developing a prestashop module where the user can add as many visual elements (an accordion) as he wishes. I finished the configuration of the back office with my own database, everything is ok on that side.
The problem comes from the fact that depending on the hook chosen by the user (displayHome or a custom hook) the visual element will be added to it.
During my testing phases, I managed to display the corresponding visual rendering on the displayHome hook, via this method in my main file :
public function hookDisplayHome($params)
{
$this->context->smarty->assign([
//...
]);
return $this->display(__FILE__, 'my_file.tpl');
}
The prestashop documentation for the FrontController explains how to configure it for visual rendering on a custom page, but nothing related to hooks.
I tried a similar process with the initContent() method but it doesn't seem to work.
I think that if() will be enough to assign the variables to different places according to the choice of the user. But if I can't just display it, I won't be able to think about it anyway.
How to interact with hooks via the FrontController ?
I have a module where I need to:
Manage Models
Manage Module Settings
API Authentication
Look & Feel
Etc
For Manage Models I obviously have a ModelAdmin extension
And for the latter Manage Module Settings I've had to create a DataExtension
Though this splits up the "Module Functionality" into two sections, ModelAdmin gets its own menu item on the sidebar, but the DataExtension only adds tabs to the Settings menu item.
I've searched around but to no avail on how to consolidate my custom tabs within the same menu item that ModelAdmin creates.
Is this possible? I understand the semantics behind ModelAdmin being that it only Administers Models but surely the functionality exists where you can add tabs to the menu item it creates that aren't models?
Surely it's not an abnormal scenario
The only way you could do this would be to extend LeftAndMain (as you have mentioned).
This can be a little daunting, but LeftAndMain is basically just a container for 3 templates:
Main admin template
Left hand nav template
Main edit form
At a basic level you can just create an extension to LeftAndMain, then add a custom "EditForm" function that has the settings fields you need (as well as actions to save the data).
Then if you want it to look fancier then you can overwrite the default LeftAndMain templates in framework/admin/tempaltes.
There are some docs on this on the Silverstripe site: https://docs.silverstripe.org/en/3.4/developer_guides/customising_the_admin_interface/cms_layout/
Hope that helps a bit.
how to create new page in module back office in prestashop 1.6
and how to pass url of that new page into anchor tag.
any help appreciated.
<a id="desc-tag-new" class="list-toolbar-btn" href="#"></a>
There is a manual and a programmatic way.
If the module is for private use, you can simply go to Administration > Menus and create a new menu page by associating it with a module, class and parent.
If you want to distribute the module, you should opt for the programmatic way. You have to create an AdminController extending the ModuleAdminController class and put it in /controllers/admin/. In your module's installation method, you should create and save/add a new Tab (which extends ObjectModel, hence the save/add ambiguity depending on your PrestaShop version). You should then set the properties of the new Tab object as you would from Administration > Menus.
Keep in mind that in PrestaShop, a new Menu page is associated with a specific ObjectModel subclass.
I'm trying to make the Layered Navigation Block show up in non-category pages like new-products, prices-drop, best-sales.
Is this an issue that could be resolved through a hook put in these pages?
And if so, I've tried putting one of the hooks used in /modules/blocklayered/blocklayered.php -> install() method
and I can't find where to put for example productListAssign Hook.
It's a more complex issue?
altering the public function getProducts to gather data in some other way, because the pages I want it to show in are not categories.
create a new method in the blocklayered class?... That would be called only in these certain pages.
Some other solution I didn't think of.
There's a similar question put here: why doesn't prestashop layered navigation block show on the front end? ;
but there's no clear solution.
It seems that nobody active in the prestashop forum can answer this question, and I've even contacted more experienced prestashop developers, not being answered for a few days.
Please ask me for any details needed if I've skipped any.
Thanks!
I have created an admin module that replicates the CMS->Page grid layout. I have copied the core code from adminhtml\default\default\template\widget\grid.phtml to my admin page template file and made my block for that template extend Mage_Adminhtml_Block_Widget_Grid.
The CMS pages display fine and I have also managed to add my own column to the grid, however none of the default columns (or my own) are sortable or filterable.
Does anyone know what might be going on here? Have I made an error somewhere or would I manually need to make these default fields sortable?
A good place to start would be this class, used for the product grid:
Mage_Adminhtml_Block_Catalog_Product_Grid
In particular the functions
_prepareCollection()
and
_prepareColumns()
I've used that block as the basis for my own custom grids. If you need any further pointers feel free to let me know and I'll do my best to take a look