[TYPO3-commerce] Commerce Extensionentwicklung
Ingo Schmitt
mailinglisten at i-schmitt.de
Wed Aug 22 13:13:37 CEST 2007
Hi Sebsatian,
> Hi Commercedevs,
>
> I try to develop an extension for commerce, and got a problem with the
> tx_commerce_product object.
>
> I do something like this:
>
> $myProduct=new
> tx_commerce_product($row['uid'],$GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid']);
>
You should create the new object by
$myProduct = t3lib_div::makeinstance('tx_commerce_product');
$myProduct ->
init($row['uid'],$GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid']);
> $myProduct->load_data();
> $hasStock = $myProduct->hasStock();
> $stock = $myProduct->hasStock() ? 0 :
> $this->maxStock($myProduct); $title = $row['title'];
> $cat = $myProduct->get_masterparent_categorie();
> $desc = $row['description'];
> $price_cheapest = $myProduct->getCheapestArticle();
> $teaserimg = current($myProduct->getTeaserImages());
>
> All the product functions returning empty values. $row['uid'] is set
> correctly.
> Also simple functions like get_title() returning nothing.
Could you do a "select * from tx_commerce_products where uid =
$row['uid']" and check your data?
Ingo
>
> A little help would be great. Maybe I did something wrong with the
> object programming? Do I have to init the product?
> Or is it just a bug?
>
> Regards,
> Sebastian Böttger
>
Mit freundlichen Gruessen
--
Ingo Schmitt mailto:is at marketing-factory.de
Marketing Factory Consulting GmbH http://typo3.marketing-factory.de/
Content Management mit Typo3: Beratung - Schulung - Realisierung
More information about the TYPO3-project-commerce
mailing list