提交 47a38647 编写于 作者: T Terry

一些小调整

上级 2c077a6c
......@@ -39,7 +39,7 @@ $(document).ready(function(){
logoutStr = $('.logoutStr').val();
if(data.loginStatus){
customer_name = data.customer_name;
str = '<span id="welcome">'+welcome+' '+customer_name+',</span>';
str = '<span id="welcome">'+welcome+' '+customer_name+'</span>';
str += '<span id="js_isNotLogin">';
str += '<a href="'+logoutUrl+'" rel="nofollow">'+logoutStr+'</a>';
str += '</span>';
......
......@@ -42,6 +42,9 @@
<ul>
<?php endif; ?>
<li>
<div style="display:none">
<?= $currentOff = Yii::$service->product->price->currentOff; // 通过这个函数也可以得到特价折扣值 OFF ?>
</div>
<div class="c_img">
<a href="<?= $product['url'] ?>">
<img class="js_lazy" src="<?= Yii::$service->image->getImgUrl('images/lazyload.gif'); ?>" data-original="<?= Yii::$service->product->image->getResize($product['image'],[230,230],false) ?>" />
......
......@@ -217,7 +217,7 @@ class Quote extends Service
protected function actionClearCart()
{
//Yii::$service->session->remove(self::SESSION_CART_ID);
Yii::$service->cart->quoteItem->removeNoActiveItems();
Yii::$service->cart->quoteItem->removeNoActiveItemsByCartId();
}
/**
......
......@@ -418,7 +418,6 @@ class QuoteItem extends Service
$active = $this->activeStatus;
}
$updateCount = $this->_itemModel->updateAll(
['active' => $active],
['cart_id' => $cart_id]
);
......@@ -444,8 +443,6 @@ class QuoteItem extends Service
if (!$cart_id) {
$cart_id = Yii::$service->cart->quote->getCartId();
}
echo 2;
echo $cart_id;
if ($cart_id) {
$columns = $this->_itemModel->deleteAll([
'cart_id' => $cart_id,
......
......@@ -27,7 +27,11 @@ class Price extends Service
public $ifSpecialPriceGtPriceFinalPriceEqPrice;
protected $_currencyInfo;
// 执行函数 getCurrentCurrencyProductPriceInfo,会将折扣数保存到 currentOff 中,
// 您可以通过 Yii::$service->product->price->currentOff 直接获取。
public $currentOff = 0;
/**
* @property $price | Float 产品的价格
* 得到当前货币状态下的产品的价格信息。
......@@ -268,6 +272,7 @@ class Price extends Service
*/
protected function actionGetCurrentCurrencyProductPriceInfo($price, $special_price, $special_from, $special_to)
{
$this->currentOff = 0;
$price_info = $this->formatPrice($price);
$return['price'] = [
'symbol' => $price_info['symbol'],
......@@ -278,12 +283,16 @@ class Price extends Service
if ($specialIsActive) {
$special_price_info = Yii::$service->product->price->formatPrice($special_price);
$return['special_price'] = [
'symbol' => $special_price_info['symbol'],
'value' => $special_price_info['value'],
'code' => $special_price_info['code'],
'symbol' => $special_price_info['symbol'],
'value' => $special_price_info['value'],
'code' => $special_price_info['code'],
];
$off = ($price_info['value'] - $special_price_info['value'] ) / $price_info['value'];
$this->currentOff = round($off * 100);
}
return $return;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册