0

I have an ubercart product with multiple options that need to be charged per person. I've created an attribute called Number of People with a select box for numbers 20-40.

I need to multiply

(the price after the addition of the selected options) * Number of People

I am using Ubercart Custom Price which allows me to do the necessary math but I am not sure how to access the user selected value of Number of People.

So basically I need:

$item->price = $item->price * ['number_of_people']

I don't see anyway to access the Number of People from the $item object. Any Ideas? Thanks

admdrew
  • 3,790
  • 4
  • 27
  • 39
Eric
  • 17
  • 6

2 Answers2

0

You can use the uc_attribute_tokens module to get the value of the attribute "Number of People" on the calculation, both modules integrate. Check the README.txt file on the module for the token you need to use, it will be something like: [number of people].

bluish
  • 26,356
  • 27
  • 122
  • 180
Edgard
  • 16
  • You are correct, I probably should have mentioned I was using drupal 7, ubercart 3. I actually scrapped the entire site in favor of Drupal 6, at least until important modules like this one are ported. – Eric May 09 '12 at 13:06
0

Here's what my calculation ended up looking like:

$item->price *= '[people]'; or $item->price = $item->price * '[people]';

those single quotes are important, I saw no mention of them in any of the attribute_tokens_module documentation or examples, but without them i kept getting the error, ...unexpected '[' in...

Eric
  • 17
  • 6