Пример #1
0
 /**
  * Validates the password.
  * This method serves as the inline validation for password.
  *
  * @param string $attribute the attribute currently being validated
  * @param array $params the additional name-value pairs given in the rule
  */
 public function validatePassword($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $user = $this->getUser();
         if (!$user || !$user->validatePassword($this->password)) {
             $this->addError($attribute, I18n::t('Incorrect username or password'));
         }
     }
 }
Пример #2
0
 /**
  * Creates a form model given a token.
  *
  * @param  string                          $token
  * @param  array                           $config name-value pairs that will be used to initialize the object properties
  * @throws InvalidParamException if token is empty or not valid
  */
 public function __construct($token, $config = [])
 {
     if (empty($token) || !is_string($token)) {
         throw new InvalidParamException('Password reset token cannot be blank.');
     }
     $this->_user = Customer::findByPasswordResetToken($token);
     if (!$this->_user) {
         throw new InvalidParamException(\common\models\I18n::t('Wrong password reset token'));
     }
     parent::__construct($config);
 }
Пример #3
0
 public function actionRemoveFromCart()
 {
     $result = 0;
     $product_id = Yii::$app->request->post('product_id');
     $quantity = Yii::$app->request->post('quantity', true);
     if ($product = Product::findOne(['id' => $product_id, 'is_active' => 1])) {
         Yii::$app->session->get('cart')->remove($product, $quantity);
         $result = Yii::$app->session->get('cart')->totalValue();
         $result = I18n::currency($result);
     }
     return $result;
 }
Пример #4
0
 public function init()
 {
     parent::init();
     $this->languages_codeToName = ArrayHelper::map(Language::find()->all(), 'code', 'name');
     $this->languages_idToName = ArrayHelper::map(Language::find()->all(), 'id', 'name');
     $this->currencies_idToName = ArrayHelper::map(Currency::find()->all(), 'id', 'name');
     $this->parent_productCategories_idToSlug = ArrayHelper::map(ProductCategory::find()->where(['parent_id' => null])->all(), 'id', 'slug');
     foreach ($this->parent_productCategories_idToSlug as $id => $slug) {
         $this->productCategories_idToSlug[$slug] = ArrayHelper::map(ProductCategory::find()->where(['parent_id' => $id])->all(), 'id', 'slug');
     }
     is_array($this->productCategories_idToSlug) or $this->productCategories_idToSlug = array();
     $this->productCollections_idToSlug = ArrayHelper::map(ProductCollection::find()->all(), 'id', 'slug');
     I18n::$currency_params = ['exchange_rate' => 1, 'prefix' => '', 'suffix' => 'đ', 'thousand_separator' => '.', 'decimal_point' => ',', 'number_digits_after_decimal_point' => 0];
 }
Пример #5
0
 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = Customer::findOne(['status' => Customer::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!Customer::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save(false)) {
             return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom([Yii::$app->params['noreply_email'] => Yii::$app->name])->setTo($this->email)->setSubject(I18n::t('Password reset for your account'))->send();
         }
     }
     //        var_dump($user->getErrors());
     //
     return false;
 }
Пример #6
0
 public function init()
 {
     parent::init();
     $mobile_detect = new MobileDetect();
     $this->is_mobile = $mobile_detect->isMobile();
     $this->is_tablet = $mobile_detect->isTablet();
     //        Yii::$app->language = 'vi-VN';
     $language = Language::getLanguage();
     $language_data = $language->getLanguageData();
     $currency_params = $language->getDefaultCurrencyParams();
     I18n::setLanguageData($language_data);
     I18n::setCurrencyParams($currency_params);
     Yii::$app->session->set('language_id', $language->id);
     $this->meta_index = 'index';
     $this->meta_follow = 'follow';
     $this->page_title = I18n::t('{page title}');
     $this->meta_title = I18n::t('{meta title}');
     $this->meta_description = I18n::t('{meta description}');
     $this->meta_keywords = I18n::t('{meta keywords}');
     $this->meta_image = Yii::$app->params['default_image'];
     Yii::$app->session->has('cart') or Yii::$app->session->set('cart', new Cart());
 }
Пример #7
0
// $form->field($model, 'shipping_fee')->textInput()
?>
        <?php 
// $form->field($model, 'payment_method')->textInput()
?>
        <?php 
echo $form->field($model, 'customer_note')->textarea(['maxlength' => true, 'rows' => 4]);
?>
        <?php 
