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

Universal Pricing Variations - Shop 0.8.5


Go to End


3 Posts   1893 Views

Avatar
SnowBoarder82

Community Member, 57 Posts

4 December 2013 at 6:19pm

Hey Guys,

Using SS2.4.7 and Shop 0.8.5

I am creating a website selling artwork. The pricing variations for the artwork are exactly the same for each product - the variations being for “dimensions” and “print medium”. However, sometimes a product may not have all of the variations applied to it.

I would like to create a way where there is one place to create & edit these variations and pricing, which are then applied to every applicable product across the website - as opposed to each product having it's separate variations.

I have started by creating a universal pricing class and admin to create the variations and pricing. I have also created a many to many relationship between the universal pricing and the product so that the optional relationship of a product having a certain variation can be selected in the cms for a product page.

I am a little stuck with how to then incorporate these created variations into the cart functionality, to add an item to an order etc… Any clues?
Also would there be a way to just integrate this desired outcome by modifying the main variation code instead?

Thanks Guys, would definitely appreciate any help on this.

Avatar
SnowBoarder82

Community Member, 57 Posts

19 December 2013 at 11:58am

Any feedback on this guys,
Thinking the best way to achieve this would be to somehow integrate it into the Variations functionality of the Shop module, or override this somehow... - any clues into how I would be best to go about this?

Thank you,

Avatar
Jedateach

Forum Moderator, 238 Posts

18 February 2014 at 9:49am

I would approach this problem by not using the variations system. I faced the same issue when building http://www.printmighty.co.nz/. You have many products, and variations will always be the same, if not a subset of the possible variations.

I would start by extending the Product model with something like “ArtProduct”.
Then there’s a bunch of places you’ll need to make changes to the system:

  • Create a ArtProduct_OrderItem model (extends Product_OrderItem)
  • Create a ArtProduct_Controller (extends Product_Controller)
  • Create your model for storing sizings
  • Possibly add a ArtProduct many_many Sizings relationship to limit sizes.
  • Override the AddProductForm to allow choosing sizings
  • Create a special order item for storing the selected size in cart/orders
  • Update CMS ui, if necessary

Hopefully this is enough to get you going, assuming you think it’s the best approach. It does introduce a bit of custom code, which will be more difficult to maintain as the shop module grows and develops. But that said, if you find ways of generalising things, then we could look at incorporating those kinds of things into the core, or a submodule.