/** * 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(); }