// $form->field($model, 'user_note')->textInput(['maxlength' => true])
?>
    </div>
    
    <div class="col-md-12">
        <?php 
echo $form->field($model, 'captcha')->widget(\himiklab\yii2\recaptcha\ReCaptcha::className(), ['siteKey' => '6Lc6DBkTAAAAAMawyuTjwL1Ut0sMHVlBKvpkImZ3'])->label(false);
?>
        
        <div class="form-group">
            <?php 
echo Html::submitButton(\common\models\I18n::t('Submit'), ['class' => 'submit_bt']);
?>
        </div>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Пример #8
0
<?php

use common\models\I18n;
use common\models\User;
use yii\web\View;
/* @var $this View */
/* @var $user User */
$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]);
echo I18n::t('Hello');
?>
 <?php 
echo $user->username;
?>
,

<?php 
echo I18n::t('Follow the link below to reset your password');
?>

<?php 
echo $resetLink;
Пример #9
0
?>
</h1>

    <p><?php 
echo I18n::t('Please choose your new password');
?>
:</p>

    <div class="row">
        <div class="col-lg-5">
            <?php 
$form = ActiveForm::begin(['id' => 'reset-password-form']);
?>

                <?php 
echo $form->field($model, 'password')->passwordInput();
?>

                <div class="form-group">
                    <?php 
echo Html::submitButton(I18n::t('Save'), ['class' => 'submit_bt']);
?>
                </div>

            <?php 
ActiveForm::end();
?>
        </div>
    </div>
</div>
Пример #10
0
                <?php 
echo $form->field($model, 'username');
?>

                <?php 
echo $form->field($model, 'password')->passwordInput();
?>

                <?php 
echo $form->field($model, 'rememberMe')->checkbox();
?>

                <div class="form-group">
                    <?php 
echo Html::submitButton(I18n::t('Login'), ['name' => 'login-button', 'class' => 'submit_bt']);
?>
                </div>
            
                <div style="margin:2.5em 0">
                    <?php 
echo Html::a(I18n::t('Forgot password'), ['site/request-password-reset'], ['style' => 'color:#0084b4;font-size:0.9em']);
?>
                </div>

            <?php 
ActiveForm::end();
?>
        </div>
    </div>
</div>
Пример #11
0
            </tr>
    <?php 
    }
    ?>
    </tbody>
    <tfoot style="background:#fff">
            <tr>
                <td style="text-decoration:underline;font-weight:bold"><?php 
    echo I18n::t('Total amount');
    ?>
:</td>
                <td colspan="2"><?php 
    echo $totalValue;
    ?>
</td>
            </tr>
    </tfoot>
    <?php 
}
?>
        </tbody>
    </table>
    <h2 style="background:#fafafa;padding:0.5em 0;border-top:1px solid #eee"><?php 
echo I18n::t('Receiver information');
?>
</h2>
    <?php 
echo $this->render('_form', ['username' => $username, 'model' => $model]);
?>

</div>
Пример #12
0
                   'format' => 'yyyy-mm-dd hh:ii:00',
           ],
   ]) */
?>
        <?php 
// echo $form->field($model, 'total_purchase_orders')->textInput()
?>
        <?php 
// echo $form->field($model, 'total_purchase_products')->textInput()
?>
        <?php 
// echo $form->field($model, 'total_purchase_value')->textInput()
?>
    </div>
    
    <div class="col-md-12">
        <?php 
echo $form->field($model, 'captcha')->widget(ReCaptcha::className(), ['siteKey' => '6Lc6DBkTAAAAAMawyuTjwL1Ut0sMHVlBKvpkImZ3'])->label(false);
?>
        <div class="form-group">
            <?php 
echo Html::submitButton($model->isNewRecord ? I18n::t('Signup') : I18n::t('Update'), ['class' => 'submit_bt']);
?>
        </div>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Пример #13
