public function actionDelete() { $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId')); $ids = Yii::app()->request->getPost('ids'); Until::isUpdateValid($ids, $companyId, $this); //0,表示企业任何时候都在云端更新。 if (!empty($ids)) { foreach ($ids as $id) { $model = PaymentMethod::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId)); if ($model) { $model->delete(); } } $this->redirect(array('payMethod/index', 'companyId' => $companyId)); } else { Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目')); $this->redirect(array('payMethod/index', 'companyId' => $companyId)); } }
<div class="form order-details-page"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'multiple-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary(array($model, $description)); ?> <div class="row"> <?php echo $form->labelEx($model, 'payment_method'); ?> <?php echo $form->dropDownList($model, 'payment_method', CHtml::listData(PaymentMethod::model()->findAll(), 'id', function ($data) { return $data->getName(); })); ?> <?php echo $form->error($model, 'payment_method'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'shipping_method'); ?> <?php echo $form->dropDownList($model, 'shipping_method', CHtml::listData(ShippingMethod::model()->findAll(), 'id', function ($data) { return $data->getName(); }));
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = PaymentMethod::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function getPaymentMethodList($companyId) { $paymentMethods = PaymentMethod::model()->findAll(' dpid=:dpid', array(':dpid' => $companyId)); return CHtml::listData($paymentMethods, 'lid', 'name'); }
</fieldset> <br /> <hr /> <h3> <?php echo Shop::t('Payment method'); ?> </h3> <p> <?php echo Shop::t('Choose your Payment method'); ?> </p> <?php $i = 0; foreach (PaymentMethod::model()->findAll() as $method) { echo '<div class="row">'; echo CHtml::radioButton("PaymentMethod", $i == 0, array('value' => $method->id)); echo '<div class="float-left">'; echo CHtml::label($method->title, 'PaymentMethod'); echo CHtml::tag('p', array(), $method->description); echo '</div>'; echo '</div>'; echo '<div class="clear"></div>'; $i++; } ?> <div class="row buttons"> <?php
private function getPaymentMethodList() { $paymentMethods = PaymentMethod::model()->findAll(); return CHtml::listData($paymentMethods, 'payment_method_id', 'name'); }
</div> </div> <?php } echo CHtml::beginForm(array('/order/create'), 'POST', array('id' => 'orderForm')); ?> <?php echo CHtml::hiddenField('delivery_address', 'address_value', array('id' => 'hide_address')); ?> <div class="box"> <div class="box-title container_24">支付方式</div> <div class="box-content" style="vertical-align:middle;"> <?php $cri = new CDbCriteria(array('condition' => 'enabled = 1')); $paymentMethod = PaymentMethod::model()->findAll($cri); $list = CHtml::listData($paymentMethod, 'payment_method_id', 'name'); echo CHtml::radioButtonList('payment_method_id', '0', $list); ?> </div> </div> <?php $imageHelper = new ImageHelper(); ?> <div class="box"> <div class="box-title container_24">商品列表</div> <div class="box-content cart container_24"> <table id="list-div-box" class="table"> <tr style="background:#F3F3F3;"> <th class="col-xs-3">图片</th>
/** Creation of a new Order * Before we create a new order, we need to gather Customer information. * If the user is logged in, we check if we already have customer information. * If so, we go directly to the Order confirmation page with the data passed * over. Otherwise we need the user to enter his data, and depending on * whether he is logged in into the system it is saved with his user * account or once just for this order. */ public function actionCreate($customer = null, $payment_method = null, $shipping_method = null) { // Shopping cart is empty, taking a order is not allowed yet if (Shop::getCartContent() == array()) { $this->redirect(array('//shop/shoppingCart/view')); } if (isset($_POST['ShippingMethod'])) { Yii::app()->user->setState('shipping_method', $_POST['ShippingMethod']); } if (isset($_POST['PaymentMethod'])) { Yii::app()->user->setState('payment_method', $_POST['PaymentMethod']); } if (isset($_POST['DeliveryAddress']) && @$_POST['toggle_delivery'] == true) { if (Address::isEmpty($_POST['DeliveryAddress'])) { Shop::setFlash(Shop::t('Delivery address is not complete! Please fill in all fields to set the Delivery address')); } else { $deliveryAddress = new DeliveryAddress(); $deliveryAddress->attributes = $_POST['DeliveryAddress']; if ($deliveryAddress->save()) { $model = Shop::getCustomer(); if (isset($_POST['toggle_delivery'])) { $model->delivery_address_id = $deliveryAddress->id; } else { $model->delivery_address_id = 0; } $model->save(false, array('delivery_address_id')); } } } if (isset($_POST['BillingAddress']) && @$_POST['toggle_billing'] == true) { if (Address::isEmpty($_POST['BillingAddress'])) { Shop::setFlash(Shop::t('Billing address is not complete! Please fill in all fields to set the Billing address')); } else { $BillingAddress = new BillingAddress(); $BillingAddress->attributes = $_POST['BillingAddress']; if ($BillingAddress->save()) { $model = Shop::getCustomer(); if (isset($_POST['toggle_billing'])) { $model->billing_address_id = $BillingAddress->id; } else { $model->billing_address_id = 0; } $model->save(false, array('billing_address_id')); } } } if (!$customer) { $customer = Yii::app()->user->getState('customer_id'); } if (!Yii::app()->user->isGuest && !$customer) { $customer = Customer::model()->find('user_id = :user_id ', array(':user_id' => Yii::app()->user->id)); } if (!$payment_method) { $payment_method = Yii::app()->user->getState('payment_method'); } if (!$shipping_method) { $shipping_method = Yii::app()->user->getState('shipping_method'); } if (!$customer) { $this->render('/customer/create', array('action' => array('//shop/customer/create'))); Yii::app()->end(); } if (!$shipping_method) { $this->render('/shippingMethod/choose', array('customer' => Shop::getCustomer())); Yii::app()->end(); } if (!$payment_method) { $this->render('/paymentMethod/choose', array('customer' => Shop::getCustomer())); Yii::app()->end(); } if ($customer && $payment_method && $shipping_method) { if (is_numeric($customer)) { $customer = Customer::model()->findByPk($customer); } if (is_numeric($shipping_method)) { $shipping_method = ShippingMethod::model()->find('id = :id', array(':id' => $shipping_method)); } if (is_numeric($payment_method)) { $payment_method = PaymentMethod::model()->findByPk($payment_method); } $this->render('/order/create', array('customer' => $customer, 'shippingMethod' => $shipping_method, 'paymentMethod' => $payment_method)); } }
<?php $this->widget('bootstrap.widgets.TbAlert'); ?> <?php $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('payment_firstname', 'payment_lastname', 'payment_company', 'payment_company_id', 'payment_tax_id', 'payment_address_1', 'payment_address_2', 'payment_city', 'payment_postcode', 'payment_country', 'payment_zone', 'payment_address_format', array('label' => 'Payment Method', 'type' => 'raw', 'value' => PaymentMethod::model()->findByPk($model->payment_method)->getName()))));
// If the customer is not passed over to the view, we assume the user is // logged in and we fetch the customer data from the customer table if (!isset($customer)) { $customer = Shop::getCustomer(); } $this->renderPartial('application.modules.shop.views.customer.view', array('model' => $customer, 'hideAddress' => true, 'hideEmail' => true)); echo '<br />'; echo '<hr />'; echo '<p>'; $shipping = ShippingMethod::model()->find('id = :id', array(':id' => Yii::app()->user->getState('shipping_method'))); echo '<strong>' . Shop::t('Shipping Method') . ': </strong>' . ' ' . $shipping->title . ' (' . $shipping->description . ')'; echo '<br />'; echo CHtml::link(Shop::t('Edit shipping method'), array('//shop/shippingMethod/choose', 'order' => true)); echo '</p>'; echo '<p>'; $payment = PaymentMethod::model()->findByPk(Yii::app()->user->getState('payment_method')); echo '<strong>' . Shop::t('Payment method') . ': </strong>' . ' ' . $payment->title . ' (' . $payment->description . ')'; echo '<br />'; echo CHtml::link(Shop::t('Edit payment method'), array('//shop/paymentMethod/choose', 'order' => true)); echo '</p>'; echo '<hr />'; $this->renderPartial('application.modules.shop.views.shoppingCart.view'); echo '<h3>' . Shop::t('Please add additional comments to the order here') . '</h3>'; echo CHtml::textArea('Order[Comment]', @Yii::app()->user->getState('order_comment'), array('class' => 'order_comment')); echo '<br /><br />'; echo '<hr />'; $this->renderPartial(Shop::module()->termsView); ?> <div class="row buttons"> <?php
echo Yii::t('info', 'You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.'); ?> </p> <?php echo TbHtml::linkButton(Yii::t('label', 'Advanced Search'), array('url' => '#', 'class' => 'search-button', 'color' => TbHtml::BUTTON_COLOR_PRIMARY)); ?> <div class="search-form hide"> <?php echo $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('bootstrap.widgets.TbGridView', array('id' => 'order-grid', 'type' => array(TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_CONDENSED), 'dataProvider' => $model->search(), 'filter' => $model, 'rowCssClassExpression' => '"items[]_{$data->id}"', 'columns' => array(array('class' => 'CCheckBoxColumn', 'id' => 'check', 'selectableRows' => 2), 'id', array('name' => 'payment_method', 'type' => 'raw', 'value' => function ($data) { $pay = PaymentMethod::model()->findByPk($data->payment_method); $name = !empty($pay) ? $pay->getName() : null; return $name; }, 'filter' => CHtml::activeDropDownList($model, 'payment_method', TbHtml::listData(PaymentMethod::model()->findAll(), 'id', function ($data) { return $data->getName(); }), array('empty' => ''))), 'payment_code', 'store_name', 'firstname', 'lastname', 'email', 'telephone', array('name' => 'total', 'type' => 'raw', 'value' => 'UtilityHelper::formatPrice($data->total)'), array('name' => 'order_status_id', 'type' => 'raw', 'value' => '!empty($data->orderStatus)? TbHtml::encode($data->orderStatus->getName()) : null', 'filter' => CHtml::activeDropDownList($model, 'order_status_id', TbHtml::listData(OrderStatus::model()->findAll(), 'id', function ($data) { return $data->getName(); }), array('empty' => ''))), 'date_added', array('class' => 'bootstrap.widgets.TbButtonColumn', 'htmlOptions' => array('style' => 'width: 20px'), 'buttons' => array('delete' => array('label' => Yii::t('label', 'Delete'), 'options' => array("class" => "dlink", 'title' => Yii::t('label', 'Delete'))), 'update' => array('label' => Yii::t('label', 'Update'), 'options' => array("class" => "update vlink", 'title' => Yii::t('label', 'Update'))), 'view' => array('label' => Yii::t('label', 'View'), 'options' => array("class" => "view vlink", 'title' => Yii::t('label', 'View')))), 'template' => '{view} {update} {delete}')), 'afterAjaxUpdate' => 'js:reSortGrid')); ?> <div class="hlinks hide"> <div class="uid"></div> <div class="sortLink"><?php echo $this->createUrl('sort'); ?> </div> </div>