else { if ( $discountRuleSelectedClasses && !in_array( -1, $discountRuleSelectedClasses ) ) { foreach( $discountRuleSelectedClasses as $classID ) { $ruleValue = eZDiscountSubRuleValue::create( $discountRuleID, $classID, 0 ); $ruleValue->store(); } $discountRule->setAttribute( 'limitation', false ); } if ( $discountRuleSelectedSections && !in_array( -1, $discountRuleSelectedSections ) ) { foreach( $discountRuleSelectedSections as $sectionID ) { $ruleValue = eZDiscountSubRuleValue::create( $discountRuleID, $sectionID, 1 ); $ruleValue->store(); } $discountRule->setAttribute( 'limitation', false ); } } $discountRule->store(); $db->commit(); // we changed prices => remove content cache eZContentCacheManager::clearAllContentCache(); return $module->redirectTo( $module->functionURI( 'discountgroupview' ) . '/' . $discountGroupID ); }
$sectionID = $sectionRuleValue->attribute('value'); $section = eZSection::fetch($sectionID); if ($section) { if (!$firstLoop) { $limitation .= ', '; } else { $firstLoop = false; } $sectionName = $section->attribute('name'); $limitation .= "'" . $sectionName . "'"; } } } else { $limitation .= ' ' . ezpI18n::tr('kernel/shop', 'in any section'); } $productRuleValues = eZDiscountSubRuleValue::fetchBySubRuleID($discountRuleID, 2); if ($productRuleValues != null) { $limitation = ezpI18n::tr('kernel/shop', 'Products') . ' '; $firstLoop = true; foreach ($productRuleValues as $productRuleValue) { $objectID = $productRuleValue->attribute('value'); $product = eZContentObject::fetch($objectID); if ($product) { if (!$firstLoop) { $limitation .= ', '; } else { $firstLoop = false; } $productName = $product->attribute('name'); $limitation .= "'" . $productName . "'"; }
static function removeBySubRuleID ( $discountSubRuleID ) { eZPersistentObject::removeObject( eZDiscountSubRuleValue::definition(), array( "discountsubrule_id" => $discountSubRuleID ) ); }