如何以编程方式更新客户商店信用额 [英] How do I update customer store credit programmatically
问题描述
我正在使用Magento版本. 1.9.1.1.我需要为客户更新商店信用余额.我知道可以在Magento管理界面中执行此操作,但就我而言,我需要向服务器发出HTTP请求,并且实际上要进行与通过Magento管理界面相同的操作.
I'm working with Magento ver. 1.9.1.1. and I need to update store credit balance for a customer. I know that it's possible to do it in Magento admin interface, but in my case I need to do an HTTP request to a server and actually do the same manipulations as we can do via Magento admin interface.
在互联网上,我找到了代码,该代码可以创建贷项凭证.我是否必须创建一个贷项凭单来更新客户商店的贷方余额,还是没有必要?
On the internet I found a code which allows to create a Credit Memo. Does I have to create a credit Memo to update customer store credit balance or it's not necessary?
有人知道该怎么做吗?
我很感谢您的回答.谢谢.
I appreciate any answers. Thank you.
推荐答案
尝试一下
$balance = Mage::getModel('enterprise_customerbalance/balance')
->setCustomer($customer)
->setWebsiteId($websiteId)
->setAmountDelta($anyNumber)
->setComment($data['comment']);
$balance->save();
在customerBalance模块的观察器中进一步查看功能customerSaveAfter()
take more look at function customerSaveAfter() in observer of customerBalance module
这篇关于如何以编程方式更新客户商店信用额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!