[TYPO3-commerce] Create an article using code?

Fritjof Bohm f.bohm at hoch2.de
Wed Oct 7 17:55:58 CEST 2009


Hi,

is there a (good) possibility to add a new article using a php script I  
hooked into the basket generation?
(I added a textarea to the basket where the shop user can leave a message.  
It would be great if that message could be converted to an article and  
added to the basket on refresh, so it will appear on the invoice a.s.o)

At the moment I use the  
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/pi2/class.tx_commerce_pi2.php']['postartAddUid'][]  
hook and call

	$creator = t3lib_div::makeInstance('tx_commerce_articleCreator');
	$creator->init(0,0);
	$PA = array();
	$PA['title'] = "Hello World";
	$key = "";
	$creator->createArticle($PA, $key);

. This creates an article, but it is "empty" (just the title, no  
description, no categories,...).

Any ideas how I can add further data, and how I can put the new article  
into a category?

Regards,
Fritjof


More information about the TYPO3-project-commerce mailing list