首页 文章

Opencart产品乐队

提问于
浏览
0

我仍然是一个新手每天都在学习的东西 . 我已经在OpenCart论坛网站上发布了我的问题,寻求帮助,现在在StackOverflow中 . 我需要你的帮助 .

嗨,我是一个熟悉Opencart环境的新手 . 我需要产品乐队的帮助,如下图所示 . 我需要coming_soon选项来覆盖out_of_stock选项设置 . 它没有正常工作,因为我与已经制作的逻辑混淆 . 当只有“0”数量的产品时,Out_of_stock选项有效 . 当我们有一个Coming_soon的新产品时,我们也会将产品数量设为“0”,但这里出现问题并且Coming_soon没有覆盖Out_of_stock设置 . 我需要一些帮助 .

Coming_soon checkbox

Product quantity

Out of stock band

Coming Soon band

catalog/controller/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">&nbsp;</span>
                                <?php } ?>
                                <?php if ($product['band_free_shipping'] == 'Yes') { ?>
                                    <span class="band-free-shipping">&nbsp;</span>
                                <?php } ?>

                                <?php if ($product['band_new'] == 'Yes') { ?>
                                    <span class="band-new">&nbsp;</span>
                                <?php } ?>

                                <?php if ($product['band_coming_soon'] == 'Yes') { ?>
                                    <span class="band-coming-soon">&nbsp;</span>
                                <?php } ?>
                                

catalog/controller/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 } ?>

1 回答

  • 0

    可以在设置中禁用Opencart缺货警告:

    设置 - >您的商店 - >编辑 - >选项 - >显示缺货警告

    如果您需要股票警告和乐队一起工作,您需要重新考虑添加0数量的新产品 .

相关问题