显示所有疯狂的电子商务产品以及他们的现场计数 [英] Show all spree ecommerce products together with their count-on-hand displayed

查看:75
本文介绍了显示所有疯狂的电子商务产品以及他们的现场计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Spree Commerce中将所有产品及其数量一起显示?我唯一看到实现count_on_hand的地方是在admin / stock_transfers中,即使如此,管理员也要点击几下。

How can I show all products and their counts together in one place in Spree Commerce? The only place I see the count_on_hand implemented is in admin/stock_transfers and even then it's several clicks deep for the administrator.

 admin --> configuration --> stock transfers --> view transfer

,然后您会看到每个项目上显示的手头计数。

and then you can see a count on hand variable displayed per item.

推荐答案

每种产品都有在此处定义的总计方法:

Each product has a total on hand method defined here:

https://github.com/spree /spree/blob/v2.2.2/core/app/models/spree/product.rb#L200-L206

您可以迭代所有产品,并致电total_on_hand查找现有产品的数量(针对所有变体和库存位置)。

You can iterate through all products, and call total_on_hand to find the number of those products on hand (for all variants and stock locations).

这篇关于显示所有疯狂的电子商务产品以及他们的现场计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