src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php
public function AddArticle($sArticleId, $dAmount = 1, $sComment = null)
    {
        $dNewAmount = 0;
        $aItemData = array();
        $oItem = TdbPkgShopWishlistArticle::GetNewInstance();
        /** @var $oItem TdbPkgShopWishlistArticle */
        if ($oItem->LoadFromFields(array('pkg_shop_wishlist_id' => $this->id, 'shop_article_id' => $sArticleId))) {
            $aItemData = $oItem->sqlData;
            $aItemData['amount'] += $dAmount;
        } else {
            $aItemData['pkg_shop_wishlist_id'] = $this->id;
            $aItemData['shop_article_id'] = $sArticleId;
            $aItemData['amount'] = $dAmount;
            $aItemData['datecreated'] = date('Y-m-d H:i:s');
        }
        if (!is_null($sComment)) {
            $aItemData['comment'] = $oItem->LoadFromRow($aItemData);
        }
        $oItem->LoadFromRow($aItemData);
        $oItem->AllowEditByAll(true);
        $oItem->Save();
        $dNewAmount = $aItemData['amount'];

        return $dNewAmount;
    }
public function AddArticle($sArticleId, $dAmount = 1, $sComment = null)
    {
        $dNewAmount = 0;
        $aItemData = array();
        $oItem = TdbPkgShopWishlistArticle::GetNewInstance();
        /** @var $oItem TdbPkgShopWishlistArticle */
        if ($oItem->LoadFromFields(array('pkg_shop_wishlist_id' => $this->id, 'shop_article_id' => $sArticleId))) {
            $aItemData = $oItem->sqlData;
            $aItemData['amount'] += $dAmount;
        } else {
            $aItemData['pkg_shop_wishlist_id'] = $this->id;
            $aItemData['shop_article_id'] = $sArticleId;
            $aItemData['amount'] = $dAmount;
            $aItemData['datecreated'] = date('Y-m-d H:i:s');
        }
        if (!is_null($sComment)) {
            $aItemData['comment'] = $oItem->LoadFromRow($aItemData);
        }
        $oItem->LoadFromRow($aItemData);
        $oItem->AllowEditByAll(true);
        $oItem->Save();
        $dNewAmount = $aItemData['amount'];

        return $dNewAmount;
    }
public function AddArticle ( $ sArticleId , $ dAmount = 1 , $ sComment = null ) { $ dNewAmount = 0 ; $ aItemData = array ( ) ; $ oItem = TdbPkgShopWishlistArticle :: GetNewInstance ( ) ; /** @var $oItem TdbPkgShopWishlistArticle */ if ( $ oItem -> LoadFromFields ( array ( 'pkg_shop_wishlist_id' => $ this -> id , 'shop_article_id' => $ sArticleId ) ) ) { $ aItemData = $ oItem -> sqlData ; $ aItemData [ 'amount' ] += $ dAmount ; } else { $ aItemData [ 'pkg_shop_wishlist_id' ] = $ this -> id ; $ aItemData [ 'shop_article_id' ] = $ sArticleId ; $ aItemData [ 'amount' ] = $ dAmount ; $ aItemData [ 'datecreated' ] = date ( 'Y-m-d H:i:s' ) ; } if ( ! is_null ( $ sComment ) ) { $ aItemData [ 'comment' ] = $ oItem -> LoadFromRow ( $ aItemData ) ; } $ oItem -> LoadFromRow ( $ aItemData ) ; $ oItem -> AllowEditByAll ( true ) ; $ oItem -> Save ( ) ; $ dNewAmount = $ aItemData [ 'amount' ] ; return $ dNewAmount ; }
adds an article to the wishlist - returns the new amount of that article on the list.

@param string $sArticleId
@param float  $dAmount
@param string $sComment   - optional comment

@return float
adds an article to the wishlist - returns the new amount of that article on the list .