本文整理汇总了PHP中GroupReduction::getGroupsByCategoryId方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupReduction::getGroupsByCategoryId方法的具体用法?PHP GroupReduction::getGroupsByCategoryId怎么用?PHP GroupReduction::getGroupsByCategoryId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupReduction
的用法示例。
在下文中一共展示了GroupReduction::getGroupsByCategoryId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setProductReduction
public static function setProductReduction($id_product, $id_group = null, $id_category = null, $reduction = null)
{
$res = true;
GroupReduction::deleteProductReduction((int) $id_product);
$categories = Product::getProductCategories((int) $id_product);
if ($categories) {
foreach ($categories as $category) {
$reductions = GroupReduction::getGroupsByCategoryId((int) $category);
if ($reductions) {
foreach ($reductions as $reduction) {
$current_group_reduction = new GroupReduction((int) $reduction['id_group_reduction']);
$res &= $current_group_reduction->_setCache();
}
}
}
}
return $res;
}
示例2: setProductReduction
public static function setProductReduction($id_product, $id_group = null, $id_category, $reduction = null)
{
$res = true;
GroupReduction::deleteProductReduction((int) $id_product);
$reductions = GroupReduction::getGroupsByCategoryId((int) $id_category);
if ($reductions) {
foreach ($reductions as $reduction) {
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`)
VALUES (' . (int) $id_product . ', ' . (int) $reduction['id_group'] . ', ' . (double) $reduction['reduction'] . ')');
}
}
return $res;
}