public function actionUpdateProductTaste() { $tasteArr = array(); $lid = Yii::app()->request->getParam('lid'); Until::isUpdateValid(array($lid), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 $model = Product::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $lid, ':dpid' => $this->companyId)); if (Yii::app()->request->isPostRequest) { $postData = Yii::app()->request->getPost('Taste'); if (TasteClass::saveProductTaste($this->companyId, $lid, $postData)) { Yii::app()->user->setFlash('success', yii::t('app', '修改成功')); $this->redirect(array('taste/productTaste', 'companyId' => $this->companyId)); } } $tastes = TasteClass::getAllOrderTasteGroup($this->companyId, 0); $productTastes = TasteClass::getProductTasteGroup($lid, $this->companyId); foreach ($productTastes as $taste) { array_push($tasteArr, $taste['lid']); } $this->render('updateProductTaste', array('model' => $model, 'tastes' => $tastes, 'productTastes' => $tasteArr)); }
?> </h4> </div> <div class="modal-body"> <div class="clearfix col-md-12"> <?php if ($tastegroups) { ?> <?php foreach ($tastegroups as $tastegroup) { ?> <div class="btn-group" data-toggle="buttons" style="margin-right: 10px;border: 1px solid red;background: rgb(245,230,230);"> <?php $tastes = TasteClass::gettastes($tastegroup['lid'], $this->companyId); foreach ($tastes as $taste) { ?> <label tasteid="<?php echo $taste['lid']; ?> " group="tastegroup_<?php echo $tastegroup['lid']; ?> " class="selectTaste btn btn-default <?php if (in_array($taste['lid'], $orderTastes)) { echo 'active'; } ?> ">
</div> <div class="right-down"> <font color="#ff8c00"><?php echo yii::t('app', '口味要求'); ?> </font>:<?php $productTasteIds = TasteClass::getOrderTaste($order['lid'], 2, $this->companyId); if ($productTasteIds) { foreach ($productTasteIds as $id) { echo TasteClass::getTasteName($id) . ' '; } } ?> <?php echo yii::t('app', '备注:'); echo TasteClass::getOrderTasteMemo($order['lid'], 2, $this->companyId); ?> </div> </div> <div class="clear"></div> </div> <?php } ?> <?php } ?> <?php } ?> <?php
public function actionProductTasteAll() { $lid = Yii::app()->request->getParam('lid', 0); $companyId = Yii::app()->request->getParam('companyId'); $isall = Yii::app()->request->getParam('isall', '0'); if ($isall == '1') { $tastegroups = TasteClass::getAllOrderTasteGroup($companyId, '1'); $orderTastes = TasteClass::getOrderTaste($lid, '1', $companyId); $tasteMemo = TasteClass::getOrderTasteMemo($lid, '1', $companyId); $orderId = $lid; } else { $tastegroups = TasteClass::getProductTasteGroup($lid, $companyId); $orderTastes = TasteClass::getOrderTaste($lid, '2', $companyId); $tasteMemo = TasteClass::getOrderTasteMemo($lid, '2', $companyId); } $this->renderPartial('tastedetailall', array('tastegroups' => $tastegroups, 'orderTastes' => $orderTastes, 'tasteMemo' => $tasteMemo)); }
<tbody> <?php if ($models) { ?> <?php foreach ($models as $model) { ?> <tr class="odd gradeX"> <td ><?php echo $model->product_name; ?> </td> <td> <?php foreach ($model->productTaste as $val) { echo TasteClass::getTasteName($val->taste_group_id, $this->companyId) . ' '; } ?> </td> <td class="center"> <a href="<?php echo $this->createUrl('taste/updateProductTaste', array('lid' => $model->lid, 'companyId' => $model->dpid)); ?> "><?php echo yii::t('app', '编辑'); ?> </a> </td> </tr> <?php }
/例 X <font color="#ff8c00"><?php echo $order['amount']; ?> 例</font></div> </div> <div class="right-down"> <font color="#ff8c00">口味要求</font>:<?php $productTasteIds = TasteClass::getOrderTaste($order['lid'], 2, $dpid); if ($productTasteIds) { foreach ($productTasteIds as $id) { echo TasteClass::getTasteName($id) . ' '; } } ?> 备注:<?php echo TasteClass::getOrderTasteMemo($order['lid'], 2, $dpid); ?> </div> </div> <div class="clear"></div> </div> <?php } ?> <?php } ?> <?php } ?> <?php
public function actionSetOrderTaste() { $type = Yii::app()->request->getPost('type'); $id = Yii::app()->request->getPost('id'); $tasteMemo = Yii::app()->request->getPost('tasteMemo'); $tasteIds = Yii::app()->request->getPost('tasteIds'); if ($type == 1) { //全单口味 $result = TasteClass::save($this->companyId, 1, $id, $tasteIds, $tasteMemo); } elseif ($type == 2) { //产品口味 $result = TasteClass::save($this->companyId, 0, $id, $tasteIds, $tasteMemo); } elseif ($type == 3) { $result = FeedBackClass::save($this->companyId, $this->siteNoId, 1, $id, $tasteIds, $tasteMemo); } if ($result) { echo 1; } else { echo 0; } exit; }