- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在管理面板中开发一个子模块。第一页网格显示用户列表(推荐人/父用户)及其总佣金。在“操作”选项卡中有一个下拉菜单,单击该下拉菜单将打开一些网格。与此类似,我想添加另一个选项,点击该选项后应该有一个页面显示该推荐人/父用户下的推荐人( child 用户)以及推荐人/父用户每次推荐/ child 用户获得多少佣金。
例如: A(父用户)- B、C(子用户)通过 A 的引用注册。因此,A 从 B 获得了 20 美元佣金,A 从 C 获得了 20 美元佣金,(谁推荐的人以及佣金多少的详细信息存储在表中) 显示总计上一页 40 美元。
我收到的错误是 -
fatal error :未捕获错误:在 E:\xampp\htdocs\peoplesoilnew\app\code\core\Mage\Adminhtml\Block\Widget\Grid\Container 中调用 bool 值成员函数 setSaveParametersInSession()。 php:66 堆栈跟踪: #0 E:\xampp\htdocs\peoplesoilnew\app\code\core\Mage\Core\Block\Abstract.php(238): Mage_Adminhtml_Block_Widget_Grid_Container->_prepareLayout() #1 E:\xampp\htdocs\peoplesoilnew\app\code\core\Mage\Core\Model\Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout)) #2 E:\xampp\htdocs\peoplesoilnew\app\code\local\Mj\Friends\controllers\Adminhtml\FriendsController.php(60): Mage_Core_Model_Layout->createBlock('friends/adminht...') #3 E:\xampp\htdocs\peoplesoilnew\app\code\core\Mage\Core\Controller\Varien\Action.php(419): Mj_Friends_Adminhtml_FriendsController->friendscommissionAction() #4 E:\xampp\htdocs\peoplesoilnew\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('friendscommissi...') #5 E:\xampp\htdocs\peoplesoilnew\app\code\core\Ma 在 E:\xampp\htdocs\peoplesoilnew\app\code\core\Mage\Adminhtml\第 66 行上的 Block\Widget\Grid\Container.php
代码文件-
添加下拉选项的代码 -
$this->addColumn('action',
array(
'header' => Mage::helper('customer')->__('Action'),
'width' => '100',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('friends')->__('Make Payment'),
'url' => array('base'=> '*/*/payment'),
'field' => 'friendskey_id'
),
array(
'caption' => Mage::helper('friends')->__('View Referred Friend List'),
'url' => array('base'=> '*/*/friendslist'),
'field' => 'friendskey_id'
),
array(
'caption' => Mage::helper('friends')->__('Distribution of Commission'),
'url' => array('base'=> '*/*/friendscommission'),
'field' => 'friendskey_id'
)
app\code\local\Mj\Friends\etc\config.xml -
<friends_mysql4>
<class>Mj_Friends_Model_Mysql4</class>
<entities>
<friends>
<table>friends</table>
</friends>
<commission>
<table>friends_commission</table>
</commission>
<memberkey>
<table>friendskey</table>
</memberkey>
<friendscommission>
<table>friends_commission</table>
</friendscommission>
</entities>
</friends_mysql4>
app\code\local\Mj\Friends\Block\Adminhtml\Friendscommission\Grid.php -
<?php
class Mj_Friends_Block_Adminhtml_Friendscommission_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('friends_commission');
$this->setDefaultSort('commission_id');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(false);
$this->_prepareCollection();
}
protected function _prepareCollection()
{
// get the member id using friendskey_id
/*$friendsId = $this->getRequest()->getParam('friendskey_id');
$friendsModel = Mage::getModel('friends/memberkey')->load($friendsId);
$memberId = $friendsModel->getMemberId();*/
$collection = Mage::getModel('friends/friends_commission')->getCollection();
// $collection->addFieldToFilter('member_id', $memberId);
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
/*
$this->addColumn('friends_id', array(
'header' => Mage::helper('friends')->__('ID'),
'align' =>'right',
'width' => '50px',
'index' => 'friends_id',
));
*/
$this->addColumn('user_email', array(
'header' => Mage::helper('friends')->__('User Email'),
'align' => 'left',
'width' => '120px',
'default' => '--',
'index' => 'user_email',
));
$this->addColumn('status', array(
'header' => Mage::helper('friends')->__('Status'),
'align' => 'left',
'width' => '80px',
'index' => 'status',
'type' => 'options',
'options' => array(
'Active' => 'Active',
'Inactive' => 'Inactive',
),
));
return parent::_prepareColumns();
}
}
app\code\local\Mj\Friends\Block\Adminhtml\Friendscommission.php -
<?php
class Mj_Friends_Block_Adminhtml_Friendscommission extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct()
{
$this->_controller = 'adminhtml_friendscommission';
$this->_blockGroup = 'friends';
$this->_headerText = Mage::helper('friends')->__('Friends Commission');
//$this->_addButtonLabel = Mage::helper('friends')->__('Add Item');
parent::__construct();
$this->_removeButton('add');
/*
$this->_addButton('back');
$this->_addButton('back_button_id', array(
'label' => Mage::helper('friends')->__('Some action'),
'onclick' => 'jsfunction(this.id)',
'class' => 'go'
), 0, 100, 'header', 'header');
*/
}
}
**app\code\local\Mj\Friends\Model\Friendscommission.php **
<?php
class Mj_Friends_Model_Friendscommission extends Mage_Core_Model_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('friends/friends_commission');
}
}
从 Controller 调用该模块的操作,app\code\local\Mj\Friends\controllers\Adminhtml\FriendsController.php -
<?php
class Mj_Friends_Adminhtml_FriendsController extends Mage_Adminhtml_Controller_Action
{
protected function _initAction()
{
$this->loadLayout()
->_setActiveMenu('friends/items')
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
return $this;
}
public function indexAction() {
$this->_initAction();
$this->_addContent($this->getLayout()->createBlock('friends/adminhtml_friends'));
$this->renderLayout();
}
public function editAction()
{
$friendsId = $this->getRequest()->getParam('id');
$friendsModel = Mage::getModel('friends/friends')->load($friendsId);
if ($friendsModel->getId() || $friendsId == 0) {
Mage::register('friends_data', $friendsModel);
$this->loadLayout();
$this->_setActiveMenu('friends/items');
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
$this->_addContent($this->getLayout()->createBlock('friends/adminhtml_friends_edit'))
->_addLeft($this->getLayout()->createBlock('friends/adminhtml_friends_edit_tabs'));
$this->renderLayout();
} else {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('friends')->__('Item does not exist'));
$this->_redirect('*/*/');
}
}
public function newAction()
{
$this->_forward('edit');
}
public function friendslistAction() {
$this->_initAction();
$this->_addContent($this->getLayout()->createBlock('friends/adminhtml_friendslist'));
$this->renderLayout();
}
public function friendscommissionAction() {
$this->_initAction();
$this->_addContent($this->getLayout()->createBlock('friends/adminhtml_friendscommission'));
$this->renderLayout();
}
public function paymentAction()
{
$friendsId = $this->getRequest()->getParam('friendskey_id');
$friendsModel = Mage::getModel('friends/memberkey')->load($friendsId);
if ($friendsModel->getFriendskeyId() || $friendsId > 0) {
Mage::register('friends_data', $friendsModel);
$this->loadLayout();
$this->_setActiveMenu('friends/items');
/* $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));*/
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
$this->_addContent($this->getLayout()->createBlock('friends/adminhtml_friends_payment'))
->_addLeft($this->getLayout()->createBlock('friends/adminhtml_friends_payment_tabs'));
$this->renderLayout();
} else {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('friends')->__('Item does not exist'));
$this->_redirect('*/*/');
}
}
public function saveAction()
{
if ( $this->getRequest()->getPost() ) {
try {
$postData = $this->getRequest()->getPost();
//print_r($postData); die;
if($postData['amount_hidden'] ) {
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_write');
$updateSql = "UPDATE friends_standard_payamount SET standard_amount = '".$postData['standard_payment_amount']."', standard_commission = '".$postData['standard_commission']."'";
$readConnection->query($updateSql);
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Minimum referred payment amount updated successfully.'));
$this->_redirect('new', array('friendskey_id' => $this->getRequest()->getParam('friendskey_id')));
return;
} else {
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_write');
$updateSql = "UPDATE friends_standard_payamount SET standard_commission = '".$postData['commission_amount']."'";
$readConnection->query($updateSql);
//get the commission amount
$friendsModel = Mage::getModel('friends/friends');
$commission_amount = $postData['commission_amount'];
$friendskey_id = $postData['friendskey_id'];
//get the memeber id.
$friendsModel = Mage::getModel('friends/memberkey')->load($friendskey_id);
$memberId = $friendsModel->getMemberId();
//get the member paypal business email address.
$customerData = Mage::getModel('customer/customer')->load($memberId)->getData();
//$customerData['paypalemail'];
if(!empty($customerData['paypalemail'])) {
//get the paypal config settings.
$standard = Mage::getModel('paypal/standard');
$form = new Varien_Data_Form();
$form->setAction($standard->getConfig()->getPaypalUrl())
->setId('paypal_standard_checkout')
->setName('paypal_standard_checkout')
->setMethod('POST')
->setUseContainer(true);
/* @var $api Mage_Paypal_Model_Api_Standard */
$api = Mage::getModel('paypal/api_standard')->setConfigObject($this->getConfig());
//$orderIncrementId = 0 ;
$api->setOrderId($orderIncrementId)
->setCurrencyCode(Mage::app()->getStore()->getCurrentCurrencyCode())
//->setPaymentAction()
//->setOrder($order)
->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
->setReturnUrl(Mage::getUrl('paypal/standard/success'))
->setCancelUrl(Mage::getUrl('paypal/standard/cancel'));
//get and set owner address.
$address = array();
$api->setAddress($address);
$api->setLocale($api->getLocaleCode());
$result = $api->getStandardCheckoutRequest();
foreach ($result as $field=>$value) {
if($field == "business") {
//set the paypal business email address
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$customerData['paypalemail']));
} else if($field == "return") {
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$this->getUrl('*/*/success', array())));
} else if($field == "cancel_return") {
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$this->getUrl('*/*/cancel', array())));
} else {
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
}
}
$form->addField('amount', 'hidden', array('name'=>'amount', 'value'=>$commission_amount));
$form->addField('paymentaction', 'hidden', array('name'=>'paymentaction', 'value'=>'sale'));
$form->addField('item_name', 'hidden', array('name'=>'item_name', 'value'=>'Commission Amount'));
//$form->addField('business', 'hidden', array('name'=>'business', 'value'=>$paypalBusinessIdValue));
$idSuffix = Mage::helper('core')->uniqHash();
$submitButton = new Varien_Data_Form_Element_Submit(array(
'value' => $this->__('Click here if you are not redirected within 10 seconds...'),
));
$id = "submit_to_paypal_button_{$idSuffix}";
$submitButton->setId($id);
$form->addElement($submitButton);
$html = '<html><body>';
$html.= $this->__('You will be redirected to the PayPal website in a few seconds.');
$html.= $form->toHtml();
$html.= '<script type="text/javascript">document.getElementById("paypal_standard_checkout").submit();</script>';
$html.= '</body></html>';
echo $html;
exit;
}else {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Member does not have the PayPal Email Address. Thus, unable proceed to make the payment.'));
Mage::getSingleton('adminhtml/session')->setFriendsData($this->getRequest()->getPost());
$this->_redirect('*/*/payment', array('friendskey_id' => $this->getRequest()->getParam('friendskey_id')));
return;
}
}
/*
$friendsModel->setId($this->getRequest()->getParam('id'))
->setTitle($postData['user_email'])
->setContent($postData['content'])
->setStatus($postData['status'])
->save();
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully saved'));
Mage::getSingleton('adminhtml/session')->setFriendsData(false);
*/
// $this->_redirect('*/*/');
// return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->setFriendsData($this->getRequest()->getPost());
$this->_redirect('*/*/payment', array('friendskey_id' => $this->getRequest()->getParam('friendskey_id')));
return;
}
}
$this->_redirect('*/*/');
}
public function successAction() {
$this->loadLayout();
$this->_setActiveMenu('friends/items');
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
$this->renderLayout();
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Payment has been done successfully.'));
}
public function cancelAction() {
$this->loadLayout();
$this->_setActiveMenu('friends/items');
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
$this->renderLayout();
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Payment has been cancelled successfully.'));
}
public function formAction(){
$this->loadLayout();
$this->getResponse()->setBody(
$this->getLayout()->createBlock('friends/adminhtml_friends_payment_tab_amount')->toHtml()
);
}
/**
* Config instance getter
* @return Mage_Paypal_Model_Config
*/
public function getConfig()
{
if (null === $this->_config) {
$params = array($this->_code);
if ($store = Mage::app()->getStore()) {
$params[] = is_object($store) ? $store->getId() : $store;
}
$this->_config = Mage::getModel('paypal/config', $params);
}
return $this->_config;
}
public function deleteAction()
{
if( $this->getRequest()->getParam('id') > 0 ) {
try {
$friendsModel = Mage::getModel('friends/friends');
$friendsModel->setId($this->getRequest()->getParam('id'))
->delete();
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
$this->_redirect('*/*/');
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
}
}
$this->_redirect('*/*/');
}
/**
* Product grid for AJAX request.
* Sort and filter result for example.
*/
public function gridAction()
{
$this->loadLayout();
$this->getResponse()->setBody(
$this->getLayout()->createBlock('friends/adminhtml_friends_grid')->toHtml()
);
}
}
从中获取数据的表 -
最佳答案
似乎您缺少 Controller “adminhtml_friendscommission”
$this->_controller = 'adminhtml_friendscommission';
请创建上述 Controller ,它将解决该问题。
或者,如果您不想要 Friendscommission Controller ,并且需要使用 Friends Controller ,请更改
$this->_controller = 'adminhtml_friendscommission';
至
$this->_controller = 'adminhtml_friends';
在
Mj_Friends_Block_Adminhtml_Friendscommission::__construct method
关于magento - 单击下拉选项在管理面板中创建网格 magento 1.7.0.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40466153/
您能否建议如何在 Bootstrap 或 IE 兼容的 CSS 网格中,在没有 CSS 网格的情况下进行以下布局。 在大屏幕中 头部,左侧堆叠的 body 和右侧覆盖头部和 body 高度的图像。 [
我想在 Objective-C 中绘制一个 15*15 的网格。格子颜色是蓝色的,就像在诺基亚制作“贪吃蛇”游戏的棋盘一样。 我试过使用 for 循环来创建 subview ,但它似乎不起作用,我查看
我正在尝试将 CSS 网格与 grid-template-columns: repeat(auto-fill, auto) 一起使用,单元格被设置为最大宽度,导致每行一个元素。 p> 是否可以让元素宽
我正在努力在网格的自定义列上添加一个指向网站的简单、简单的链接。我用了 Inchoo blog为列添加自定义渲染器,它可以工作。我认为只需修改渲染并添加标签就足够了。但我的希望破灭了,行不通。 如何做
使用 Gnuplot 我绘制了下图 - 现在,正如您在图像中看到的那样,很难在线条之间识别出其末端的块。所以我想用不同的颜色或样式交替着色网格。 我现在用来给网格着色的代码是 - set style
假设我有一个非常简单的 WPF 网格(6 行 x 6 列),定义如下:
我有一个希望绑定(bind)到 WPF 网格的集合。 我面临的问题是列数是动态的并且取决于集合。这是一个简单的模型: public interface IRows { string Messa
我正在使用 Vaadin 8,我想制作某种混淆矩阵。我想知道是否可以根据单元格位置而不是数据提供者手动填充表格/网格的值。 referenceTable.addColumn(reference ->
我在 http://jsfiddle.net/TsRJy/ 上创建了一个带有 div 框的网格. 问题 我不知道如何使 a:hover 工作。 信息 重写 HTML 代码,因为表格不适合我。 http
银光处女在这里。如何使网格周围的用户控件自动调整大小以适应内部网格宽度?目前,当浏览器窗口更宽时,用户控件的显示尺寸约为 300 或 400 像素。它在数据网格周围呈现垂直和水平滚动条,这很丑陋。我想
这个问题已经有答案了: Equal width columns in CSS Grid (11 个回答) 已关闭 2 年前。 使用 CSS Grid,当您不知道会有多少个子项时,如何将所有子项保留在一
我想使用 CSS Grid 的 grid-template-areas。 但问题是我正在使用的 CMS 添加了大量额外的包装器。有没有办法忽略额外的包装?因为它弄乱了漂亮的网格区域...... 我正在
在我的Grid中,当我单击“操作”按钮(下面的代码中显示的“删除和编辑”按钮)时,我需要弹出一个窗口,而不用警告消息提醒用户; 在下面的代码中,我正在使用HANDLER handler: button
这个问题已经有答案了: Equal width columns in CSS Grid (11 个回答) 已关闭 2 年前。 使用 CSS Grid,当您不知道会有多少个子项时,如何将所有子项保留在一
我需要模拟一个仓库,其中有几辆自动驾驶车辆在给定的布局上移动,并具有简单的优先级规则。根据我的理解,这个问题可以通过离散事件模拟(DES)轻松解决,我会使用 SimPy为了这。 我看到的问题是,我似乎
在 ASP.NET 中,我可以让用户控件在页面上的表格中占据多个单元格: 用户控件1: foo bar 第1页: 并且自动调整列宽以适应最大的用户控件。 这也可以在 WPF
我正在寻找一种方法来实时搜索我的网格+要过滤的复选框。我有一个包含学生的网格(照片和姓名)。我想要的是有一个复选框,可以过滤学生所在的不同类(class)。还有一个搜索栏,我可以在其中输入学生姓名。
我正在使用 jQuery 和 jQuery UI 构建一个 Web 应用程序。我陷入了僵局。我需要的是一个 jQuery 网格,它具有可编辑字段,并以某种方式在这些可编辑单元格之一上合并一个自动完成字
我想知道是否有其他 JavaScript 组件可以提供具有多个分组的网格表示。下面是jqGrid的截图我扩展了允许该功能,但它需要获取所有数据。我希望在扩展分组时加载数据。 另一个修改后的 jqGri
我一直在为我将在此处描述的 CSS 问题而烦恼: 在下面的示例 ( https://codesandbox.io/s/jjq4km89y5 ) 中,您可以看到一个可滚动的内容(紫色背景)和一个被左侧面
我是一名优秀的程序员,十分优秀!