/** * Build list of tags which will be used on emails & messages * * @param $row * @param $config * * @return array */ public static function buildTags($row, $config) { $db = JFactory::getDbo(); $replaces = array(); $replaces['first_name'] = $row->first_name; $replaces['last_name'] = $row->last_name; $replaces['organization'] = $row->organization; $replaces['address'] = $row->address; $replaces['address2'] = $row->address; $replaces['city'] = $row->city; $replaces['state'] = $row->state; $replaces['zip'] = $row->zip; $replaces['country'] = $row->country; $replaces['phone'] = $row->phone; $replaces['fax'] = $row->phone; $replaces['email'] = $row->email; $replaces['comment'] = $row->comment; $replaces['amount'] = self::formatAmount($row->amount, $config); $replaces['discount_amount'] = self::formatAmount($row->discount_amount, $config); $replaces['tax_amount'] = self::formatAmount($row->tax_amount, $config); $replaces['gross_amount'] = self::formatAmount($row->gross_amount, $config); $replaces['from_date'] = JHtml::_('date', $row->from_date, $config->date_format); $replaces['to_date'] = JHtml::_('date', $row->to_date, $config->date_format); if ($row->username && $row->user_password) { $replaces['username'] = $row->username; //Password $privateKey = md5(JFactory::getConfig()->get('secret')); $key = new JCryptKey('simple', $privateKey, $privateKey); $crypt = new JCrypt(new JCryptCipherSimple(), $key); $replaces['password'] = $crypt->decrypt($row->user_password); } $replaces['transaction_id'] = $row->transaction_id; $replaces['membership_id'] = $row->membership_id; if ($row->payment_method) { $method = os_payments::loadPaymentMethod($row->payment_method); if ($method) { $replaces['payment_method'] = $method->title; } else { $replaces['payment_method'] = ''; } } // Support for name of custom field in tags $sql = 'SELECT field_id, field_value FROM #__osmembership_field_value WHERE subscriber_id = ' . $row->id; $db->setQuery($sql); $rowValues = $db->loadObjectList('field_id'); $sql = "SELECT id, name FROM #__osmembership_fields AS a WHERE a.published=1 AND a.is_core = 0 AND (a.plan_id = 0 OR a.id IN (SELECT field_id FROM #__osmembership_field_plan WHERE plan_id={$row->plan_id}))"; $db->setQuery($sql); $rowFields = $db->loadObjectList(); for ($i = 0, $n = count($rowFields); $i < $n; $i++) { $rowField = $rowFields[$i]; if (isset($rowValues[$rowField->id])) { $fieldValue = $rowValues[$rowField->id]->field_value; if (is_string($fieldValue) && is_array(json_decode($fieldValue))) { $fieldValue = implode(', ', json_decode($fieldValue)); } $replaces[$rowField->name] = $fieldValue; } else { $replaces[$rowField->name] = ''; } } return $replaces; }
?> </div> </div> <?php if ($this->item->gross_amount > 0) { ?> <div class="control-group"> <label class="control-label"> <?php echo JText::_('OSM_PAYMENT_METHOD'); ?> </label> <div class="controls"> <?php $method = os_payments::loadPaymentMethod($this->item->payment_method); if ($method) { echo JText::_($method->title); } ?> </div> </div> <div class="control-group"> <label class="control-label"> <?php echo JText::_('OSM_TRANSACTION_ID'); ?> </label> <div class="controls">
echo OSMembershipHelper::formatCurrency($row->gross_amount, $config); ?> </td> </tr> <?php } ?> <tr> <td class="title_cell"> <?php echo JText::_('OSM_PAYMENT_OPTION'); ?> </td> <td class="field_cell"> <?php $method = os_payments::loadPaymentMethod($row->payment_method); if ($method) { echo JText::_($method->title); } ?> </td> </tr> <tr> <td class="title_cell"> <?php echo JText::_('OSM_TRANSACTION_ID'); ?> </td> <td class="field_cell"> <?php