Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Additional column for lengths, is it possible


cb

Recommended Posts

Posted

Hi all,

 

I have a store that sells things by the length. So far I have not been able to come up with a good method of allowing customers to select the length of an item they want to purchase.

 

For example, if someone wants to buy string, is there a way to add a column saying "length", and have that multiply by the cost of the string per metre to come up with the total cost ?

 

Any help would be great.

 

Craig.

Posted

Maybe this is too simplistic for your needs - but why not just price it per metre then they can enter multiple quantities. Just state in your description that the price is per metre and to indicate quantities after they have added the item to the cart.

 

Each item can be priced differently and just explained in the description. You can price per metre on one thing and per yard on another thing.

 

Just a thought.

 

Eileen

Posted

Do you sell limited / fixed measures? If so you could use attributes but I assume someone needs to be able to order 2.365 meters of string too?

 

You will need new fields in the db because you will also need to record the actual length people want to use all the things like 'Order History' etc. That means you will have to change the shopingcart table, the orders table, the shoppingcart functions and all the queries/pages that refer to those tables in both admin / catalog.

 

Quite a big jobbie...

 

But fortunately you could also 'fraud' it:

 

Just have the text field, adapt the shoppingcart functions to calculate the new price

 

Total Price: ($unit_price * $length) and use that instead of the product price from the db.

 

Then on the Admin side / any page you want to show the length you do an extra bit of code that says

 

'Length: ($total_price / $unit_price)'

 

Drop that into a function which you can just call whenever you want to show the length. Print it under the $title or something.

 

The only major drawback is this idea will be 'global' on you site... any product will have that calculation. To prevent that you can play with the product_model. So you'd call any 'price per unit' article PPU_XXXXX and check that upon cart insertion. If it's a PPU_ use your new price-creation if not use the stock one. Same goes for the 'show_length' function.

 

HTH

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

  • 2 weeks later...
Posted

Exactly, the problem is that products are sold in any length that is defined by the customer; 2.43m of string is a good example. So, do you think that the best way to do is "fraud" it, because I am happy to do it the easiest way possible if it makes the site able to calculate pricing by length. Do you think that the best method is described in the above post?

 

Thanks again.

 

Craig

Posted

The 'best' way of doing things is quite personal. I would probably do it like mentioned in the above post. But as time goes by you might find that has drawbacks... can't tell because my above post is a general idea of doing things, I have never coded that particular functionality nor tested it.

 

If you want to do it the 'proper' way you do it with database field(s). It is more complex and time consuming but also more transparent and clean in the osCommerce core.

 

At the end of the day such a decision relies on

 

-time (what is faster to do)

-budget (what will it cost)

-knowledge (could I do it myself)

 

 

HTH

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Posted

Well, I would like it completed quickly, I can learn another language to do it myself, but if I was to seek external help, have you any idea of the cost involved?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...