0
 /**
  * Creates a new PurchaseOrder model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $username = Yii::$app->user->identity ? Yii::$app->user->identity->username : null;
     $model = new PurchaseOrder();
     if (Yii::$app->request->isPost) {
         if (is_object($cart = Yii::$app->session->get('cart'))) {
             if ($cart->totalQuantity() > 0) {
                 if ($model = PurchaseOrder::create(Yii::$app->request->post())) {
                     //                        if ($model->customer_id !== null) {
                     $customer = Customer::findOne(['id' => $model->customer_id, 'status' => Customer::STATUS_ACTIVE]);
                     //                        }
                     foreach ($cart->data as $item) {
                         $p = $item['product'];
                         $qty = $item['quantity'];
                         if (PurchaseOrderDetail::create(['PurchaseOrderDetail' => ['purchase_order_id' => $model->id, 'product_id' => $p->id, 'product_name' => $p->t('name'), 'product_code' => $p->code, 'quantity' => $qty, 'unit_price' => $p->price, 'discount_percent' => round(100 * ($p->original_price - $p->price) / $p->original_price, 4), 'is_offer' => $p->original_price > $p->price ? 1 : 0]]) !== false) {
                             if ($customer) {
                                 $customer->total_purchase_products += $qty;
                                 $customer->total_purchase_value += $qty * $p->price;
                             }
                             $p->available_quantity -= $qty;
                             $p->order_quantity += $qty;
                             //                                $p->total_revenue += $qty * $p->price;
                             $p->save();
                         }
                     }
                     if ($customer) {
                         $customer->total_purchase_orders++;
                         $customer->save(false);
                     }
                     try {
                         Yii::$app->orderMailer->compose(['html' => 'purchaseOrderReview-html', 'text' => 'purchaseOrderReview-text'], ['purchase_order' => $model])->setFrom([Yii::$app->params['order_email'] => Yii::$app->name])->setTo($model->customer_email)->setSubject(I18n::t('Purchase order review'))->send();
                     } catch (Exception $e) {
                     }
                     Yii::$app->session->set('cart', new Cart());
                     $model = new PurchaseOrder();
                     Yii::$app->session->setFlash('success', I18n::t('Your purchase order submitted successfully') . '. ' . I18n::t('Thank you'));
                     //                        $this->goHome();
                 } else {
                     Yii::$app->session->setFlash('error', I18n::t('Some errors occurred') . '. ' . I18n::t('Please try again') . '.');
                 }
             } else {
                 Yii::$app->session->setFlash('error', I18n::t('Your cart is empty') . '. ' . I18n::t('Please try again') . '.');
             }
         } else {
             Yii::$app->session->setFlash('error', I18n::t('Some errors occurred') . '. ' . I18n::t('Please try again') . '.');
         }
     }
     return $this->render('create', ['username' => $username, 'model' => $model]);
 }
Пример #14
0
//            console.log(cart[0]);
            
            var count = 0;
            if (cart.length > 0) {
                notify = "<tbody>";
                for (i = 0; i < cart.length; i++) {
                    count += parseInt(cart[i].quantity);
                    notify  += "<tr>"
                            + "<td><img src=\\"" + cart[i].product.image + "\\" title=\\"" + cart[i].product.name + "\\" alt=\\"" + cart[i].product.name + "\\"></td>"
                            + "<td>" + cart[i].product.name + "</td>"
                            + "<td><b>" + cart[i].quantity + "</b></td>"
                            + "</tr>";
                }
                notify += "</tbody>";
            } else {
                notify = "<caption>' . I18n::t('Your cart is empty') . '</caption>";
            }
            
            $("#cartCount").html(count);
            $("#cartNotify").children("table").html(notify);
            
            push_notify = typeof push_notify !== "undefined" ? push_notify : true;
            if (push_notify) {
                $("#cartNotify").show();
            }
        }
    ).fail(function(jqXHR, textStatus, errorThrown){});    
}

/*-- Menu --*/
var showed = false;
Пример #15
0
 /**
  * Resets password.
  *
  * @param string $token
  * @return mixed
  * @throws BadRequestHttpException
  */
 public function actionResetPassword($token)
 {
     try {
         $model = new ResetPasswordForm($token);
     } catch (InvalidParamException $e) {
         throw new BadRequestHttpException($e->getMessage());
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         Yii::$app->session->setFlash('success', I18n::t('New password was saved'));
         if (Yii::$app->getUser()->login($model)) {
             return $this->goHome();
         }
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
Пример #16
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['product_id', 'product_name', 'product_code', 'product_price', 'product_original_price', 'customer_name', 'customer_email', 'created_at', 'captcha'], 'required'], [['product_id', 'product_price', 'product_original_price', 'customer_id', 'customer_phone_number', 'language_id', 'noreply_email_id', 'status'], 'integer'], [['created_at', 'updated_at', 'replied_at'], 'safe'], [['product_name', 'customer_name', 'customer_email', 'updated_by', 'replied_by'], 'string', 'max' => 255], ['customer_email', 'email'], [['product_code', 'zip_postal_code'], 'string', 'max' => 25], [['product_id'], 'unique', 'targetAttribute' => ['product_id', 'customer_email', 'customer_phone_number', 'status'], 'message' => I18n::t('A product following already exists with the same information')], [['captcha'], ReCaptchaValidator::className(), 'secret' => '6Lc6DBkTAAAAAFsBDbc7tTosnHpy7DISPS8rqsZH']];
 }
