當前位置: 首頁>>代碼示例>>PHP>>正文


PHP products_minierp::setProductMaterials方法代碼示例

本文整理匯總了PHP中products_minierp::setProductMaterials方法的典型用法代碼示例。如果您正苦於以下問題:PHP products_minierp::setProductMaterials方法的具體用法?PHP products_minierp::setProductMaterials怎麽用?PHP products_minierp::setProductMaterials使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在products_minierp的用法示例。


在下文中一共展示了products_minierp::setProductMaterials方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: explode

while ($row = tep_db_fetch_array($r)) {
    $products_id = $row['products_id'];
    $ca = explode(',', $row['color']);
    foreach ($ca as $key => $c) {
        $ca[$key] = trim($c);
    }
    $color_pattern_id = array();
    foreach ($ca as $c) {
        if ($c != '' && isset($colors[$c])) {
            $color_pattern_id[] = $colors[$c];
        }
    }
    if (count($color_pattern_id) > 0) {
        $class_pm->setColorPattern($products_id, $color_pattern_id);
    }
    $ma = explode(',', $row['material']);
    foreach ($ma as $key => $m) {
        $ma[$key] = trim($m);
    }
    $products_materials_id = array();
    foreach ($ma as $m) {
        if ($m != '' && in_array($m, $materials)) {
            $products_materials_id[] = array_search($m, $materials);
        }
    }
    if (count($products_materials_id) > 0) {
        $class_pm->setProductMaterials($products_id, $products_materials_id);
    }
}
echo 'Done';
tep_db_close();
開發者ID:blasiuscosa,項目名稱:manobo-2008,代碼行數:31,代碼來源:temp-syncback-neckermann-colmats-to-products.php

示例2: array

while ($r = tep_db_fetch_array($dbq)) {
    if ($r['finishing_goldplate'] == '1' && !in_array($r['products_id'], $goldplated)) {
        $goldplated[] = $r['products_id'];
    }
    if (!isset($products[$r['products_id']])) {
        $products[$r['products_id']] = array();
    }
    if (!is_null($r['attribute_material_id']) && !in_array($r['attribute_material_id'], $products[$r['products_id']])) {
        $products[$r['products_id']][] = $r['attribute_material_id'];
    }
}
//echo "<pre>";var_dump($products);
//die();
foreach ($products as $pid => $materials_id) {
    //    echo "$pid : ";print_r($materials_id);
    //    echo "<br
    if (count($materials_id) > 0) {
        if (in_array($pid, $goldplated)) {
            $key = array_search('1', $materials_id);
            if ($key !== false) {
                unset($materials_id[$key]);
            }
            $materials_id[] = '17';
        }
        $class_pm->setProductMaterials($pid, $materials_id);
        $class_cp->setParams($pid, 'M');
        echo "Product {$pid} , materials_id's (" . implode(",", $materials_id) . ") added <br/>";
    } else {
        echo "No Material found: {$pid}<br/>";
    }
}
開發者ID:blasiuscosa,項目名稱:manobo-2008,代碼行數:31,代碼來源:temp-autoset-products-materials.php


注:本文中的products_minierp::setProductMaterials方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。