RE: Product Attributes to Product Options

Ajeh <[email protected]>
Newsgroups gmane.comp.web.oscommerce.general
Message-ID <cf093ca8744ace1061d155e5714a7dc2@osCommerce-Forums>
This message was sent from: General Support
http://forums.oscommerce.com/viewtopic.php?p=227942#227942
----------------------------------------------------------------

[quote="tmorton"]Hello,
Thanks for the reply...I started out doing that, but since all the weights will be the same (1 pound of beets will weigh the same as 1 pound of lettuce :lol:), I though it would be better to put it in the options values instead. (Maybe...anyway).
Anyway, how can I access the selected option value for an item in the shopping cart?

Nice mods, by the way.  8) 
Thanks, Taj[/quote]

The easiest thing to do is make a lookup function to get the weight.

Then, you can edit the /includes/classes/shopping_cart.php and orders.php to obtain the info.

The reason I use the products_attributes table instead is that all of the functions, processing and calculations you need flow better when everything happens in the same manner.

Example: price_prefix and options_values_price are used in the calculation of $total ... if you added the weight in the products_attributes table you can follow that pattern through all the code and adjust the $weight to use the new weight in an easier manner.

Sometimes it's easier to follow an existing field that behaves in a like manner to what you are trying to do than it is to modify un unrelated table/field to perform a function.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.