本文介绍了以编程方式将礼品消息设置为现有订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一些代码,以在Magento中以编程方式向现有订单添加礼物消息.

I'm looking for a bit of code to add a gift message to existing order programmatically in Magento.

===================

====================

更新

我喜欢主持人(@Charles等)将该问题标记为不是真实的,即使它具有228个视图-显然没有人真正有同样的问题...大声笑,很高兴看到所有阅读本书的人都投票赞成它.您能说的具体些什么?大声笑

I like that moderators (@Charles, etc etc) flagged this question as not real even though it had 228 views - obviously no one really having same issue... lol Would be great to see up-vote from everyone who reads it. How much more specific can you be? lol

推荐答案

$giftMessage = Mage::getModel('giftmessage/message');
$giftMessage->setCustomerId($customer->getId());
$giftMessage->setSender('sender']);
$giftMessage->setRecipient('recepient');
$giftMessage->setMessage('message');
$giftObj = $giftMessage->save();
$order->setGiftMessageId($giftObj->getId());
$order->save();

这篇关于以编程方式将礼品消息设置为现有订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 07:47