如何查找 Ubercart 中特定属性选项订购的产品数量?
我正在尝试为 Ubercart/Drupal 制作一个自定义订单摘要模块,该模块将显示如下信息:
S M L Prod1 10 20 40 Prod2 0 15 0
其中 S
、M
和 L
是自定义属性(在本例中为尺寸)的选项,数字是每种尺寸的每种产品的订购数量。
我注意到所选选项是在数据库的 uc_order_products
表中产品的 data
字段中指定的。如果有人能告诉我找到所有包含特定属性的特定选项的 uc_order_products 行的好方法,我就可以计算出所有算术和所有内容。我什至很乐意使用一种简单的方法来将 data
字段作为对象或关联数组返回。
涉及 Ubercart API 的替代解决方案也受到欢迎,但从我在文档中看到的情况来看,似乎并没有真正适合此类事情的功能。
谢谢!
I'm trying to make a custom order summary module for Ubercart/Drupal that will display information something like this:
S M L Prod1 10 20 40 Prod2 0 15 0
where S
, M
, and L
are options for a custom attribute (size in this case), and the numbers are the quantities ordered of each product of each size.
I notice that the selected option is specified in the data
field for the product in the uc_order_products
table of the database. I can figure out all the arithmetic and everything if someone can tell me a good way of finding all the uc_order_products
rows which contain a specific option for a specific attribute. I'd even be happy with just a simple way to return the data
field as an object or associative array.
Alternate solutions involving Ubercart's API are also welcome, but from what I saw in the docs, there don't really appear to be functions for this kind of thing.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 PHP 自己的
unserialize()
中找到了答案。我从未有过 PHP 序列化的经验,所以当我看到它时我不认识它的格式。I found my answer in PHP's own
unserialize()
. I'd never had any experience with serialization in PHP, so I didn't recognize the format when I saw it.