更新价格标签生成

hotfix/paypal-note
Jimmy Liow 2 years ago
parent 79a46fd76e
commit d8100905c9

@ -997,9 +997,9 @@ class Information extends CI_Controller
public function test_price()
{
$price_rule = '#ah-8,st,2#';//'#'.$meta_product_code.',st,2#';
$tag_price = $this->replace_price_tag($price_rule);
echo 'Price: '.$tag_price;
$price_rule = '<div style="color: red;">#ah-8,st,2#</div>';
$price_tag_list = $this->parse_price_tag($price_rule);
var_dump($price_tag_list);
}
/*!
@ -1009,9 +1009,10 @@ class Information extends CI_Controller
* @param string $price_content 包含价格标签的内容
* @return string 可读的价格字符串
*/
public function replace_price_tag($price_content)
public function parse_price_tag($price_content)
{
$price_item_array = $this->price_pregmatch($price_content);
$price_tag_list = [];
if ( ! empty($price_item_array)) {
foreach ($price_item_array as $price_item) {
$price_date = !empty($price_item->price_date) ? $price_item->price_date : date('Y-m-d', time() + 86400 * 7); //当前时间7天后的价格
@ -1098,7 +1099,12 @@ class Information extends CI_Controller
//把金额格式化为带有逗号(,)方便阅读,如 12,345
$price_number = is_numeric($price_number) ? number_format($site_money) : $price_number;
if (!empty($price_number)) {
$price_content = str_replace($price_item->placeholder, $price_number, $price_content);
$price_tag = [
'placeholder' => $price_item->placeholder,
'price_number' => $price_item->price_number,
];
$price_tag_list[] = $price_tag;
//$price_content = str_replace($price_item->placeholder, $price_number, $price_content);
}
}
}

@ -93,7 +93,7 @@ class PrimeLinePrice_model extends CI_Model {
$this->cli_grade ? $sql.=$this->cli_grade : false;
$this->orderby ? $sql.=$this->orderby : false;
$query = $this->HT->query($sql,array($DEI_SN,$this->cli_no));
$query = $this->HT->query($sql,array($this->$DEI_SN,$this->cli_no));
if ($this->topnum === 1) {
if ($query->num_rows() > 0) {
$row = $query->row();

Loading…
Cancel
Save