繁体   English   中英

Opencart产品乐队

[英]Opencart Product Bands

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

嗨,我是一个新手,已经习惯了Opencart环境。 我需要以下产品带的帮助,如下图所示。 我需要comeing_soon选项来覆盖out_of_stock选项设置。 由于Im与已制定的逻辑相混淆,因此无法正常工作。 只有数量为“ 0”的产品时,Out_of_stock选项有效。 当我们有一个新产品Coming_soon时,我们也会将该产品数量设置为“ 0”,但是这里有些问题,并且Coming_soon不会覆盖Out_of_stock设置。 我需要一些帮助。

Coming_soon复选框

产品数量

缺货带

即将来临的乐队

目录/控制器/产品/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*/

目录/视图/产品/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 } ?>
                                <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'];

                        }

目录/视图/产品/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 } ?>

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

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

如果同时需要库存警告和库存条带,则需要重新考虑添加0数量的新产品。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM