コード例 #1
0
 protected function onConstraintException(Pap_Db_Coupon $coupon) {
     throw new Gpf_Exception($this->_('Importing coupons was stopped, because coupon code %s already exists', $coupon->getCode()));
 }
コード例 #2
0
	public function getCouponText(Pap_Db_Coupon $coupon) {
		$couponFormat = $this->getData3();
		$couponFormat = str_replace('{$couponcode}', $coupon->getCode(), $couponFormat);
		$couponFormat = str_replace('{$couponid}', $coupon->getId(), $couponFormat);
		$couponFormat = str_replace('{$validfrom}', $coupon->get(Pap_Db_Table_Coupons::VALID_FROM), $couponFormat);
		$couponFormat = str_replace('{$validto}', $coupon->get(Pap_Db_Table_Coupons::VALID_TO), $couponFormat);
		$couponFormat = str_replace('{$limituse}', ($coupon->get(Pap_Db_Table_Coupons::MAX_USE_COUNT) == 0 ? $this->_('unlimited') : $coupon->get(Pap_Db_Table_Coupons::MAX_USE_COUNT)), $couponFormat);
		if (strstr($couponFormat, '{$barcodeimage}') !== false) {
			$barCode = new Gpf_BarCode_BarCode();
			$couponFormat = str_replace('{$barcodeimage}', $barCode->getLink($coupon->getId()), $couponFormat);
		}
		
		if (strstr($couponFormat, '{$qrcodeimage}') !== false) {
			$QrCode = new Gpf_QrCode_QrCode();
			$couponFormat = str_replace('{$qrcodeimage}', $QrCode->getLink($coupon->getCode()), $couponFormat);
		}
		
		return $couponFormat;
	}