[TYPO3-commerce] Dynamic attributes to let the customer set the value of a coupon?
Georg Schönweger
georg.schoenweger at gmail.com
Wed May 2 09:22:10 CEST 2012
Hi Jimmy,
this should be possible. We are changing the price dynamically too by
using the hook
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/pi2/class.tx_commerce_pi2.php']['artAddUid']
(function postartAddUidSingle)
This hook is called everytime an article is added to the basket, have a
look at pi2/class.tx_commerce_pi2.php
e.g. you could do something like this;
- in single view you could create a input field inside the commerce
<form> element where the customer enters his coupon Value. Then you can
access this field in the hook;
function postartAddUidSingle($articleUid, $v, $productObj, $articleObj,
$basketObj, $pObj) {
$newPriceGross = intval($pObj->piVars['customPriceField']) * 100;
$newPriceNet = ...;
$basketObj->changePrices($articleUid,$newPriceGross,$newPriceNet);
}
hope this helps
-Georg
Am 30.04.2012 11:37, schrieb Julian Pleger:
> Hey guys,
> I am quit new to the commerce extension but I am already very happy with it.
> There is only one thing I'm still trying to do:
>
> I want to sell coupons to the customers. BUT I just want to create ONE product und let the customer set the value of the coupon on his own.
> So ... if someone wants a coupon which has a value of $3.44 he should be able to do this. Is it possible?
>
> Thanks in advance,
> Jimmy
More information about the TYPO3-project-commerce
mailing list