本文整理汇总了PHP中Mage_Sales_Model_Order_Item::getProductOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Item::getProductOptions方法的具体用法?PHP Mage_Sales_Model_Order_Item::getProductOptions怎么用?PHP Mage_Sales_Model_Order_Item::getProductOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Item::getProductOptions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getItemOptions
/**
* Return custom options from item
*
* @see Mage_Sales_Block_Order_Item_Renderer_Default::getItemOptions()
* @return array
*/
protected function _getItemOptions(Mage_Sales_Model_Order_Item $item)
{
$result = array();
if ($options = $item->getProductOptions()) {
if (isset($options['options'])) {
$result = array_merge($result, $options['options']);
}
if (isset($options['additional_options'])) {
$result = array_merge($result, $options['additional_options']);
}
if (isset($options['attributes_info'])) {
$result = array_merge($result, $options['attributes_info']);
}
}
return $result;
}
示例2: getItemOrderOptions
/**
* Returns all the product options of the given item including additional_options and
* attributes_info.
*
* @param Mage_Sales_Model_Order_Item $item The item to return info from
* @return Array The item options
*/
function getItemOrderOptions($item)
{
$result = array();
if ($options = $item->getProductOptions()) {
if (isset($options['options'])) {
$result = array_merge($result, $options['options']);
}
if (isset($options['additional_options'])) {
$result = array_merge($result, $options['additional_options']);
}
if (!empty($options['attributes_info'])) {
$result = array_merge($options['attributes_info'], $result);
}
}
return $result;
}
示例3: hasSubscriptionOptions
/**
* Test if order item must be included in
* @param Mage_Sales_Model_Order_Item $OrderItem
*/
public function hasSubscriptionOptions($OrderItem)
{
$options = $OrderItem->getProductOptions();
if (isset($options['info_buyRequest'])) {
$periodTypeId = @$options['info_buyRequest']['aw_sarp_subscription_type'];
} else {
$periodTypeId = -1;
}
return $periodTypeId > 0;
}
示例4: _sendEmail
/**
* Send email to giftcard recipient
*
* @param Mage_Sales_Model_Order_Item $item
* @param int $numGiftCardsToSend
* @return void
*/
protected function _sendEmail($item, $numGiftCardsToSend)
{
if ($numGiftCardsToSend <= 0) {
return;
}
$options = $item->getProductOptions();
$createdGiftCardCodes = isset($options['giftcard_created_codes']) ? $options['giftcard_created_codes'] : array();
$sentCodes = isset($options['giftcard_sent_codes']) ? $options['giftcard_sent_codes'] : array();
$sentCodesQty = count($sentCodes);
$availableCodes = $sentCodesQty > 0 ? array_diff($createdGiftCardCodes, $sentCodes) : $createdGiftCardCodes;
if (count($availableCodes) <= 0) {
return;
}
$newlySentCodes = array();
$numNewlySentCodes = 0;
foreach ($availableCodes as $code) {
$newlySentCodes[] = $code;
$sentCodes[] = $code;
$numNewlySentCodes++;
if ($numNewlySentCodes == $numGiftCardsToSend) {
break;
}
}
$sender = $item->getProductOptionByCode('giftcard_sender_name');
$senderName = $item->getProductOptionByCode('giftcard_sender_name');
$senderEmail = $item->getProductOptionByCode('giftcard_sender_email');
if ($senderEmail) {
$sender = "{$sender} <{$senderEmail}>";
}
$isRedeemable = $this->_isGiftCardRedeemable($item);
$amount = $item->getBasePrice();
$store = Mage::app()->getStore($item->getOrder()->getStoreId());
$codeList = Mage::helper('enterprise_giftcard')->getEmailGeneratedItemsBlock()->setCodes($newlySentCodes)->setIsRedeemable($isRedeemable)->setStore($store);
$balance = Mage::app()->getLocale()->currency($store->getBaseCurrencyCode())->toCurrency($amount);
$templateData = array('name' => $item->getProductOptionByCode('giftcard_recipient_name'), 'email' => $item->getProductOptionByCode('giftcard_recipient_email'), 'sender_name_with_email' => $sender, 'sender_name' => $senderName, 'gift_message' => $item->getProductOptionByCode('giftcard_message'), 'giftcards' => $codeList->toHtml(), 'balance' => $balance, 'is_multiple_codes' => 1 < $numNewlySentCodes, 'store' => $store, 'store_name' => $store->getName(), 'is_redeemable' => $isRedeemable);
$email = Mage::getModel('core/email_template')->setDesignConfig(array('store' => $store->getId()));
$email->sendTransactional($item->getProductOptionByCode('giftcard_email_template'), Mage::getStoreConfig(Enterprise_GiftCard_Model_Giftcard::XML_PATH_EMAIL_IDENTITY, $store->getId()), $item->getProductOptionByCode('giftcard_recipient_email'), $item->getProductOptionByCode('giftcard_recipient_name'), $templateData);
$options['giftcard_sent_codes'] = $sentCodes;
if ($email->getSentSuccess()) {
$options['email_sent'] = 1;
}
$item->setProductOptions($options);
return;
}
示例5: _getOrderItemOptions
/**
* @param Mage_Sales_Model_Order_Item $orderItem
*
* @return array
*/
protected function _getOrderItemOptions($orderItem)
{
$orderItemOptions = $orderItem->getProductOptions();
//if product doesn't have options
if (!array_key_exists('options', $orderItemOptions)) {
return array();
}
$orderItemOptions = $orderItemOptions['options'];
//if product options isn't array
if (!is_array($orderItemOptions)) {
return array();
}
$options = array();
foreach ($orderItemOptions as $orderItemOption) {
if (array_key_exists('value', $orderItemOption) && array_key_exists('label', $orderItemOption)) {
$label = str_replace(' ', '-', $orderItemOption['label']);
$options[][$label] = $orderItemOption['value'];
}
}
return $options;
}
示例6: getAdminProductSku
/**
* Retrieves RMA item sku for backend
*
* @param Mage_Sales_Model_Order_Item $item
* @return string
*/
public function getAdminProductSku($item)
{
$name = $item->getSku();
if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
$productOptions = $item->getProductOptions();
return $productOptions['simple_sku'];
}
return $name;
}