按照本指南自定义数据库表的自定义模块,我是magento的新手
我已经将我已经存在的模块实现到后端adminhtml.我正在从数据库中获取内容并在adminhtml页面上播放.一切正常,除了我在adminhtml上获得两次网格.我两次得到同一个网格.我已经看了2个小时的代码无法搞清楚.如果有人知道如何解决这个问题,我会非常愚蠢.干杯
这就是我的grid.php中的代码
<?php
class Ecom_Pricenotify_Block_Adminhtml_Pricenotify_Grid extends Mage_Adminhtml_Block_Widget_Grid{
public function __construct()
{
parent::__construct();
$this->setId('pricenotifyGrid');
// This is the primary key of the database
$this->setDefaultSort('pricenotify_id');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
}
protected function _prepareCollection()
{
$collection = Mage::getModel('pricenotify/pricenotify')->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('pricenotify_id', array(
'header' => Mage::helper('pricenotify')->__('Notification ID'),
'align' =>'left',
'width' => '50px',
'index' => 'pricenotify_id',
));
$this->addColumn('prod_id', array(
'header' => Mage::helper('pricenotify')->__('Product ID'),
'align' =>'left',
'width' => '50px',
'index' => 'prod_id',
));
$this->addColumn('prod_price', array(
'header' => Mage::helper('pricenotify')->__('Product Price'), …Run Code Online (Sandbox Code Playgroud) magento中是否有任何服务器端表单验证?我已经创建了一个from和使用magentos表单验证但如果有人禁用javascipt并输入可能有害的内容,它将无法工作.如果没有内置类.有人可以指点我如何实现服务器端表单验证作为备份.这是我的表格代码
<div style="border:0px solid red; margin:0px auto;">
<?php $_product = $this->getProduct(); ?>
<form id="test" action="<?php echo Mage::getUrl('pricenotify/pricenotify/db') ?>" method="post">
<label for="price">Price *</label>
<input type="text" id="price" name="price" value="" class="required-entry validate-number"/><br />
<label for="email">Email Address *</label>
<input type="text" id="email" name="email" value="" class="required-entry validate-email"/>
<input type="hidden" id="id" name="id" value="<?php echo $_product->getId() ?>" />
<input type="hidden" id="propri" name="propri" value="<?php echo $_product->getPrice() ?>" />
<input type="submit" name="submit" value="<?php echo $this->__('Submit') ?>" onclick="if(customForm.validator && customForm.validator.validate()) this.form.request(); return false;" />
</form>
<script type="text/javascript">
//< ![CDATA[
var customForm …Run Code Online (Sandbox Code Playgroud)