本文整理汇总了PHP中products_minierp::setColorPattern方法的典型用法代码示例。如果您正苦于以下问题:PHP products_minierp::setColorPattern方法的具体用法?PHP products_minierp::setColorPattern怎么用?PHP products_minierp::setColorPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类products_minierp
的用法示例。
在下文中一共展示了products_minierp::setColorPattern方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
$q = "SELECT products_id, color, material FROM jng_sp_catalog WHERE jng_sp_id={$jng_sp_id}";
$r = tep_db_query($q);
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);
}
}