在内容创建上设置 UberCart 库存水平?

发布于 2024-09-30 23:44:00 字数 98 浏览 0 评论 0原文

目前,如果您在 UberCart 中创建产品,则必须先创建产品,然后才能访问库存选项卡以设置库存水平。我希望能够在创建产品时设置库存水平。即就在我设置“标价”的地方下方。我该怎么做?

Currently if you create a product in UberCart, you have to first create the product before accessing the stock tab to set stock levels. I want to be able to set the stock levels when I create the product. I.e. Right below where I set the "list price". How would I do this?

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

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

发布评论

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

评论(2

帅冕 2024-10-07 23:44:00

嗯,这需要做一些工作。

  1. 您必须创建一个 hook_form_alter 实现来将新的表单字段添加到 node_add/node_edit 表单中。
  2. 您需要为 $op=='validate' 添加 hook_nodeapi() 实现,以确保您获得有效的信息。
  3. 然后,您需要扩展 $op=='insert' 和 'update' 的 hook_nodeapi() 实现,以获取字段值(应粘贴到 $node 对象)并将其写入库存水平表,我现在懒得查他的名字。

或者,您可以创建一个验证和提交函数,而不是 2 和 3,并将它们附加到表单的 #validate 和 #submit 数组中。

Well, that's going to involve a little work.

  1. You're going to have to create a hook_form_alter implementation to add the new form fields to the node_add/node_edit form.
  2. You're going to want to add a hook_nodeapi() implementation for $op=='validate' to make sure you're getting valid information.
  3. You're then going to want to extend that hook_nodeapi() implementation for $op=='insert' and 'update' to grab the field value (which should be stuck to the $node object) and write it to the stock levels table, whose name I'm too lazy to look up right now.

Alternately, instead of 2 and 3, you could mess around with creating a validation and submit function, and append them to the #validate and #submit arrays of the form.

泅人 2024-10-07 23:44:00

对于在 Drupal 7 中寻找基于模块的解决方案来解决此问题的人们,“Ubercart Product Power Tools”模块的最新开发版本具有出色的每个产品设置,可以在创建时激活库存跟踪,并设置默认值产品的库存数量和阈值。

For people looking for a module-based solution to this problem in Drupal 7, the latest dev version of the "Ubercart Product Power Tools" module has an excellent per-product setting to make stock-tracking active on creation, as well as set default stock quantity and threshold for the product.

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