Magento从数据库编辑文本框

时间:2015-01-22 02:10:30

标签: javascript php html5 magento

我所有人都是magento的菜鸟。请有人请帮助我 我有两个数据库。  http://s30.postimg.org/ujldkz381/Screenshot_2015_01_21_13_11_48.png

http://s28.postimg.org/fsfzlx0r1/Screenshot_2015_01_21_13_13_27.png

我可以选择保存到模板中具有以下代码的数据库。

  </script>
    <div class="page-title">
            <h1><?php echo $helper->__('Promotion Settings') ?></h1>
    </div>
    <form action="<?php echo $this->getUrl('socialcoupon/index/savecoupon') ?>" enctype="multipart/form-data" method="post" id="form-coupon-save">
    <div class="fieldset">
                <h4 class="legend"><?php echo $helper->__('Create Promotion') ?></h4>
                    <ul class="form-list" id="wk_bodymain">
                        <input type="hidden"  name="customerid" value="<?php echo $customerid?>"/>
            <li>
                                <label class="required"><em>*</em><?php echo $helper->__('Discount Amount') ?>:</label>
                                <div class="input-box">
                                    <input type="text" class="required-entry input-text" name="discountamt" id="discountamt" value="0"/>
                                </div>
            </li>
            <li>
                                <label class="required"><em>*</em><?php echo $helper->__('Number of coupons') ?>:</label>
                                <div class="input-box">
                                    <input type="text" class="required-entry input-text" name="numcoupons" id="numcoupons" value="0"/>
                                </div>
            </li>
            <li>
                                <label class="required"><em>*</em><?php echo $helper->__('Start Date (MM/DD/YYYY)') ?>:</label>
                                <div class="input-box">
                                    <input type="text" id="datepicker" class="required-entry input-text" name="fromdate" id="fromdate" value="0"/>
                                </div>
            </li>
            <li>
                                <label class="required"><em>*</em><?php echo $helper->__('End Date (MM/DD/YYYY)') ?>:</label>
                                <div class="input-box">
                                    <input type="text" id="datepicker2" class="required-entry input-text" name="todate" id="todate" value="0"/>
                                </div>
            </li>
            <li>
                                <label class="required"><em>*</em><?php echo $helper->__('Product SKU)') ?>:</label>

                                <div class="input-box">
                                    <select name="sku_in" id="sku_in" onChange="OnDropDownChange(this);">



            </span>

我已经完成了删除代码,但它确实有效。这是我的删除代码

  Public function deletecouponAction ()  {

    // get id
    //$id = getParam(couponid);
   $id = $this->getRequest()->getParam(id);


$model = Mage::getModel('salesrule/coupon');
try {
    $model->setId($id)->delete();
    echo "Data deleted successfully.";

} catch (Exception $e){
    echo $e->getMessage(); 
}
  $this->_redirect('socialcoupon/index/');    

    // select required table
   // $table = Mage::getSingleton("core/resource")->getTableName('salesrule/coupon');


    //$db = Mage::getSingleton('core/resource')->getConnection('core_write');


    //delete data and edit parameter accordingly
    //$db->delete($table, array('coupon_id=?'=> $id));

    //$data= $this->getRequest()->getParams();
    //$_product = Mage::getModel('salesrule/coupon')->load($data[26])->delete();


    // ob_flush();
       // flush();

}

我想要一种用弹出窗口编辑这些数据库的方法。代码在indexcontroller中。谢谢。

0 个答案:

没有答案