Пример #17
0
?>
" title="<?php 
echo I18n::t('Policy');
?>
" style="opacity: 0.9;"><?php 
echo I18n::t('Policy');
?>
</a>
                &middot; <a href="<?php 
echo GeneralInfo::getGeneralInfoByType(GeneralInfo::TYPE_CONTACT)->getLink();
?>
" title="<?php 
echo I18n::t('Contact');
?>
" style="opacity: 0.9;"><?php 
echo I18n::t('Contact');
?>
</a>
            </span>
        </div>
        <div style="float:left;width:25%;font-size:0.96em">
            <!--<div id="languageArea">-->
                <?php 
echo LanguagePicker::widget(['skin' => LanguagePicker::SKIN_BUTTON, 'size' => LanguagePicker::SIZE_SMALL, 'itemTemplate' => '<a style="white-space:nowrap" href="{link}" title="{language}"><i class="{language}"></i> {name}</a>', 'activeItemTemplate' => '<a style="white-space:nowrap" href="{link}" title="{language}" class="active"><i class="{language}"></i> {name}</a>', 'parentTemplate' => '<div style="float:right" class="language-picker button-list {size}"><div>{items}</div></div>', 'languageAsset' => 'lajax\\languagepicker\\bundles\\LanguageSmallIconsAsset', 'languagePluginAsset' => 'lajax\\languagepicker\\bundles\\LanguagePluginAsset']);
?>
                <?php 
/* echo yii\helpers\Html::dropDownList(
           'languages', // input name
           Yii::$app->language, // value
           frontend\models\Language::getLanguages_codeToLabel(), // option
           [
Пример #18
0
$this->title = 'Purchase Order Details';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="purchase-order-detail-index">

<!--    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
    <?php 
echo Html::a('Create Purchase Order Detail', ['create'], ['class' => 'btn btn-success']);
?>
    </p>-->

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'product_name', 'format' => 'raw', 'value' => function ($model) {
    return Html::a($model->product_name, ['product/update', 'id' => $model->product_id], []);
}], 'product_code', ['attribute' => 'unit_price', 'format' => 'raw', 'value' => function ($model) {
    return I18n::currency($model->unit_price);
}], 'quantity', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<button class="btn btn-default btn-sm glyphicon glyphicon-eye-open"></button>', $url);
}]]]]);
?>

</div>
Пример #19
0
use yii\data\ActiveDataProvider;
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\DetailView;
/* @var $this View */
/* @var $searchModel CustomerSearch */
/* @var $dataProvider ActiveDataProvider */
$this->title = $model->username;
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="customer-index form_container">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <br>
    <?php 
echo Html::a(I18n::t('Update'), ['customer/update', 'username' => $model->username], ['class' => 'submit_bt']);
?>
    <?php 
echo Html::a(I18n::t('Logout'), ['site/logout'], ['class' => 'submit_bt', 'style' => 'background:#ddd']);
?>
    <br>
    <br>
    <?php 
echo DetailView::widget(['model' => $model, 'options' => ['style' => 'text-align:left'], 'attributes' => ['username', 'firstname', 'lastname', 'email:email', 'phone_number', 'address', ['attribute' => 'dob', 'value' => date('d-m-Y', $model->dob)], ['attribute' => 'gender', 'value' => $model->gender === 1 ? I18n::t('Male') : ($model->gender === 2 ? I18n::t('Female') : I18n::t('Other'))], ['attribute' => 'created_at', 'value' => date('d-m-Y H:i', $model->created_at)], ['attribute' => 'updated_at', 'value' => date('d-m-Y H:i', $model->created_at)], 'total_purchase_orders', 'total_purchase_products', 'total_purchase_value', ['attribute' => 'total_purchase_value', 'value' => I18n::currency($model->total_purchase_value)]]]);
?>
    
