3063 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 369 Views |
-
Products with different sizes/prices

16 October 2011 at 1:14am
Dear community
I'm developing a really basic online shop (the ecommerce module would be overkill). It's working very well, I've got products that I'm managing with ModelAdmin.
Now I'd like to implement different sizes of the same product. Different sizes mean different prices and different weights, which are used to calculate the shipping fees.
How would I do that?
Would I use a HasMany relationship to a list with size/price/weight-entries?
Ideally, I'd have a table where I could add rows and enter size, price and weight.Any hint in the right direction is higly appreciated
-
Re: Products with different sizes/prices

16 October 2011 at 1:59am Last edited: 16 October 2011 1:59am
You could create a 'Specs' DataObject, where Product 'has_many' Specs. Then add a ComplexTableField (even in a separate tab) to the product's getCMSFields. This will let you add multiple specs to each product from within ModelAdmin.
Something like:
public function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab('Root.Specs', new ComplexTableField($this, 'Specs', 'Spec'));
return $fields;
} -
Re: Products with different sizes/prices

16 October 2011 at 3:47am
While martimiz as ever is right on the money with the advice - I'd reconsider this...
I'm developing a really basic online shop (the ecommerce module would be overkill).
I've reinvented the wheel often enough to know better. Silvercart.org has just added the different costings for volue and has variable shipping costs (which I believe is the based on the feedback given at a ssmeetup in london) I'd encourage you to think whether you'd like other people to add to the code on your site for free - or every change you need you'll have to work for...
-
Re: Products with different sizes/prices

16 October 2011 at 5:07am
Thanks martimiz, I'll try that.
The problem, swaiba, is, that in the beginning my customer wanted a really, really basic list of 5-6 products. I only knew the ecommerce module and found it to be faster to develop my own solution, since the customer is very cost sensitive.
But as soon as this was in place, he wanted more...Had I known Silvercart back then, I probably would have gone with it. Thanks for this hint, I'll use it next time
| 369 Views | ||
|
Page:
1
|
Go to Top |


