3 replies [Last post]
Johnny van de Laar's picture
Offline
Bug Finder
Joined: 12/18/2007
Juice: 70

I'm busy building a ubercart shop where i want to sell wooden floors. per package there is a certain amount of square metres. for example 2.7

if i want to have a floor for 10 square metres this means i need 4 items (10.8 square metres)

i was wondering how i could do this in ubercart.

i have two issues:
-how do i add the 2.7 square metres per package attribute to this product
-how do i modify the price calculation such that ubercart calculates how much items i need

the second doesn't sound all to difficult as i think i can do that by modifying this module:
http://www.ubercart.org/contrib/2010

so my main question is how i can add an extra attribute like the square metres. i've seen the attribute module but this provides an option to the user to select the square metres. while this isn't the case as the attribute is fixed for this product item.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Price calculation for floors

This is a job for CCK. You should start by making a Flooring product class to make a new node type. This will keep your different product types separated if you ever start selling anything else. In the Content types administration page under Content management you can add a "Surface Area" field to the Flooring node type. There are many different options, but it sounds like you want a Number field with a text box widget.

CCK is a very complicated set of modules, so continue to explore all the options. When you create a Flooring node, you will see the new field you created, ready for input.

cYu
cYu's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 11/19/2007
Juice: 850
Re: Price calculation for floors

As Lyle suggested, I think a CCK Decimal field with a text widget would do the trick for storing the Surface Area of the product. Then if you add a product attribute with no options it will display a text field for the customer to enter the surface area required.

At that point, you could modify that ajax module to calculate a quantity needed but there really isn't any need for ajax to be used at all. A little bit of javascript should do the trick for you if all you need to do is the calculation that was mentioned above.

Johnny van de Laar's picture
Offline
Bug Finder
Joined: 12/18/2007
Juice: 70
Re: Re: Price calculation for floors

ok that seems to be a good start

i added a CCK field like you proposed and now i'll try to modify the ajax module to do the calculations