[TYPO3-mvc] Basket / session question

Webmeck - TYPO3 typo3 at webmeck.de
Thu Feb 14 23:10:44 CET 2013


Hi Jan,

when you add an attribute to the product-class it wont be persisted 
automatically. You must not define it in the tca.

So I would:
add the isInBasket attribute to the product with getters/setters.

add a method to the basket markInBasketProducts($products), which 
iterates through the given products and sets the attribute.

This method I would call in the controller.

kind regarts
vosberg

On 14.02.2013 22:59, Jan Kornblum wrote:
> Hi group,
>
> while playing with extbase i try to build a "shop". I have a 
> ProductModel and a fe_user-session based "basket". In this basket i 
> want to store "individual" BasketItem-Objects (UID of ProductModel, 
> Amount, Price) instead of real "big" ProductModel-Objects. Storing 
> items into the basket and displaying the baskets content works...
>
> Now i want the ProductController's listAction to display something 
> like a "isInBasket / isNotInBasket" field in the view. But i have no 
> idea how to do this:
>
> - Extending the ProductModel with an "isInBasket"-Property is 
> certainly the wrong way, as this property depends on the 
> fe_user-session and also should not be persisted to the database. 
> Independent from this, how and where to get this property filled?
>
> - Creating a getProductsWithCurrentBasketInformation()-method in the 
> ProductModel-repository, would this be a good way? But which kind of 
> object should this return? Wroing place, isn't it?
>
> - Creating a not persistable ProductWithBasketInformation-Model? Maybe 
> extend the ProductModel class? This sound the best from above...
>
> - And how to get the basket-information "mapped" into the 
> Product-Objects? Would this be part of a service?
>
> Can anybody give me a hint for the right direction? I would be happy :)
>
> Kind regards, Jan
>
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list