Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
注文した製品の一意の数量を取得する方法を知りたい
私はこれらを試しました(/renderer/default.phtmlで):
$_order = $this->getOrder();
$qnt = round($_order->getData('total_qty_ordered'), 0); しかし、これは製品の総数を返し、異なる製品の合計のみが必要です。
ありがとう!
注文の表示可能なアイテムをロードすることで、さまざまな製品の数を取得できます (Magento は構成可能な製品の 2 つの注文アイテムを格納し、1 つは親用で、もう 1 つは子用であるため、このメソッドはそのような場合に 1 つのアイテムのみを提供します)。配列エントリの数。
たとえば、次のようにします。
$_order = $this->getOrder(); $qnt = count($_order->getAllVisibleItems());