public function run() { $cart = Yii::app()->cart; $currency = Yii::app()->currency->active; $items = $cart->getDataWithModels(); $total = ShopProduct::formatPrice(Yii::app()->currency->convert($cart->getTotalPrice())); $this->render($this->skin, array('count' => $cart->countItems(), 'currency' => $currency, 'total' => $total, 'items' => $items)); }
/** * Sum orders total price * * @return string */ public function getOrdersTotalPrice() { $total = 0; foreach ($this->getTodayOrders()->getData() as $order) { $total += $order->full_price; } return ShopProduct::formatPrice($total); }
protected function replace($model, $content) { if ($model instanceof Order) { $array['%ORDER_ID%'] = $model->id; $array['%ORDER_KEY%'] = $model->secret_key; $array['%TOTAL_PRICE%'] = ShopProduct::formatPrice(Yii::app()->currency->convert($model->full_price)); $array['%USER_NAME%'] = $model->user_name; $array['%USER_PHONE%'] = $model->user_phone; $array['%USER_EMAIL%'] = $model->user_email; $array['%USER_ADDRESS%'] = $model->user_address; $array['%ORDER_URL%'] = $model->getAbsoluteUrl(); } $array['%CURRENT_CURRENCY%'] = Yii::app()->currency->active->symbol; return CMS::textReplace($content, $array); }
?> </p> <p><?php echo $payment->renderPaymentForm($model); ?> </p> <?php } ?> <?php echo Yii::t('CartModule.default', 'TOTAL_PAY'); ?> : <span class="label label-success"><?php echo ShopProduct::formatPrice(Yii::app()->currency->convert($model->full_price)); ?> </span> <?php echo Yii::app()->currency->active->symbol; ?> </div> </div> </div> <div class="col-md-4"> <div class="panel panel-default"> <div class="panel-heading"><h4><?php echo Yii::t('CartModule.default', 'Состояние заказа'); ?> <span class="label fr label-default" style=""><?php
public function ajaxRecount($data) { if (!is_array($data) || empty($data)) { return; } $currentData = $this->getData(); foreach ($data as $index => $quantity) { if ((int) $quantity < 1) { $quantity = 1; } if (isset($currentData[$index])) { $currentData[$index]['quantity'] = (int) $quantity; $data = $currentData[$index]; //print_r($currentData[$index]);die; if ($data['configurable_id']) { $productModel = ShopProduct::model()->findByPk($index); $rowTotal = $data['quantity'] * ShopProduct::calculatePrices($productModel, $data['variants'], $data['configurable_id']); } else { if (Yii::app()->settings->get('shop', 'wholesale')) { $rowTotal = $data['quantity'] * $data['pcs'] * $data['price']; } else { $rowTotal = $data['quantity'] * $data['price']; } } } } $this->session['cart_data'] = $currentData; echo CJSON::encode(array('rowTotal' => ShopProduct::formatPrice(Yii::app()->currency->convert($rowTotal)), 'totalPrice' => ShopProduct::formatPrice(Yii::app()->currency->convert(Yii::app()->cart->getTotalPrice())))); }
protected function replace($order, $list, $content) { $replace = array('%ORDER_ID%', '%ORDER_KEY%', '%ORDER_DELIVERY_NAME%', '%ORDER_PAYMENT_NAME%', '%TOTAL_PRICE%', '%USER_NAME%', '%USER_PHONE%', '%USER_EMAIL%', '%USER_ADDRESS%', '%USER_COMMENT%', '%CURRENT_CURRENCY%', '%FOR_PAYMENY%', '%LIST%', '%LINK_TO_ORDER%'); $to = array($order->id, $order->secret_key, $order->deliveryMethod->name, $order->paymentMethod->name, $order->total_price, $order->user_name, $order->user_phone, $order->user_email, $order->user_address, isset($order->user_comment) ? $order->user_comment : '', Yii::app()->currency->active->symbol, ShopProduct::formatPrice($order->total_price + $order->delivery_price), $list, Html::link($this->createAbsoluteUrl('view', array('secret_key' => $order->secret_key)), $this->createAbsoluteUrl('view', array('secret_key' => $order->secret_key)))); return CMS::textReplace($content, $replace, $to); }
?> </div> <?php } ?> </div> <div class="col-md-7"> <h3><?php echo Html::encode($model->name); ?> </h3> <div class="price"> <span id="productPrice"> <?php echo ShopProduct::formatPrice($model->toCurrentCurrency()); ?> </span> <?php echo Yii::app()->currency->active->symbol; ?> </div> <?php if (Yii::app()->hasModule('discounts')) { if ($model->appliedDiscount) { echo '<span style="color:red; "><s>' . $model->toCurrentCurrency('originalPrice') . '</s></span>'; } } ?> <div class="actions row">
echo Html::link(Html::image($imgSource, ''), $product['model']->mainImage->getUrl($thumbSize), array('class' => 'thumbnail')); } else { $imgSource = 'http://placehold.it/' . $thumbSize; echo Html::link(Html::image($imgSource, ''), '#', array('class' => 'thumbnail')); } ?> <div class="info"><?php echo $product['model']['name']; ?> <br> <?php echo Html::openTag('span', array('class' => 'price')); echo Html::openTag('span', array('class' => 'pn')); echo ShopProduct::formatPrice(Yii::app()->currency->convert($price * $product['quantity'])); echo Html::closeTag('span'); echo ' ' . Yii::app()->currency->active->symbol; echo ' (x' . $product['quantity'] . ')'; //echo ' '.($product['currency_id']) ? Yii::app()->currency->getSymbol($product['currency_id']) : Yii::app()->currency->active->symbol; echo Html::closeTag('span'); echo Html::link('x', 'javascript:shop.removeCart(' . $index . ')', array('class' => 'remove')); ?> </div> <div class="clear"></div> </div> <?php } ?> <div class="button-container"><a href="/cart" class="button btn-small btn-green">Оформить заказ</a></div>
$this->renderPartial('_fields_delivery', array('form' => $this->form, 'deliveryMethods' => $deliveryMethods)); $this->renderPartial('_fields_payment', array('form' => $this->form, 'paymenyMethods' => $paymenyMethods)); ?> </div> </div> </div> <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> <div class="panel panel-default"> <div class="panel-heading">dsadsadsa</div> <div class="panel-body"> <div class="cart-grand-total"> Сумма заказа <span id="total"><?php echo ShopProduct::formatPrice($totalPrice); ?> </span> <?php echo Yii::app()->currency->active->symbol; ?> </div> <div id="cart-check" class="text-center padding-tb"> <div style="font-size:14px"><?php echo Yii::t('CartModule.default', 'PAYMENT'); ?> :</div> <div id="payment" style="font-size:14px;margin-bottom:20px;font-weight:bold">---</div> <div style="font-size:14px"><?php echo Yii::t('CartModule.default', 'DELIVERY'); ?> :</div>
/** * Get ordered products in json format. * Result is displayed in the orders list. */ public function actionJsonOrderedProducts() { $model = $this->_loadModel(Yii::app()->request->getQuery('id')); $data = array(); foreach ($model->getOrderedProducts()->getData() as $product) { $data[] = array('name' => $product->renderFullName, 'quantity' => $product->quantity, 'price' => ShopProduct::formatPrice($product->price)); } echo CJSON::encode($data); }
</span> </li> <li class="list-group-item"> <?php echo Yii::t('CartModule.admin', 'Сумма товаров'); ?> <span class="pull-right label label-lg label-info"><?php echo ShopProduct::formatPrice($model->total_price); ?> <?php echo Yii::app()->currency->main->symbol; ?> </span> </li> <?php } ?> <li class="list-group-item"><b><?php echo Yii::t('CartModule.admin', 'FOR_PAYMENT'); ?> </b> <span class="pull-right label label-lg label-success"><?php echo ShopProduct::formatPrice($model->full_price); ?> <?php echo Yii::app()->currency->main->symbol; ?> </span></li> </ul>