</div>
Пример #20
0
use common\models\I18n;
use yii\helpers\Url;
echo $this->render('//layouts/sort');
?>
<div id="products">
<?php 
echo $this->render('//product/items', ['products' => $products, 'offset' => 0]);
?>
</div>
<div class="clr"></div>
<?php 
if ($nextProductsNumber > 0) {
    ?>
<button id="seemore"><?php 
    echo I18n::t('See more');
    ?>
</button>
<?php 
}
$this->registerJs('
$("#seemore").click(function(){
    $.post(
        "' . Url::to(['search/product-items'], true) . '",
        {
            ' . Yii::$app->request->csrfParam . ' : "' . Yii::$app->request->csrfToken . '",
            q: "' . $q . '",
            orderBy: "' . $orderBy . '"
        },
        function(data, textStatus, jqXHR){
            var objData = JSON.parse(data);
Пример #21
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => 'ID', 'transaction_id' => I18n::t('Transaction ID'), 'status' => I18n::t('Status'), 'language_id' => I18n::t('Language'), 'customer_id' => 'Customer ID', 'customer_name' => I18n::t('Full name'), 'customer_email' => I18n::t('Email'), 'customer_phone_number' => I18n::t('Phone number'), 'customer_address' => I18n::t('Address'), 'customer_city' => I18n::t('City'), 'customer_country' => I18n::t('Country'), 'country_calling_code' => 'Country Calling Code', 'zip_postal_code' => 'Zip Postal Code', 'delivery_to' => I18n::t('Delivery to'), 'shipping_fee' => I18n::t('Shipping fee'), 'payment_method' => 'Payment Method', 'customer_note' => I18n::t('Note'), 'user_note' => 'User Note'];
 }
Пример #22
0
}
?>

    <div class="row">
        <div class="col-lg-5">
            <?php 
$form = ActiveForm::begin(['id' => 'request-password-reset-form']);
?>

                <?php 
echo $form->field($model, 'email');
?>

                <?php 
echo $form->field($model, 'captcha')->widget(\himiklab\yii2\recaptcha\ReCaptcha::className(), ['siteKey' => '6Lc6DBkTAAAAAMawyuTjwL1Ut0sMHVlBKvpkImZ3'])->label(false);
?>
            
            
                <div class="form-group">
                    <?php 
echo Html::submitButton(I18n::t('Submit'), ['name' => 'login-button', 'class' => 'submit_bt']);
?>
                </div>

            <?php 
ActiveForm::end();
?>
        </div>
    </div>
</div>
Пример #23
0
 public function currency($column)
 {
     return \common\models\I18n::currency($this->{$column});
 }
Пример #24
0
}
?>
        </tbody>
        <tfoot style="background:#fff">
            <tr>
                <td colspan="2"><?php 
echo I18n::t('Total amount');
?>
</td>
                <td colspan="2"><strong><?php 
echo I18n::currency($total_value);
?>
</strong></td>
            </tr>
        </tfoot>
    </table>
    <p><?php 
echo I18n::t('Thank you for your purchase');
?>
</p>
    <p><?php 
echo Html::a(Html::encode($homeLink), $homeLink);
?>
</p>
    <p><?php 
echo I18n::t('{email signature}');
?>
</p>

</div>
Пример #25
0
 /**
  * Updates an existing Customer model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate()
 {
     if (Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $username = Yii::$app->user->identity->username;
     if ($model = Customer::findOne(['username' => $username])) {
         $model->scenario = 'update';
         if (Yii::$app->request->isPost && $model->update2(Yii::$app->request->post())) {
             Yii::$app->session->setFlash('success', I18n::t('Your account updated successfully'));
             return $this->redirect(['index', 'username' => $username]);
         } else {
             return $this->render('update', ['model' => $model]);
         }
     } else {
         throw new NotFoundHttpException();
     }
 }
Пример #26
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => 'ID', 'username' => I18n::t('Username'), 'password' => I18n::t('Password'), 'confirm_password' => I18n::t('Confirm password'), 'new_password' => I18n::t('New password'), 'confirm_new_password' => I18n::t('Confirm new password'), 'password_hash' => 'Password Hash', 'password_reset_token' => 'Password Reset Token', 'auth_key' => 'Auth Key', 'email' => I18n::t('Email'), 'phone_number' => I18n::t('Phone number'), 'address' => I18n::t('Address'), 'firstname' => I18n::t('First name'), 'lastname' => I18n::t('Last name'), 'dob' => I18n::t('Date of birth'), 'gender' => I18n::t('Gender'), 'image' => 'Image', 'image_path' => 'Image Path', 'language_id' => I18n::t('Language'), 'zip_postal_code' => 'Zip Postal Code', 'is_active' => 'Is Active', 'status' => 'Status', 'created_at' => I18n::t('Created at'), 'updated_at' => I18n::t('Updated at'), 'total_purchase_orders' => I18n::t('Total purchase orders'), 'total_purchase_products' => I18n::t('Total purchase products'), 'total_purchase_value' => I18n::t('Total purchase value'), 'captcha' => I18n::t('Captcha')];
 }
Пример #27
0
use yii\web\View;
use yii\widgets\DetailView;
/* @var $this View */
/* @var $model PurchaseOrderDetail */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Purchase Order Details', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="purchase-order-detail-view">

    <!--<h1><?php 
echo Html::encode($this->title);
?>
</h1>-->

    <p class="pull-right">
        <?php 
echo Html::a('<span class="fa fa-edit"></span> Ghi chú', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
   <!-- <?php 
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
 -->
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['product_name', 'product_code', ['attribute' => 'unit_price', 'value' => I18n::currency($model->unit_price)], 'quantity', 'customer_note', 'user_note']]);
?>

