【发布时间】:2018-03-05 08:37:37
【问题描述】:
我还是个新手,每天都在学习。我在 OpenCart 论坛网站上发布了我的问题以寻求帮助,现在在 StackOverflow 上。我需要你们的帮助。
您好,我是一个习惯 Opencart 环境的新手。我需要产品带方面的帮助,如下图所示。 我需要coming_soon 选项来覆盖out_of_stock 选项设置。它无法正常工作,因为我对已制定的逻辑感到困惑。当只有“0”数量的产品时,Out_of_stock 选项有效。当我们有一个新产品 Coming_soon 时,我们也会将该产品数量设为“0”,但这里出了点问题,并且 Coming_soon 没有覆盖 Out_of_stock 设置。我需要一些帮助。
目录/控制器/product/category.php
/*OOS Band start*/
$optionsQty = 0;
$oosQty = 0;
foreach ($this->model_catalog_product->getProductOptions($result['product_id']) as $option) {
if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') {
foreach ($option['option_value'] as $option_value) {
$optionsQty++;
if ($option_value['quantity'] <=0) $oosQty++;
}
}
}
if ($optionsQty == $oosQty && $optionsQty > 0 ) {
$band_oos = true;
}
else $band_oos = false; /*OOS Band end*/
catalog/view/product/category.tpl
<div class="for_infine">
<?php if ($product['band_oos']) { ?>
<span class="band-oos"> </span>
<?php } ?>
<?php if ($product['band_free_shipping'] == 'Yes') { ?>
<span class="band-free-shipping"> </span>
<?php } ?>
<?php if ($product['band_new'] == 'Yes') { ?>
<span class="band-new"> </span>
<?php } ?>
<?php if ($product['band_coming_soon'] == 'Yes') { ?>
<span class="band-coming-soon"> </span>
<?php } ?>
<br />
目录/控制器/product/product.php
$this->data['options'] = array();
$optionsQty = 0;
$oosQty = 0;
foreach ($this->model_catalog_product->getProductOptions($this->request->get['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) {
$optionsQty++;
if ($option_value['quantity'] <=0) $oosQty++;
if ((float)$product_info['special']) {
$price_original = $product_info['special'];
}else {
$price_original = $product_info['price'];
}
catalog/view/product/product.tpl
<div class="left">
<div class="heading" style="line-height: 27px; font-size: 25px;"><?php echo $heading_title; ?></div>
<?php if ($thumb) { ?>
<div class="image">
<?php if ($band_oos ) { ?>
<div class="oos_tab_large top-right-cnr"></div>
<?php } ?>
<?php if ($band_free_shipping == 'Yes') { ?>
<div class="free_shipping_tab_large top-right-cnr"></div>
<?php } ?>
<?php if ($band_new == 'Yes') { ?>
<div class="new_tab_large top-right-cnr"></div>
<?php } ?>
<?php if ($band_coming_soon == 'Yes') { ?>
<div class="coming_soon_tab_large top-right-cnr"></div>
<?php } ?>
【问题讨论】:
-
请在此处发布您的问题,而不是链接到场外问题。
-
对不起@jsheeran,我什至是 stackoverflow 的新手,但现在我设法在朋友的帮助下发布了它。
标签: javascript php opencart