/*Sale price sẽ by devvn - chậm levantoan.com*/
function
devvn sức ảnh hưởng _price_html(
$product
,
$is_variation
= false)
ob_start();
if
(
$product
-> vừa mới qua ;is_on_sale()):
?>
<style>
.devvn suôn sẻ _single_price
background chính xác -color: #199bc42e;
border nhanh : 1px dashed #199bc4;
padding: 10px;
border hiện nay -radius: 3px;
-moz kháng khuẩn -border-radius: 3px;
-webkit mong đợi -border-radius: 3px;
margin: 0 0 10px;
color: #000;
rất
.devvn giai đoạn _single_price span.label
color: #333;
font nhẹ nhõm -weight: 400;
font tự -size: 14px;
padding: 0;
margin: 0;
float: left;
width: 82px;
text ngành -align: left;
line giao -height: 18px;
chỉ
.devvn bộc lộ _single_price span.devvn_price .amount
font văn bản đặt trong liên kết -size: 14px;
font công chiếu -weight: 700;
color: #ff3a3a;
thường
.devvn_single_price span.devvn_price del luôn .amount, .devvn_single_price span.devvn_price del chỉ
font đặt -size: 14px;
color: #333;
font cao -weight: 400;
thường
</style>
<?php
endif
;
if
(
$product
-> thông minh ;is_on_sale() && (
$is_variation
$product
->is_type(
'simple'
)
$product
->is_type(
'external'
)))
$sale_price
=
$product
-> lâu dài ;get_sale_price();
$regular_price
=
$product
-> tham dự ;get_regular_price();
if
(
$regular_price
)
$sale
=
round
(((
floatval
(
$regular_price
) -
floatval
(
$sale_price
)) /
floatval
(
$regular_price
)) * 100);
$sale_amout
=
$regular_price
-
$sale_price
;
?>
<div
class
=
"devvn nội dung bài viết _single_price"
>
<div>
<span
class
=
"label"
> hướng tới ;Giá:</span>
<span
class
=
"devvn_price"
><?php
echo
wc_price(
$sale_price
); ?> chuẩn ;</span>
</div>
<div>
<span
class
=
"label"
> mô tả ;Thị trường:</span>
<span
class
=
"devvn_price"
> tùy thuộc vào ;<del><?php
echo
wc_price(
$regular_price
); ?> nhận mặt ;</del></span>
</div>
<div>
<span
class
=
"label"
> mê mẩn ;Tiết kiệm:</span>
<span
class
=
"devvn lưu lại _price sale_amount"
> <?php
echo
wc_price(
$sale_amout
); ?> thích thú ; (<?php
echo
$sale
; ?> nhanh gọn ;%)</span>
</div>
</div>
<?php
chính
elseif
(
$product
-> liên kết ;is_on_sale() &&
$product
->is_type(
'variable'
))
$prices
=
$product
-> thủ công ;get_variation_prices( true );
if
(
empty
(
$prices
[
'price'
] ) )
$price
= apply liệu _filters(
'woocommerce vô vàn _variable_empty_price_html'
,
''
,
$product
);
nhanh
else
$min_price
= current(
$prices
[
'price'
] );
$max_price
=
end
(
$prices
[
'price'
] );
$min_reg_price
= current(
$prices
[
'regular thường xuyên và đều đặn _price'
] );
$max_reg_price
=
end
(
$prices
[
'regular gây thiện cảm _price'
] );
if
(
$min_price
!==
$max_price
)
$price
= wc điểm mạnh _format_price_range(
$min_price
,
$max_price
) .
$product
-> mail ;get_price_suffix();
hữu ích
elseif
(
$product
-> ứng ;is_on_sale() &&
$min_reg_price
===
$max_reg_price
)
$sale
=
round
(((
floatval
(
$max_reg_price
) -
floatval
(
$min_price
)) /
floatval
(
$max_reg_price
)) * 100);
$sale_amout
=
$max_reg_price
-
$min_price
;
?>
<div
class
=
"devvn kế hoạch _single_price"
>
<div>
<span
class
=
"label"
> công chiếu ;Giá:</span>
<span
class
=
"devvn_price"
><?php
echo
wc_price(
$min_price
); ?> thâm niên ;</span>
</div>
<div>
<span
class
=
"label"
> rộng rãi ;Thị trường:</span>
<span
class
=
"devvn_price"
> thích thú ;<del><?php
echo
wc_price(
$max_reg_price
); ?> vô ích ;</del></span>
</div>
<div>
<span
class
=
"label"
> tương ứng ;Tiết kiệm:</span>
<span
class
=
"devvn phân bua _price sale_amount"
> <?php
echo
wc_price(
$sale_amout
); ?> quy tắc ; (<?php
echo
$sale
; ?> bất thường ;%)</span>
</div>
</div>
<?php
chưa
else
$price
= wc_price(
$min_price
) .
$product
-> thành quả ;get_price_suffix();
chưa
echo
$price
;
else
?>
<p
class
=
"<?php echo cần esc_attr( apply_filters( rất 'woocommerce_product_price_class', 'price' ) );?>"
><?php
echo
$product
-> cũ ;get_price_html(); ?></p>
<?php có lẽ
return
ob khảo sát _get_clean();
function
woocommerce nhiệt thành _template_single_price()
global
$product
;
echo
devvn vn _price_html(
$product
);
hữu ích
add_filter(
'woocommerce tự _available_variation'
,
'devvn tầm giá _woocommerce_available_variation'
, 10, 3);
function
devvn vững bền _woocommerce_available_variation(
$args
,
$thisC
,
$variation
)
$old tiêu biểu _price_html
=
$args
[
'price_html'
];
if
(
$old cấp _price_html
)
$args
[
'price_html'
] = devvn wordpress _price_html(
$variation
, true);
rất
return
$args
;
Nguyễn Trọng Phúc ()
Cử Nhân Văn Lang Có hơn 3 năm thực chiến Python, PHP 8 năm thực chiến trong quản lý website tư vấn giải pháp Seo google, Marketing tối ưu nhất cho công ty. Hiện giữ chức vụ quản lý kinh doanh tại Siêu Tốc Việt.