/** * @param Mage_Customer_Model_Address_Abstract|Mage_Sales_Model_Abstract $magentoObject * @param ShopgateOrder|ShopgateAddress|ShopgateCustomer $shopgateObject * @return mixed */ public function setCustomFields($magentoObject, $shopgateObject) { foreach ($shopgateObject->getCustomFields() as $field) { $magentoObject->setData($field->getInternalFieldName(), $field->getValue()); } return $magentoObject; }
/** * Print comments inside order * * @param Mage_Sales_Model_Order $order * @param ShopgateOrder $shopgateOrder * @return mixed */ public function printCustomFieldComments($order, $shopgateOrder) { if (Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_ORDER_CUSTOMFIELDS_TO_STATUSHISTORY, Mage::helper('shopgate/config')->getConfig()->getStoreViewId())) { $comment = ''; $customFieldSet = array($this->_getHelper()->__('[SHOPGATE] Custom fields:') => $shopgateOrder->getCustomFields(), $this->_getHelper()->__('Shipping Address fields:') => $shopgateOrder->getDeliveryAddress()->getCustomFields(), $this->_getHelper()->__('Billing Address fields:') => $shopgateOrder->getInvoiceAddress()->getCustomFields()); foreach ($customFieldSet as $title => $set) { $comment .= '<strong>' . $title . '</strong><br/>'; foreach ($set as $field) { $comment .= '"' . addslashes($field->getLabel()) . '" => "' . addslashes($field->getValue()) . '"<br />'; } } $order->addStatusHistoryComment($comment, false); } return $order; }