Hey all,
I’m trying create my first CMP without using MIGX and I’m running into this issue. I’m attempting to create a CMP to filter the last orders placed in minishop2 within 24 hours. On the CMP, I will have a single submit button “get results” and it will create a csv/xlsv file with all of those orders.
I was following this tutorial https://docs.modx.com/3.x/en/extending-modx/custom-manager-pages and following steps.
- create a new namespace called “myshop”
- set paths to {core_path}components/myshop/ and {assets}components/myshop/
- create directory “myshop” in components and a directory “controllers” in “myshop”
replaced “namespace” with “myshop” in index & home class.
But I’m getting a blank page and
my code
index.class.php
<?php
/**
* The main manager controller for myshop.
*
* @package myshop
*/
abstract class MyshopManagerController extends modExtraManagerController {
public $myshop;
public function initialize() {
$this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
// We could run some javascript here that runs on all of our controllers
// for example something that loads your config
});
</script>');
parent::initialize();
}
public function getLanguageTopics() {
return array('myshop:default');
}
public function checkPermissions() {
return true;
}
}
class MyshopIndexManagerController extends MyshopManagerController {
public static function getDefaultController() {
return 'home';
}
}
home.class.php
<?php
/**
* The name of the controller is based on the action (home) and the
* namespace. This home controller is loaded by default because of
* our IndexManagerController.
*/
class MyshopHomeManagerController extends MyshopManagerController {
/**
* Any specific processing we want to do here. Return a string of html.
* @param array $scriptProperties
*/
public function process(array $scriptProperties = array()) {
return '<h2 class="modx-page-header">It\'s alive!</h2><p>This is your first custom manager page. You are awesome!</p>';
}
/**
* The pagetitle to put in the <title> attribute.
* @return null|string
*/
public function getPageTitle() {
return 'My first CMP!';
}
/**
* Register needed assets. Using this method, it will automagically
* combine and compress them if that is enabled in system settings.
*/
public function loadCustomCssJs() {
$this->addCss('url/to/some/css_file.css');
$this->addJavascript('url/to/some/javascript.js');
$this->addLastJavascript('url/to/some/javascript_load_last.js');
$this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
// We could run some javascript here
});
</script>');
}
}
Anyone can see what I may be doing wrong?