public static function createFromCustomer(Mage_Customer_Model_Customer $customer) { /** @var Mage_Log_Model_Customer $logCustomer */ $logCustomer = Mage::getModel('log/customer')->loadByCustomer($customer->getId()); switch ($customer->getGender()) { case '1': $gender = 1; break; case '2': $gender = 2; break; default: $gender = 0; } $aCustomer = new self(); $aCustomer->email = $customer->getEmail(); $aCustomer->type = 'e'; $aCustomer->gender = $gender; $aCustomer->id = $customer->getId(); $aCustomer->first_name = $customer->getFirstname(); $aCustomer->last_name = $customer->getLastname(); if (($birthday = $customer->getDob()) !== null) { $aCustomer->birthday = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime($birthday)); } if (($document_id = $customer->getTaxvat()) !== null) { $aCustomer->document_id = $document_id; } $aCustomer->date_joined = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime('@' . $customer->getCreatedAtTimestamp())); if (($lastLogin = $logCustomer->getLoginAtTimestamp()) != null) { $aCustomer->last_login = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime('@' . $lastLogin)); } return $aCustomer; }
public function load($printQuery = false, $logQuery = false) { $this->_select = $this->_read->select(); $entityTable = $this->getEntity()->getEntityTable(); $paidTable = $this->getAttribute('grand_total')->getBackend()->getTable(); $idField = $this->getEntity()->getIdFieldName(); $this->getSelect()->from(array('sales' => $entityTable), array('store_id', 'lifetime' => 'sum(sales.base_grand_total)', 'avgsale' => 'avg(sales.base_grand_total)', 'num_orders' => 'count(sales.base_grand_total)'))->where('sales.entity_type_id=?', $this->getEntity()->getTypeId())->group('sales.store_id'); if ($this->_customer instanceof Mage_Customer_Model_Customer) { $this->getSelect()->where('sales.customer_id=?', $this->_customer->getId()); } $this->printLogQuery($printQuery, $logQuery); try { $values = $this->_read->fetchAll($this->getSelect()->__toString()); } catch (Exception $e) { $this->printLogQuery(true, true, $this->getSelect()->__toString()); throw $e; } $stores = Mage::getResourceModel('core/store_collection')->setWithoutDefaultFilter()->load()->toOptionHash(); if (!empty($values)) { foreach ($values as $v) { $obj = new Varien_Object($v); $storeName = isset($stores[$obj->getStoreId()]) ? $stores[$obj->getStoreId()] : null; $this->_items[$v['store_id']] = $obj; $this->_items[$v['store_id']]->setStoreName($storeName); $this->_items[$v['store_id']]->setAvgNormalized($obj->getAvgsale() * $obj->getNumOrders()); foreach ($this->_totals as $key => $value) { $this->_totals[$key] += $obj->getData($key); } } if ($this->_totals['num_orders']) { $this->_totals['avgsale'] = $this->_totals['lifetime'] / $this->_totals['num_orders']; } } return $this; }
/** * Set customer filter * * @param Mage_Customer_Model_Customer $customer * @return Mage_Customer_Model_Resource_Address_Collection */ public function setCustomerFilter($customer) { if ($customer->getId()) { $this->addAttributeToFilter('parent_id', $customer->getId()); } else { $this->addAttributeToFilter('parent_id', '-1'); } return $this; }
/** * Load subscriber by customer * * @param Mage_Customer_Model_Customer $customer * @return array */ public function loadByCustomer(Mage_Customer_Model_Customer $customer) { $select = $this->_read->select()->from($this->getMainTable())->where('customer_id=:customer_id'); Mage::fireLog($customer->getId(), "loadByCustomer"); $result = $this->_read->fetchRow($select, array('customer_id' => $customer->getId())); if ($result) { return $result; } $select = $this->_read->select()->from($this->getMainTable())->where('subscriber_email=:subscriber_email'); $result = $this->_read->fetchRow($select, array('subscriber_email' => $customer->getEmail())); if ($result) { return $result; } return array(); }
public function assignCustomerWithAddressChange(Mage_Customer_Model_Customer $customer, Mage_Sales_Model_Quote_Address $billingAddress = null, Mage_Sales_Model_Quote_Address $shippingAddress = null) { if ($customer->getId()) { $this->setCustomer($customer); if (!is_null($billingAddress)) { $this->setBillingAddress($billingAddress); } else { $defaultBillingAddress = $customer->getDefaultBillingAddress(); if ($defaultBillingAddress && $defaultBillingAddress->getId()) { $billingAddress = Mage::getModel('request4quote/quote_address')->importCustomerAddress($defaultBillingAddress); $this->setBillingAddress($billingAddress); } } if (is_null($shippingAddress)) { $defaultShippingAddress = $customer->getDefaultShippingAddress(); if ($defaultShippingAddress && $defaultShippingAddress->getId()) { $shippingAddress = Mage::getModel('request4quote/quote_address')->importCustomerAddress($defaultShippingAddress); } else { $shippingAddress = Mage::getModel('request4quote/quote_address'); } } $this->setShippingAddress($shippingAddress); } return $this; }
/** * EITHER CREATE OR UPDATE THE CUSTOMER * * TO CREATE * http://help.paytrace.com/api-create-customer-profile * * TO UPDATE * http://help.paytrace.com/api-update-customer-profile * * TO DELETE * if $card is empty then we delete the card from paytrace * * @param Mage_Customer_Model_Customer $customer */ public function paytraceCustomer(Mage_Customer_Model_Customer $customer, Widgetized_Level3_Model_Card $card = null) { $defaults = array('UN' => $this->getConfigData('login'), 'PSWD' => $this->getConfigData('trans_key'), 'TERMS' => 'Y', 'METHOD' => 'CreateCustomer', 'CUSTID' => $customer->getId(), 'BNAME' => $customer->getFirstname() . ' ' . $customer->getLastname(), 'CC' => '', 'EXPMNTH' => '', 'EXPYR' => ''); $addressId = $customer->getDefaultBilling(); $billing = Mage::getModel('sales/order_address')->load($addressId); if ($billing) { $defaults['BADDRESS'] = $billing->getPostcode(); $defaults['BCITY'] = $billing->getCity(); $defaults['BSTATE'] = $billing->getRegion(); $defaults['BZIP'] = $billing->getPostcode(); $defaults['BCOUNTRY'] = $billing->getCountryId(); } if ($card) { $defaults['CC'] = $card->getNumber(); $defaults['EXPMNTH'] = $card->getMonth(); $defaults['EXPYR'] = $card->getYear(); } try { $result = $this->call(array_keys($defaults), $defaults); } catch (Exception $ex) { $message = $this->__($ex->getMessage()); if ($card) { $card->setToken($message); $card->save(); } } }
/** * Check whether tab can be showed * * @return bool */ public function canShowTab() { if (!$this->_customer) { return false; } return $this->_customer->getId() && $this->_authSession->isAllowed('Mage_Tag::tag'); }
/** * @param \Mage_Customer_Model_Customer $customer * @return $this */ public function withCustomer($customer) { $this->attributes['customer_id'] = $customer->getId(); $this->attributes['firstname'] = $customer->getFirstname(); $this->attributes['lastname'] = $customer->getLastname(); return $this; }
public function getSubAccounts(Mage_Customer_Model_Customer $customer) { /** @var $collection Cminds_MultiUserAccounts_Model_Resource_SubAccount_Collection */ $collection = $this->getCollection(); $collection->addFieldToFilter('parent_customer_id', $customer->getId()); return $collection; }
/** * @param Mage_Customer_Model_Customer $customer */ protected function _sales(&$customer) { $orderTable = $this->_getCoreResource()->getTableName("sales_flat_order"); $_result = $this->_getAdapter()->select()->from($orderTable, array("first_purchase" => new Zend_Db_Expr("MIN(`created_at`)"), "last_purchase" => new Zend_Db_Expr("MAX(`created_at`)"), "purchases_number" => new Zend_Db_Expr("COUNT(`created_at`)"), "lifetime_sales" => new Zend_Db_Expr("SUM(`grand_total`)")))->where("customer_id = ?", $customer->getId()); $customer->addData($this->_getAdapter()->fetchRow($_result)); //setting new data to customer }
/** * Save customer * * @param Mage_Customer_Model_Customer $order */ protected function _saveCustomerAfterOrder($order) { if ($this->_customer) { if (!$this->_customer->getId()) { $this->_customer->save(); $order->setCustomerId($this->_customer->getId()); $this->getBillingAddress()->setCustomerId($this->_customer->getId()); $this->getShippingAddress()->setCustomerId($this->_customer->getId()); $this->_customer->sendNewAccountEmail(); } else { $saveCusstomerAddress = false; if ($this->getBillingAddress()->getSaveInAddressBook()) { $billingAddress = $this->getBillingAddress()->exportCustomerAddress(); if ($this->getBillingAddress()->getCustomerAddressId()) { $billingAddress->setId($this->getBillingAddress()->getCustomerAddressId()); } $this->_customer->addAddress($billingAddress); $saveCusstomerAddress = true; } if ($this->getShippingAddress()->getSaveInAddressBook()) { $shippingAddress = $this->getShippingAddress()->exportCustomerAddress(); if ($this->getShippingAddress()->getCustomerAddressId()) { $shippingAddress->setId($this->getShippingAddress()->getCustomerAddressId()); } $this->_customer->addAddress($shippingAddress); $saveCusstomerAddress = true; } if ($saveCusstomerAddress) { $this->_customer->save(); } } } }
/** * Setter for $_customer * * @param Mage_Customer_Model_Customer $customer * @return Enterprise_Checkout_Model_Cart */ public function setCustomer($customer) { if ($customer instanceof Varien_Object && $customer->getId()) { $this->_customer = $customer; $this->_quote = null; } return $this; }
public function subscribe(Mage_Customer_Model_Customer $parent, $email, $name, $msg = "") { $this->setReferralParentId($parent->getId())->setReferralEmail($email)->setReferralName($name); if ($this->sendSubscription($parent, $email, $name, $msg)) { return $this->save(); } return false; }
/** * @param Mage_Customer_Model_Customer $customer */ protected function _moveAttributesData($customer) { $attributes = array('po_limit' => $this->_poLimitId, 'po_credit' => $this->_poCreditId); foreach ($attributes as $attributeCode => $attributeId) { try { $select = $this->_db->select()->from($customer->getResource()->getTable('customer_entity_int'), array('value'))->where('attribute_id = ?', $attributeId)->where('entity_id = ?', $customer->getId()); $value = $this->_db->fetchOne($select); if ((int) $value > 0) { $this->_db->insert($customer->getResource()->getTable('customer_entity_decimal'), array('entity_type_id' => $customer->getEntityTypeId(), 'attribute_id' => $attributeId, 'entity_id' => $customer->getId(), 'value' => (int) $value)); } } catch (Exception $e) { } try { $this->_db->delete($customer->getResource()->getTable('customer_entity_int'), 'entity_type_id = ' . $customer->getEntityTypeId() . ' AND attribute_id = ' . $attributeId . ' AND ' . 'entity_id = ' . $customer->getId()); } catch (Exception $e) { } } }
public function getAllPasswordHashesForCustomer(Mage_Customer_Model_Customer $customer) { $passwordHashes = []; $records = $this->getCollection()->addFilter('customer_id', $customer->getId()); foreach ($records as $record) { array_push($passwordHashes, $record->getPasswordHash()); } return $passwordHashes; }
/** * Check customer's group * * @param Mage_Customer_Model_Customer $customer * * @return bool */ public function validateCustomerGroup($customer) { if (!$this->getId() || !$customer->getId()) { return FALSE; } $customerGroupId = $customer->getData('group_id'); $couponGroupIds = $this->getData('customer_group_ids'); $result = in_array($customerGroupId, $couponGroupIds); return $result; }
/** * Set the customer account (if any) for the card. */ public function setCustomer(Mage_Customer_Model_Customer $customer, Mage_Payment_Model_Info $payment = null) { if ($customer->getEmail() != '') { $this->setCustomerEmail($customer->getEmail()); /** * Make an ID if we don't have one (and hope this doesn't break anything) */ if ($customer->getId() < 1) { $customer->save(); } $this->setCustomerId($customer->getId()); parent::setCustomer($customer); } elseif (!is_null($payment)) { $model = null; /** * If we have no email, try to find it from current scope data. */ if ($payment->getQuote() != null && $payment->getQuote()->getBillingAddress() != null && $payment->getQuote()->getBillingAddress()->getCustomerEmail() != '') { $model = $payment->getQuote(); } elseif ($payment->getOrder() != null && ($payment->getOrder()->getCustomerEmail() != '' || $payment->getOrder()->getBillingAddress() != null && $payment->getOrder()->getBillingAddress()->getCustomerEmail() != '')) { $model = $payment->getOrder(); } else { /** * This will fall back to checkout/session if onepage has no quote loaded. * Should work for all checkouts that use normal Magento processes. */ $model = Mage::getSingleton('checkout/type_onepage')->getQuote(); } if (!is_null($model)) { if ($model->getCustomerEmail() == '' && $model->getBillingAddress() instanceof Varien_Object && $model->getBillingAddress()->getEmail() != '') { $model->setCustomerEmail($model->getBillingAddress()->getEmail()); } if ($model->hasEmail()) { $this->setCustomerEmail($model->getEmail()); } elseif ($model->hasCustomerEmail()) { $this->setCustomerEmail($model->getCustomerEmail()); } $this->setCustomerId(intval($model->getCustomerId())); } } return $this; }
protected function _saveAddresses(Mage_Customer_Model_Customer $customer) { foreach ($customer->getAddresses() as $address) { if ($address->getData('_deleted')) { $address->delete(); } else { $address->setParentId($customer->getId())->setStoreId($customer->getStoreId())->save(); } } return $this; }
/** * Fetch dealer IDs for a given customer and attach to the customer object * * @param Mage_Customer_Model_Customer $customer * @return Gorilla_ChasePaymentech_Model_Mysql4_Profile */ public function loadInfoByCustomer($customer) { $read = $this->_getReadAdapter(); if ($read) { $select = $read->select()->from($this->getMainTable(), array('id', 'customer_ref_num', 'is_default'))->where('customer_id = ?', $customer->getId()); if ($data = $read->fetchRow($select)) { $customer->setChasePaymentechCustomerRefNum($data['customer_ref_num'])->setChasePaymentechProfileId($data['id']); } } return $this; }
/** * @param $customer * @return string */ private function getReporter(Mage_Customer_Model_Customer $customer) { if ($this->_reporter) { return $this->_reporter; } $model = Mage::getModel('eltrino_diamantedesk/customerRelation')->load($customer->getId(), 'customer_id'); if ($model->getId()) { return Eltrino_DiamanteDesk_Model_Api::TYPE_DIAMANTE_USER . $model->getUserId(); } return ''; }
/** * Add transaction that change customer reward point balance * * @param string $actionCode * @param Mage_Customer_Model_Customer $customer * @param type $object * @param array $extraContent * @return Magestore_RewardPoints_Model_Transaction */ public function addTransaction($actionCode, $customer, $object = null, $extraContent = array()) { Varien_Profiler::start('REWARDPOINTS_HELPER_ACTION::addTransaction'); if (!$customer->getId()) { throw new Exception($this->__('Customer must be existed.')); } $actionModel = $this->getActionModel($actionCode); /** @var $actionModel Magestore_RewardPoints_Model_Action_Interface */ $actionModel->setData(array('customer' => $customer, 'action_object' => $object, 'extra_content' => $extraContent))->prepareTransaction(); $transaction = Mage::getModel('rewardpoints/transaction'); if (is_array($actionModel->getData('transaction_data'))) { $transaction->setData($actionModel->getData('transaction_data')); } $transaction->setData('point_amount', (int) $actionModel->getPointAmount()); if (!$transaction->hasData('store_id')) { $transaction->setData('store_id', Mage::app()->getStore()->getId()); } $transaction->createTransaction(array('customer_id' => $customer->getId(), 'customer' => $customer, 'customer_email' => $customer->getEmail(), 'title' => $actionModel->getTitle(), 'action' => $actionCode, 'action_type' => $actionModel->getActionType(), 'created_time' => now(), 'updated_time' => now())); Varien_Profiler::stop('REWARDPOINTS_HELPER_ACTION::addTransaction'); return $transaction; }
/** * @param Mage_Customer_Model_Customer|integer $customer * * @return AW_Followupemail_Model_Mysql4_Unsubscribe_Collection */ public function addCustomerFilter($customer) { if ($customer instanceof Mage_Customer_Model_Customer) { $customerId = $customer->getId(); } elseif (is_numeric($customer)) { $customerId = $customer; } else { return $this; } $this->addFieldToFilter('customer_id', $customerId); return $this; }
/** * Retrieve customer model object * * @return Mage_Customer_Model_Customer */ public function getCustomer() { if (is_null($this->_customer)) { $this->_customer = Mage::getModel('customer/customer'); if ($customerId = $this->getCustomerId()) { $this->_customer->load($customerId); if (!$this->_customer->getId()) { $this->_customer->setCustomerId(null); } } } return $this->_customer; }
public function getUrl(Mage_Customer_Model_Customer $customer) { switch (Mage::helper('rewardsref')->getReferralUrlStyle()) { case TBT_RewardsReferral_Helper_Data::REWARDSREF_URL_STYLE_EMAIL: $url_data = array('email' => urlencode($customer->getEmail())); break; case TBT_RewardsReferral_Helper_Data::REWARDSREF_URL_STYLE_CODE: $url_data = array('code' => urlencode(Mage::helper('rewardsref/code')->getCode($customer->getEmail()))); break; default: $url_data = array('id' => $customer->getId()); } $url = Mage::getUrl('rewardsref/index/refer', $url_data); return $url; }
/** * @param array $addressesData * @dataProvider createWithAddressesDataProvider */ public function testCreateWithAddresses($addressesData) { $customerData = array('firstname' => 'ServiceTest', 'lastname' => 'CreateWithAddress', 'email' => 'test' . mt_rand(1000, 9999) . '@mail.com'); $this->_createdCustomer = $this->_model->create($customerData, $addressesData); $this->assertCount(count($addressesData), $this->_createdCustomer->getAddresses()); /** @var Mage_Customer_Model_Customer $loadedCustomer */ $loadedCustomer = $this->_customerFactory->create()->load($this->_createdCustomer->getId()); $createdData = array(); /** @var Mage_Customer_Model_Address $address */ foreach ($loadedCustomer->getAddresses() as $address) { $addressData = current($addressesData); $createdData[] = $address->toArray(array_keys($addressData)); next($addressesData); } $this->assertEquals($this->_getSortedByKey($createdData, 'firstname'), $this->_getSortedByKey($addressesData, 'firstname')); }
public function getCustomerData(Mage_Customer_Model_Customer $customer) { if (!$customer->getId()) { return array('customer_is_guest' => 1); } $data = $customer->getData(); if (isset($data['dob'])) { $data['customer_dob'] = $this->getFormatedDate($data['dob']); } if (isset($data['gender'])) { $data['gender'] = $this->getOptionById($data['gender'])->getValue(); } $data = new Varien_Object($data); Mage::dispatchEvent('ves_pdfpro_data_prepare_after', array('source' => $data, 'model' => $customer, 'type' => 'customer')); return $data->getData(); }
public function setOrderInfo(Varien_Object $sourceOrder, Mage_Customer_Model_Customer $sourceCustomer, $product) { Mage::app()->setCurrentStore(0); $this->_product = $this->getProduct(); $this->_sourceOrder = $sourceOrder; $this->_sourceCustomer = Mage::getModel('customer/customer')->load($sourceCustomer->getId()); $billingaddress = Mage::getModel('customer/address')->load($this->_sourceCustomer->default_billing); $shippingaddress = Mage::getModel('customer/address')->load($this->_sourceCustomer->default_shipping); //You can extract/refactor this if you have more than one product, etc. /* $this->_product = Mage::getModel('catalog/product')->getCollection() ->addAttributeToFilter('sku', 'Some value here...') ->addAttributeToSelect('*') ->getFirstItem(); */ //Load full product data to product object /* $this->_product->load($this->_product->getId()); */ $this->orderData = array('session' => array('customer_id' => $this->_sourceCustomer->getId(), 'store_id' => $this->_storeId), 'payment' => array('method' => 'checkmo'), 'add_products' => array($this->_product->getId() => array('qty' => 1, 'orignal_custom_price' => 10)), 'order' => array('currency' => 'USD', 'account' => array('group_id' => $this->_groupId, 'email' => $this->_sourceCustomer->getEmail()), 'billing_address' => array('customer_address_id' => $this->_sourceCustomer->getCustomerAddressId(), 'prefix' => '', 'firstname' => $this->_sourceCustomer->getFirstname(), 'middlename' => '', 'lastname' => $this->_sourceCustomer->getLastname(), 'suffix' => '', 'company' => '', 'street' => array($billingaddress->getStreet(), ''), 'city' => $billingaddress->getCity(), 'country_id' => $billingaddress->getCountryId(), 'region' => '', 'region_id' => $billingaddress->getRegionId(), 'postcode' => $billingaddress->getPostcode(), 'telephone' => $billingaddress->getTelephone(), 'fax' => ''), 'shipping_address' => array('customer_address_id' => $this->_sourceCustomer->getCustomerAddressId(), 'prefix' => '', 'firstname' => $this->_sourceCustomer->getFirstname(), 'middlename' => '', 'lastname' => $this->_sourceCustomer->getLastname(), 'suffix' => '', 'company' => '', 'street' => array($shippingaddress->getStreet()), 'city' => $shippingaddress->getCity(), 'country_id' => $shippingaddress->getCountryId(), 'region' => '', 'region_id' => $shippingaddress->getRegionId(), 'postcode' => $shippingaddress->getPostcode(), 'telephone' => $shippingaddress->getTelephone(), 'fax' => '', 'shipping_method' => 'flatrate_flatrate'), 'shipping_method' => 'flatrate_flatrate', 'comment' => array('customer_note' => 'This order has been programmatically created via import script.'), 'send_confirmation' => $this->_sendConfirmation)); }
/** * Set customer object and setting customer id in session * * @param Mage_Customer_Model_Customer $customer * @return Mage_Customer_Model_Session */ public function setCustomer(Mage_Customer_Model_Customer $customer) { // check if customer is not confirmed if ($customer->isConfirmationRequired()) { if ($customer->getConfirmation()) { throw new Exception('This customer is not confirmed and cannot log in.', Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED); } } $this->_customer = $customer; $this->setId($customer->getId()); // save customer as confirmed, if it is not if (!$customer->isConfirmationRequired() && $customer->getConfirmation()) { $customer->setConfirmation(null)->save(); $customer->setIsJustConfirmed(true); } return $this; }
/** * Save customer * * @deprecated after 1.4.0.0. * @param Mage_Customer_Model_Customer $order */ protected function _saveCustomerAfterOrder($order) { if ($this->_customer) { if (!$this->_customer->getId()) { $billing = $this->getBillingAddress(); $customerBilling = $billing->exportCustomerAddress(); $shipping = $this->getShippingAddress(); $customerShipping = $shipping->exportCustomerAddress(); $this->_customer->addAddress($customerBilling); if (!$shipping->getSameAsBilling()) { $this->_customer->addAddress($customerShipping); } // preliminary save to find addresses id $this->_customer->save(); // setting default addresses id $defShipping = $shipping->getSameAsBilling() ? $customerBilling->getId() : $customerShipping->getId(); $this->_customer->setDefaultBilling($customerBilling->getId())->setDefaultShipping($defShipping)->save(); $order->setCustomerId($this->_customer->getId()); $billing->setCustomerId($this->_customer->getId()); $shipping->setCustomerId($this->_customer->getId()); $this->_customer->sendNewAccountEmail('registered', '', $order->getStoreId()); } else { $saveCusstomerAddress = false; if ($this->getBillingAddress()->getSaveInAddressBook()) { $billingAddress = $this->getBillingAddress()->exportCustomerAddress(); if ($this->getBillingAddress()->getCustomerAddressId()) { $billingAddress->setId($this->getBillingAddress()->getCustomerAddressId()); } $this->_customer->addAddress($billingAddress); $saveCusstomerAddress = true; } if ($this->getShippingAddress()->getSaveInAddressBook()) { $shippingAddress = $this->getShippingAddress()->exportCustomerAddress(); if ($this->getShippingAddress()->getCustomerAddressId()) { $shippingAddress->setId($this->getShippingAddress()->getCustomerAddressId()); } $this->_customer->addAddress($shippingAddress); $saveCusstomerAddress = true; } if ($saveCusstomerAddress) { $this->_customer->save(); } } } }
public function updateRegistryData(Mage_Customer_Model_Customer $customer, $data) { try { if (!empty($data)) { $this->setCustomerId($customer->getId()); $this->setWebsiteId($customer->getWebsiteId()); $this->setTypeId($data['type_id']); $this->setEventName($data['event_name']); $this->setEventDate($data['event_date']); $this->setEventCountry($data['event_country']); $this->setEventLocation($data['event_location']); } } catch (Exception $e) { Mage::logException($e); } Mage::log($data); return $this; }