</div>
Пример #28
0
                </table>
            </fieldset>
            <fieldset>
                <!--<input type="hidden" name="<?php 
    echo Yii::$app->request->csrfParam;
    ?>
" value="<?php 
    echo Yii::$app->request->csrfToken;
    ?>
">-->
                <!--<button type="submit" name="checkout_submit"><?php 
    echo I18n::t('Next step');
    ?>
</button>-->
                <?php 
    echo Html::a(I18n::t('Next step'), ['purchase-order/create'], ['class' => 'submit_bt', 'type' => 'button', 'style' => 'margin:0 auto;display:table']);
    ?>
            </fieldset>
        </form>
        <?php 
} else {
}
?>
</div>


<?php 
$this->registerJs('
/*-- Add To Cart --*/
$(".add_to_cart_bt").click(function(){
    o = $(this).parent().children("input");
Пример #29
0
             product_name: "' . $product->t('name') . '",
             product_code: "' . $product->code . '",
             product_price: "' . $product->price . '",
             product_original_price: "' . $product->original_price . '",
             customer_id: ' . (!Yii::$app->user->isGuest ? Yii::$app->user->identity->id : 0) . ',
             customer_name: form.children("input[name=customer_name]").val(),
             customer_email: form.children("input[name=customer_email]").val(),
             customer_phone_number: form.children("input[name=customer_phone_number]").val(),
             language_id: ' . Yii::$app->session->get('language_id') . '
         }
     },
     function(data, textStatus, jqXHR){
         data = JSON.parse(data);
         var repo_alert = "";
         if (data == 1) {
             repo_alert = "<div class=\\"alert success\\">' . I18n::t('Your product following submitted successfully') . '</div>";
             form.slideUp("fast");
         } else if (data instanceof Object){
             repo_alert = "<div class=\\"alert error\\">";
             for (var prop in data) {
                 if(!data.hasOwnProperty(prop)) continue;
                 repo_alert += "- " + data[prop] + "<br>";
             }
             repo_alert += "</div>";
         }
         if (repo_alert != "") {
             form.siblings(".alert_box").html(repo_alert);
         }
     }
 ).fail(function(jqXHR, textStatus, errorThrown){
 });
Пример #30
0
echo Url::current(['sort' => 'rand']);
?>
" title="<?php 
echo I18n::t('Sort by random');
?>
"><?php 
echo I18n::t('Sort by random');
?>
</a> &#124;
        <a href="<?php 
echo Url::current(['sort' => 'price_desc']);
?>
" title="<?php 
echo I18n::t('Sort by price descending');
?>
"><?php 
echo I18n::t('Sort by price descending');
?>
</a> &#124;
        <a href="<?php 
echo Url::current(['sort' => 'price_asc']);
?>
" title="<?php 
echo I18n::t('Sort by price ascending');
?>
"><?php 
echo I18n::t('Sort by price ascending');
?>
</a>
    </div>
</div>