本文介绍了Magento:跟踪可下载产品链接的下载数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示Magento中可下载产品的任何可下载链接的下载次数.

I would like to display the number of downloads being done for any downloadable links of a downloadable product in Magento.

我认为Magento中没有这样的功能.

I don't think there is such feature in Magento.

似乎我们需要对其进行编程.

Seems we need to program it.

请帮忙吗?

推荐答案

查看downloadable_link_purchased_item表中的number_of_downloads_bought和number_of_downloads_used(Mage_Downloadable_Model_Link_Purchased_Item模型)

Look at the number_of_downloads_bought and number_of_downloads_used in downloadable_link_purchased_item table (Mage_Downloadable_Model_Link_Purchased_Item model)

Magento使用这些字段来定义用户可以下载文件的次数:

Magento uses those fields to define how many times user can download file:

$linkPurchased = Mage::getModel('downloadable/link_purchased')->load($linkPurchasedItem->getPurchasedId());
$downloadsLeft = $linkPurchasedItem->getNumberOfDownloadsBought()
    - $linkPurchasedItem->getNumberOfDownloadsUsed();

因此,您可以使用$ linkPurchasedItem-> getNumberOfDownloadsUsed()作为选定顺序的下载数量.如果您计算每个订单的下载数量,则可以获得下载总数.

So you can use $linkPurchasedItem->getNumberOfDownloadsUsed() as number of downloads in selected order. If you count number of doewnloads for every order you can get total number of downloads.

或者您可以创建自己的计数器来调用Mage_Downloadable_DownloadController :: _ processDownload()

Or you can make your own counter for calling Mage_Downloadable_DownloadController::_processDownload()

这篇关于Magento:跟踪可下载产品链接的下载数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:05