开发者

Multiplying object weight options in Ubercart in Drupal

I am creating a store using Ubercart that sells metal cut to size.

The algorithm for the price of a piece of metal is (Width * Length * Thickness) * cost per lb.

I installed the module of Custom Price Calculation (uc_custom_price) to multiply the options together (because currently it simply adds the weights of the weight options together).

I basically want to come开发者_JAVA百科 out with the following line - but I'm unsure of the correct syntax? (I also used the module of uc_attribute_tokens to help simplify the code.)

$item->weight = [LengthFeet][weight] * [WidthFeet][weight] * [Gauge][weight];  
$item->price = $item->cost * $item->weight;

Here is a screenshot of the devel:

Multiplying object weight options in Ubercart in Drupal

Thank you.


Couldn't find all the elements you described at the jpg. For the right syntax user this logic:

  • for passing on object use -> for
  • passing on array user ['key']

If you want to access weight for example use

$weight = $dev_var->options['115']->weight;

Then you can work with $weight

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