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


PHP ProductSupplier::getProductSupplierPrice方法代码示例

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


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

示例1: ajaxProcessSearchProduct

    /**
     * method call when ajax request is made for search product to add to the order
     * @TODO - Update this method to retreive the reference, ean13, upc corresponding to a product attribute
     */
    public function ajaxProcessSearchProduct()
    {
        // Get the search pattern
        $pattern = pSQL(Tools::getValue('q', false));
        if (!$pattern || $pattern == '' || strlen($pattern) < 1) {
            die;
        }
        // get supplier id
        $id_supplier = (int) Tools::getValue('id_supplier', false);
        // gets the currency
        $id_currency = (int) Tools::getValue('id_currency', false);
        // get lang from context
        $id_lang = (int) Context::getContext()->language->id;
        $query = new DbQuery();
        $query->select('
			CONCAT(p.id_product, \'_\', IFNULL(pa.id_product_attribute, \'0\')) as id,
			ps.product_supplier_reference as supplier_reference,
			IFNULL(pa.reference, IFNULL(p.reference, \'\')) as reference,
			IFNULL(pa.ean13, IFNULL(p.ean13, \'\')) as ean13,
			IFNULL(pa.upc, IFNULL(p.upc, \'\')) as upc,
			md5(CONCAT(\'' . _COOKIE_KEY_ . '\', p.id_product, \'_\', IFNULL(pa.id_product_attribute, \'0\'))) as checksum,
			IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(DISTINCT agl.name, \' - \', al.name order by agl.name SEPARATOR \', \')), pl.name) as name
		');
        $query->from('product', 'p');
        $query->innerJoin('product_lang', 'pl', 'pl.id_product = p.id_product AND pl.id_lang = ' . $id_lang);
        $query->leftJoin('product_attribute', 'pa', 'pa.id_product = p.id_product');
        $query->leftJoin('product_attribute_combination', 'pac', 'pac.id_product_attribute = pa.id_product_attribute');
        $query->leftJoin('attribute', 'atr', 'atr.id_attribute = pac.id_attribute');
        $query->leftJoin('attribute_lang', 'al', 'al.id_attribute = atr.id_attribute AND al.id_lang = ' . $id_lang);
        $query->leftJoin('attribute_group_lang', 'agl', 'agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = ' . $id_lang);
        $query->leftJoin('product_supplier', 'ps', 'ps.id_product = p.id_product AND ps.id_product_attribute = IFNULL(pa.id_product_attribute, 0)');
        $query->where('(pl.name LIKE \'%' . $pattern . '%\' OR p.reference LIKE \'%' . $pattern . '%\' OR ps.product_supplier_reference LIKE \'%' . $pattern . '%\')');
        $query->where('p.id_product NOT IN (SELECT pd.id_product FROM `' . _DB_PREFIX_ . 'product_download` pd WHERE (pd.id_product = p.id_product))');
        $query->where('p.is_virtual = 0 AND p.cache_is_pack = 0');
        if ($id_supplier) {
            $query->where('ps.id_supplier = ' . $id_supplier . ' OR p.id_supplier = ' . $id_supplier);
        }
        $query->groupBy('p.id_product, pa.id_product_attribute');
        $items = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
        foreach ($items as &$item) {
            $ids = explode('_', $item['id']);
            $prices = ProductSupplier::getProductSupplierPrice($ids[0], $ids[1], $id_supplier, true);
            if (count($prices)) {
                $item['unit_price_te'] = Tools::convertPriceFull($prices['product_supplier_price_te'], new Currency((int) $prices['id_currency']), new Currency($id_currency));
            }
        }
        if ($items) {
            die(Tools::jsonEncode($items));
        }
        die(1);
    }
开发者ID:zangles,项目名称:lennyba,代码行数:55,代码来源:AdminSupplyOrdersController.php


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