在 Drupal 中乘以 Ubercart 中的对象重量选项

发布于 2024-10-10 17:27:31 字数 473 浏览 0 评论 0原文

我正在使用 Ubercart 创建一家商店,销售按尺寸切割的金属。

一块金属的价格算法是(宽度*长度*厚度)*每磅成本。

我安装了自定义价格计算模块(uc_custom_price)将选项相乘(因为目前它只是将重量的重量相加)选项一起)。

我基本上想输出以下行 - 但我不确定语法是否正确? (我还使用了 uc_attribute_tokens 模块来帮助简化代码。)

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

这是开发的屏幕截图:
screenshot

谢谢。

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 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:
screenshot

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云朵有点甜 2024-10-17 17:27:32

无法找到您在 jpg 中描述的所有元素。
对于正确的语法用户此逻辑:

  • 用于传递对象使用 ->用于
  • 传递数组 user ['key']

如果您想访问权重,例如使用

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

那么您可以使用 $weight

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文