/**
  * Create cart promotion and connect to product
  *
  * @param string $title
  * @param number $value
  * @param float $total_from
  * @param float $total_to
  * @param datetime $date_from
  * @param datetime $date_to
  * @param string $type
  * @param integer $count
  * @param boolean $stackable
  * @return integer
  */
 public function createCartPromotion($title, $value = 10, $total_from = NULL, $total_to = NULL, $date_from = NULL, $date_to = NULL, $type = 'percentageOff', $count = 1, $stackable = true)
 {
     $promotion = new rtShopPromotionCart();
     $promotion->setTitle($title);
     $promotion->setDateFrom($date_from);
     $promotion->setDateTo($date_to);
     $promotion->setTotalFrom($total_from);
     $promotion->setTotalTo($total_to);
     $promotion->setReductionType($type);
     $promotion->setReductionValue($value);
     $promotion->setCount($count);
     $promotion->setStackable($stackable);
     $promotion->save();
     return $promotion->getId();
 }
    $i3->setTotalTo(250);
    $i3->setReductionType('dollarOff');
    $i3->setReductionValue(10);
    $i3->setMode('Group');
    $i3->setCount(100);
    $i3->save();
    $i4 = new rtShopPromotionCart();
    $i4->setTitle('Voucher');
    $i4->setCode($code2);
    $i4->setDateFrom(date('Y-m-d H:i:s', strtotime(sprintf("-%s months", 3))));
    $i4->setDateTo(date('Y-m-d H:i:s', strtotime(sprintf("+%s months", 1))));
    $i4->setTotalTo(150);
    $i4->setReductionType('percentageOff');
    $i4->setReductionValue(15);
    $i4->setMode('Single');
    $i4->setCount(1);
    $i4->save();
    $t->pass('->save() on a rtShopPromotionCart object works');
} catch (Exception $e) {
    $t->fail('->save() on a rtShopPromotionCart failed!');
}
$o1 = Doctrine::getTable('rtShopPromotionCart')->find($i3->getId());
$t->isa_ok($o1, 'rtShopPromotionCart', '->retrieve() rtShopPromotionCart object was saved to database and retrieved successfully');
$o2 = Doctrine::getTable('rtShopPromotionCart')->findAvailable(70, NULL);
$t->is(count($o2), 1, '::findAvailable() retrieved 1 object successfully');
// Clean up
$i3->delete();
$i4->delete();
unset($o1, $o2);
/**
 * rtShopPromotionToolkit Class