Opencart产品-折扣展示
大家 需要为折扣产品添加标签。 当我将折扣价格添加到产品(admin-product-discount-add)中时,价格变成该值。但是我无法添加标签,$折扣数组为空 因此,我的product.tpl:Opencart产品-折扣展示,opencart,discounts,Opencart,Discounts,大家 需要为折扣产品添加标签。 当我将折扣价格添加到产品(admin-product-discount-add)中时,价格变成该值。但是我无法添加标签,$折扣数组为空 因此,我的product.tpl: 也许我需要找其他人,有人能帮忙吗?你能具体说明你需要什么吗?当您进入产品内部时,您希望看到折扣金额,例如5%10%15%?或者你想看一条上面写着减价的小丝带?我不知道你到底需要什么?是的,我想添加一个功能区“销售”,我认为如果我检查$折扣数组,它很容易做到,但它是空的,如果折扣设置在哪些页面上
也许我需要找其他人,有人能帮忙吗?你能具体说明你需要什么吗?当您进入产品内部时,您希望看到折扣金额,例如5%10%15%?或者你想看一条上面写着减价的小丝带?我不知道你到底需要什么?是的,我想添加一个功能区“销售”,我认为如果我检查$折扣数组,它很容易做到,但它是空的,如果折扣设置在哪些页面上,你需要这样做?最新的,最畅销的,产品本身的类别制造商?它与$折扣数组无关,它是在tpl文件中完成的
<span><?php echo $price; ?></span><?php } ?></b>
<?php print_r($discounts);?>
$this->data['discounts'] = array();
foreach ($discounts as $discount) {
$this->data['discounts'][] = array(
'quantity' => $discount['quantity'],
'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax')))
);
}
$this->data['options'] = array();
foreach ($this->model_catalog_product->getProductOptions($product_id) as $option) {
if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') {
$option_value_data = array();
foreach ($option['option_value'] as $option_value) {
if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
$option_value_data[] = array(
'product_option_value_id' => $option_value['product_option_value_id'],
'option_value_id' => $option_value['option_value_id'],
'name' => $option_value['name'],
'image' => $this->model_tool_image->resize($option_value['image'], 50, 50),
'price' => $price,
'price_prefix' => $option_value['price_prefix']
);
}
}
$this->data['options'][] = array(
'product_option_id' => $option['product_option_id'],
'option_id' => $option['option_id'],
'name' => $option['name'],
'type' => $option['type'],
'option_value' => $option_value_data,
'required' => $option['required']
);
} elseif ($option['type'] == 'text' || $option['type'] == 'textarea' || $option['type'] == 'file' || $option['type'] == 'date' || $option['type'] == 'datetime' || $option['type'] == 'time') {
$this->data['options'][] = array(
'product_option_id' => $option['product_option_id'],
'option_id' => $option['option_id'],
'name' => $option['name'],
'type' => $option['type'],
'option_value' => $option['option_value'],
'required' => $option['required']
);
}
}
if ($product_info['minimum']) {
$this->data['minimum'] = $product_info['minimum'];
} else {
$this->data['minimum'] = 1;
}
$this->data['review_status'] = $this->config->get('config_review_status');
$this->data['reviews'] = sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']);
$this->data['rating'] = (int)$product_info['rating'];
$this->data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
$this->data['attribute_groups'] = $this->model_catalog_product->getProductAttributes($product_id);
$this->data['products'] = array();
$results = $this->model_catalog_product->getProductRelated($product_id);
foreach ($results as $result) {
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height'));
} else {
$image = false;
}
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((float)$result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_review_status')) {
$rating = (int)$result['rating'];
} else {
$rating = false;
}
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'price' => $price,
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'])
);
}