3 replies [Last post]
Guest
Guest's picture
Was this information Helpful?

Hi there,

I'm going to implement 'price by weight' functionality for products. This is needed for a grocery store, for example, where things aren't sold by unit.

This adds two (optional) fields to products: Price by weight/unit toggle, and a Weight multiplier.

Products priced by weight are basically just added up differently when in the cart/order. Each line is calculated based on qty * price * weight * weight multiplier.

for example, 1 bushel of bananas * $0.99 * 2.5 * 1 = $2.475

The weight multiplier is there in case a store wants to price things by different weights. IE, they may choose grams as their unit, and 100 as the multiplier to price per 100g.

Ubercart is written very well (yay), and so I could just continue doing this in a seperate module, but I thought I should ask first if this is something desired in core. If so I'll offer more details of how I would implement it, from front to back, to get feedback. Then I could apply a patch against the HEAD.

Thanks!

ludde's picture
Offline
Joined: 09/30/2008
Juice: 12
izaak wrote:Hi there, I'm
izaak wrote:

Hi there,

I'm going to implement 'price by weight' functionality for products. This is needed for a grocery store, for example, where things aren't sold by unit.

This adds two (optional) fields to products: Price by weight/unit toggle, and a Weight multiplier.

Products priced by weight are basically just added up differently when in the cart/order. Each line is calculated based on qty * price * weight * weight multiplier.

for example, 1 bushel of bananas * $0.99 * 2.5 * 1 = $2.475

The weight multiplier is there in case a store wants to price things by different weights. IE, they may choose grams as their unit, and 100 as the multiplier to price per 100g.

Ubercart is written very well (yay), and so I could just continue doing this in a seperate module, but I thought I should ask first if this is something desired in core. If so I'll offer more details of how I would implement it, from front to back, to get feedback. Then I could apply a patch against the HEAD.

Thanks!

I need the exact same thing. Any luck? Thanks /Ludvig

akblackwel's picture
Offline
Joined: 12/06/2011
Juice: 9
Re: Price by weight - approach?

Did you ever find a solution to this?

szydello's picture
Offline
Joined: 01/26/2012
Juice: 3
http://drupal.org/project/uc_custom_price

$item->price = $item->price;
if u want to price me multipled by 2,5
$item->price = $item->price *=2.5;

doesnt solve problem, but little tip