Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_GiftMessage_Block_Adminhtml_Product_Helper_Form_Config
  • Mage_GiftMessage_Block_Adminhtml_Sales_Order_Create_Form
  • Mage_GiftMessage_Block_Adminhtml_Sales_Order_Create_Giftoptions
  • Mage_GiftMessage_Block_Adminhtml_Sales_Order_Create_Items
  • Mage_GiftMessage_Block_Adminhtml_Sales_Order_View_Form
  • Mage_GiftMessage_Block_Adminhtml_Sales_Order_View_Giftoptions
  • Mage_GiftMessage_Block_Adminhtml_Sales_Order_View_Items
  • Mage_GiftMessage_Block_Message_Inline
  • Mage_GiftMessage_Helper_Data
  • Mage_GiftMessage_Helper_Message
  • Mage_GiftMessage_Helper_Url
  • Mage_GiftMessage_Model_Api
  • Mage_GiftMessage_Model_Api_V2
  • Mage_GiftMessage_Model_Message
  • Mage_GiftMessage_Model_Mysql4_Message
  • Mage_GiftMessage_Model_Mysql4_Message_Collection
  • Mage_GiftMessage_Model_Mysql4_Setup
  • Mage_GiftMessage_Model_Observer
  • Mage_GiftMessage_Model_Resource_Message
  • Mage_GiftMessage_Model_Resource_Message_Collection
  • Mage_GiftMessage_Model_Resource_Setup
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_GiftMessage
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * GiftMessage api
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_GiftMessage
 32:  * @author     Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_GiftMessage_Model_Api_V2 extends Mage_GiftMessage_Model_Api
 35: {
 36: 
 37:     /**
 38:      * Return an Array of Object attributes.
 39:      *
 40:      * @param Mixed $data
 41:      * @return Array
 42:      */
 43:     protected function _prepareData($data){
 44:         if (is_object($data)) {
 45:             $arr = get_object_vars($data);
 46:             foreach ($arr as $key => $value) {
 47:                 $assocArr = array();
 48:                 if (is_array($value)) {
 49:                     foreach ($value as $v) {
 50:                         if (is_object($v) && count(get_object_vars($v))==2
 51:                             && isset($v->key) && isset($v->value)) {
 52:                             $assocArr[$v->key] = $v->value;
 53:                         }
 54:                     }
 55:                 }
 56:                 if (!empty($assocArr)) {
 57:                     $arr[$key] = $assocArr;
 58:                 }
 59:             }
 60:             $arr = $this->_prepareData($arr);
 61:             return parent::_prepareData($arr);
 62:         }
 63:         if (is_array($data)) {
 64:             foreach ($data as $key => $value) {
 65:                 if (is_object($value) || is_array($value)) {
 66:                     $data[$key] = $this->_prepareData($value);
 67:                 } else {
 68:                     $data[$key] = $value;
 69:                 }
 70:             }
 71:             return parent::_prepareData($data);
 72:         }
 73:         return $data;
 74:     }
 75: 
 76:     /**
 77:      * Raise event for setting a giftMessage.
 78:      *
 79:      * @param String $entityId
 80:      * @param Mage_Core_Controller_Request_Http $request
 81:      * @param Mage_Sales_Model_Quote $quote
 82:      * @return stdClass
 83:      */
 84:     protected function _setGiftMessage($entityId, $request, $quote) {
 85:         $response = new stdClass();
 86:         $response->entityId = $entityId;
 87: 
 88:         /**
 89:          * Below code will catch exceptions only in DeveloperMode
 90:          * @see Mage_Core_Model_App::_callObserverMethod($object, $method, $observer)
 91:          * And result of Mage::dispatchEvent will always return an Object of Mage_Core_Model_App.
 92:          */
 93:         try {
 94:             Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method', array('request'=>$request, 'quote'=>$quote));
 95:             $response->result = true;
 96:             $response->error = '';
 97:         } catch (Exception $e) {
 98:             $response->result = false;
 99:             $response->error = $e->getMessage();
100:         }
101:         return $response;
102:     }
103: 
104: }
105: ?>
106: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0