Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

A pizza shop - how do i add pizza toppings? (Attributes)


Go to End


6 Posts   2566 Views

Avatar
Nobrainer Web

Community Member, 138 Posts

9 December 2010 at 11:30am

Hello,

I'm about to do a pizza shop / online order system in SS ecommerce.

My main concern is how i can solve the task of allowing the user to add/remove toppings, to pizzas added to cart? (Or before they are added to cart)
I would like for the customer to be able to click on a link (modify pizza) and then get a pop-up with a list of checkboxes, each representing a topping. Checking more checkboxes means adding toppings and increasing price and ...)

Can anyone help me get a good start on the above task, it will be greatly appriciated :o)

Avatar
Nobrainer Web

Community Member, 138 Posts

21 December 2010 at 4:49am

Can anyone help on the question above?

Avatar
Jedateach

Forum Moderator, 238 Posts

13 January 2011 at 2:08pm

Hi Thomas,
Such customization of an order item would need to be developed. There is no such solution as of yet.

Avatar
Nobrainer Web

Community Member, 138 Posts

13 January 2011 at 9:57pm

Hi Jedateach,

Thank you for replying to my post.

I'm aware that i will need to do some custom development, i'm looking for pointers on how to do that.
If you could let me know a the right "strategy/approach" i would be very grateful.

Something along the lines of: You would need to add dataobjects for this ..., and have a function that does this ... and so on :o)

Hope you can be of some assistance :o)

Avatar
Jedateach

Forum Moderator, 238 Posts

14 January 2011 at 10:11am

I would probably tackle this by creating a separate module called ecommerce_product_options.
As I understand it, you want to be able to define an arbitrary number of 'add-ons' for an order item that affect the price of that item.

To do this, you'll probably want to create a ProductOption dataobject, which has a name & price.
Create a decorator for Product that adds has_many 'Options' => 'ProductOption'
Create a decorator for Product_OrderItem that has_many 'Options' => 'ProductOption', and also contains a updateUnitPrice function, which totals the options, and adds to the existing unitPrice. You'll probably also want to implement the updateTableTitle function to add the selected options to the title.

For adding options, you might want to create an OptionsForm in the product decorator that can be added to the Product.ss template. When submitted, the form would add the selected option, and return to the product page.
You might also want to look at creating urls for adding / deleting options. I'm not sure how feasible it is to decorate ShoppingCart...which would be the best option, otherwise create your own controller for that.

Another thing to be aware of is what version of eCommerce you'll use do this on. Perhaps developing it on trunk would be an idea to use the latest code, and then stick with the next release when it is out.

You're more than welcome to contribute this module into the ss eCommerce SVN repository :P

hope this helps,
Jeremy

Avatar
Nobrainer Web

Community Member, 138 Posts

14 January 2011 at 10:57am

Thanks for you time m8 :o)

But wow... this sounds like quite a task.
Well i guess i will have to wait a while with this project, as my current schedule does not allow for me to play with this for weeks :o)*

But i think it could be a nice way to learn more about SS, but perhaps i'm in over my head.

Thank you once more for your time, and should i get something working i will ofc contribute.

Cya