提交 ff83eb60 编写于 作者: R root

支付部分的优惠券和运费部分代码

上级 1b5f840a
......@@ -5,29 +5,61 @@ use Yii;
use fec\helpers\CModule;
use fec\helpers\CRequest;
class Index {
protected $_payment_mothod;
public function getLastData(){
$currency_info = Yii::$service->page->currency->getCurrencyInfo();
return [
'payments' => $this->getPayment(),
'shippings' => $this->getShippings(),
'current_payment_mothod' => $this->_payment_mothod,
'cart_info' => $this->getCartInfo(),
'currency_info' => $currency_info,
];
}
public function getCartInfo(){
$cart_info = Yii::$service->cart->getCartInfo();
if(isset($cart_info['products']) && is_array($cart_info['products'])){
foreach($cart_info['products'] as $k=>$product_one){
# 设置名字,得到当前store的语言名字。
$cart_info['products'][$k]['name'] = Yii::$service->store->getStoreAttrVal($product_one['product_name'],'name');
# 设置图片
if(isset($product_one['product_image']['main']['image'])){
$cart_info['products'][$k]['image'] = $product_one['product_image']['main']['image'];
}
# 产品的url
$cart_info['products'][$k]['url'] = Yii::$service->url->getUrl($product_one['product_url']);
$custom_option = isset($product_one['custom_option']) ? $product_one['custom_option'] : '';
$custom_option_sku = $product_one['custom_option_sku'];
# 将在产品页面选择的颜色尺码等属性显示出来。
//$custom_option_info_arr = $this->getProductOptions($product_one,$custom_option_sku);
//$cart_info['products'][$k]['custom_option_info'] = $custom_option_info_arr;
# 设置相应的custom option 对应的图片
$custom_option_image = isset($custom_option[$custom_option_sku]['image']) ? $custom_option[$custom_option_sku]['image'] : '';
if($custom_option_image){
$cart_info['products'][$k]['image'] = $custom_option_image;
}
}
}
return $cart_info;
}
public function getShippings(){
$country = Yii::$service->helper->country->getDefaultCountry();
$cartInfo = Yii::$service->cart->quoteItem->getCartProductInfo();
$product_weight = $cartInfo['product_weight'];
$shipping_method = Yii::$service->shipping->getDefaultShipping();
# 传递当前的货运方式,这个需要从cart中选取,
# 如果cart中没有shipping_method,那么该值为空
$current_shipping_method = '';
$region='*';
$shippingArr = $this->getShippingArr($product_weight,$shipping_method,$country,$region);
$shippingArr = $this->getShippingArr($product_weight,$current_shipping_method,$country,$region);
return $shippingArr ;
}
......@@ -52,15 +84,15 @@ class Index {
* @return String , 通过上面的三个参数,得到各个运费方式对应的运费。
* 最后生成html
*/
public function getShippingArr($weight,$shipping_method,$country,$region='*'){
$shippingName = '';
$now_shipping = $shipping_method;
if($now_shipping){
$shippingName = $now_shipping;
}
if(!$shippingName){
$shippingName = Yii::$service->shipping->getDefaultShipping();
}
public function getShippingArr($weight,$current_shipping_method,$country,$region='*'){
//$shippingName = '';
//$now_shipping = $shipping_method;
//if($now_shipping){
// $shippingName = $now_shipping;
//}
//if(!$shippingName){
// $shippingName = Yii::$service->shipping->getDefaultShipping();
//}
$allshipping = Yii::$service->shipping->getShippingMethod();
$sr = '';
$shipping_i = 1;
......@@ -74,7 +106,7 @@ class Index {
//var_dump($cost);
$currentCurrencyCost = $cost['currentCost'];
$symbol = Yii::$service->page->currency->getCurrentSymbol();
if($shippingName == $method){
if($current_shipping_method == $method){
$check = ' checked="checked" ';
}else{
$check = '';
......
......@@ -1498,7 +1498,7 @@ button.redBtn:focus , button.redBtn:active {
border-width: 0 1px;
}
td:nth-child(2n) {
background: #f7f7f7 none repeat scroll 0 0;
background: #fefefe none repeat scroll 0 0;
}
.data-table td {
border: 1px solid #ddd;
......
<?php
use fecshop\app\appfront\helper\Format;
?>
<?php $cart_info = $parentThis['cart_info']; ?>
<?php $currency_info = $parentThis['currency_info']; ?>
<?php if(is_array( $cart_info) && !empty( $cart_info)){ ?>
<?php $products = $cart_info['products'] ?>
<p class="onestepcheckout-numbers onestepcheckout-numbers-4">Review your order</p>
<div class="onestepcheckout-summary">
<table class="onestepcheckout-summary">
<thead>
<tr>
<th class="name">Product</th>
<th class="image"></th>
<th class="name">name</th>
<th class="qty">Qty</th>
<th class="total">Subtotal</th>
</tr>
</thead>
<tbody>
<?php foreach($products as $product){ ?>
<tr>
<td class="name"><a target="_blank" href="http://www.intosmile.com/classic-style-solid-color-lace-up-round-toe-flat-boots-for-women.html">Classic Style Solid Color Lace-up Round Toe Flat Boots For Women</a></td>
<td class="qty">1</td>
<td class="total"><span class="price">$35.00</span></td>
</tr> </tbody>
<td class='image'>
<a href="<?= $product['url'] ?>" title="<?= $product['name'] ?>" class="product-image">
<img src="<?= Yii::$service->product->image->getResize($product['image'],[100,100],false) ?>" alt="2121" width="75" height="75">
</a>
</td>
<td class="name">
<a href="<?= $product['url'] ?>" title="<?= $product['name'] ?>" class="product-image">
<?= $product['name'] ?>
</a>
</td>
<td class="qty"><?= $product['qty']; ?></td>
<td class="total"><span class="price"><?= $currency_info['symbol']; ?><?= Format::price($product['product_row_price']); ?></span></td>
</tr>
<?php } ?>
</tbody>
</table>
<table class="onestepcheckout-totals">
......@@ -21,25 +42,25 @@
<tr>
<td class="title">Subtotal</td>
<td class="value">
<span class="price">$35.00</span>
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['product_total']); ?></span>
</td>
</tr>
<tr>
<td class="title">Shipping</td>
<td class="value">
<span class="price">$0.00</span>
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['shipping_cost']); ?></span>
</td>
</tr>
<tr>
<td class="title">Discount</td>
<td class="value">
<span class="price">-$0.00</span>
<span class="price">-<?= $currency_info['symbol']; ?><?= Format::price($cart_info['coupon_cost']); ?></span>
</td>
</tr>
<tr class="grand-total">
<td class="title">Grand total</td>
<td class="value">
<span class="price">$35.00</span>
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['grand_total']) ?></span>
</td>
</tr> </tbody>
</table>
......@@ -47,4 +68,5 @@
<div class="onestepcheckout-place-order">
<span><img src="http://www.intosmile.com/skin/default/images/scroll/waitPage.gif"></span>
<a class="large orange onestepcheckout-button" href="javascript:void(0)" id="onestepcheckout-place-order">Place order now</a>
</div>
\ No newline at end of file
</div>
<?php } ?>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册