当前位置: 首页>>代码示例>>PHP>>正文


PHP Combination::getColorsAttributes方法代码示例

本文整理汇总了PHP中Combination::getColorsAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Combination::getColorsAttributes方法的具体用法?PHP Combination::getColorsAttributes怎么用?PHP Combination::getColorsAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Combination的用法示例。


在下文中一共展示了Combination::getColorsAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postSave

    /**
     * Upgrades total_quantity_available after having saved
     * @see StockAvailableCore::update()
     * @see StockAvailableCore::add()
     */
    public function postSave()
    {
        if ($this->id_product_attribute == 0) {
            return true;
        }
        $id_shop = Shop::getContext() != Shop::CONTEXT_GROUP ? $this->id_shop : null;
        if (!Configuration::get('PS_DISP_UNAVAILABLE_ATTR')) {
            $combination = new Combination((int) $this->id_product_attribute);
            if ($colors = $combination->getColorsAttributes()) {
                $product = new Product((int) $this->id_product);
                foreach ($colors as $color) {
                    if ($product->isColorUnavailable((int) $color['id_attribute'], (int) $this->id_shop)) {
                        Tools::clearColorListCache($product->id);
                        break;
                    }
                }
            }
        }
        $total_quantity = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
			SELECT SUM(quantity) as quantity
			FROM ' . _DB_PREFIX_ . 'stock_available
			WHERE id_product = ' . (int) $this->id_product . '
			AND id_product_attribute <> 0 ' . StockAvailable::addSqlShopRestriction(null, $id_shop));
        $this->setQuantity($this->id_product, 0, $total_quantity, $id_shop);
        return true;
    }
开发者ID:Eximagen,项目名称:3m,代码行数:31,代码来源:StockAvailable.php

示例2: postSave

    /**
     * Upgrades total_quantity_available after having saved
     * @see StockAvailableCore::update()
     * @see StockAvailableCore::add()
     */
    public function postSave()
    {
        if ($this->id_product_attribute == 0) {
            return true;
        }
        $id_shop = Shop::getContext() != Shop::CONTEXT_GROUP ? $this->id_shop : null;
        if (!Configuration::get('PS_DISP_UNAVAILABLE_ATTR')) {
            $combination = new Combination((int) $this->id_product_attribute);
            if ($colors = $combination->getColorsAttributes()) {
                $product = new Product((int) $this->id_product);
                foreach ($colors as $color) {
                    if ($product->isColorUnavailable((int) $color['id_attribute'], (int) $this->id_shop)) {
                        // Change template dir if called from the BackOffice
                        $current_template_dir = Context::getContext()->smarty->getTemplateDir();
                        Context::getContext()->smarty->setTemplateDir(_PS_THEME_DIR_ . 'tpl');
                        Tools::clearCache(null, 'product-list-colors.tpl', Product::getColorsListCacheId((int) $product->id));
                        Context::getContext()->smarty->setTemplateDir($current_template_dir);
                        break;
                    }
                }
            }
        }
        $total_quantity = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
			SELECT SUM(quantity) as quantity
			FROM ' . _DB_PREFIX_ . 'stock_available
			WHERE id_product = ' . (int) $this->id_product . '
			AND id_product_attribute <> 0 ' . StockAvailable::addSqlShopRestriction(null, $id_shop));
        $this->setQuantity($this->id_product, 0, $total_quantity, $id_shop);
        return true;
    }
开发者ID:dev-lav,项目名称:htdocs,代码行数:35,代码来源:StockAvailable.php


注:本文中的Combination::getColorsAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。