18 require_once SQ_PACKAGES_PATH.
'/ecommerce/delivery_methods/ecommerce_delivery_method/ecommerce_delivery_method_edit_fns.inc';
43 parent::__construct();
59 $write_access = $asset->writeAccess(
'attributes');
62 $tmp_form =& $asset->getForm();
63 $availableKeywords = $tmp_form->getQuestions();
66 echo
'<style type="text/css">#keyword_table td {border:1px solid #B3B3B3;} #keyword_table {border:1px solid #000}</style>';
67 echo
'<table id="keyword_table"><tr><td><strong>Keyword</strong></td><td><strong>Description</strong></td></tr>';
68 foreach ($availableKeywords as $key => $value) {
69 $key_parts = explode(
':', $key);
70 echo
'<tr><td>%response_'.$key_parts[1].
'%</td><td>print field value <strong>"'.$value[
'name'].
'"</strong> </td></tr>';
72 echo
'<tr><td>%customised_receipt%</td><td>print the customised receipt (if enabled via the checkout asset)</td></tr>';
73 echo
'<tr><td>%order_receipt%</td><td>print the order receipt</td></tr>';
74 echo
'<tr><td>%cart_summary%</td><td>print the cart summary</td></tr>';
75 echo
'<tr><td>%cart_summary_text%</td><td>print the cart summary in a text format</td></tr>';
76 echo
'<tr><td>%form_summary%</td><td>print the form summary</td></tr>';
77 echo
'<tr><td>%form_summary_text%</td><td>print the form summary in a text format</td></tr>';
78 echo
'<tr><td>%order_id%</td><td>print the order id</td></tr>';
79 echo
'<tr><td>%transaction_id%</td><td>print the unique transaction reference id</td></tr>';
80 echo
'<tr><td>%merchant_transaction_id%</td><td>print the unique merchant transaction reference id</td></tr>';
81 echo
'<tr><td>%negative_quantity_product_list%</td><td>print products which have negative quantities after purchasing</td></tr>';
82 echo
'<tr><td>%negative_quantity_message%</td><td>print negative quantity products message if there are any negative quantities</td></tr>';
121 $am =& $GLOBALS[
'SQ_SYSTEM']->am;
122 $write_access = $asset->writeAccess(
'attributes');
126 echo
'<table class="sq-backend-table">';
128 echo
'<th>Question Name</th>';
129 echo
'<th>Enabled?</th>';
131 echo
'<th>Value Options</th>';
134 $form =& $asset->getForm();
135 $all_form_questions = $form->getQuestions();
136 $var_rules = $asset->attr(
'key_val_rules');
138 foreach ($all_form_questions as $q_id => $question_data) {
139 if (!$asset->_isAllowedPassThroughQuestionType($question_data[
'type_code'])) {
143 $var_enabled = isset($var_rules[$q_id]);
147 echo $question_data[
'name'];
150 $var_enabled_name = $prefix.
'_var_enabled['.$q_id.
']';
151 check_box($var_enabled_name, $q_id, $var_enabled);
155 $pass_through_key_name = $prefix.
'_pass_through_key['.$q_id.
']';
156 text_box($pass_through_key_name, array_get_index($var_rules[$q_id],
'key',
''));
158 echo
'<em style="color: grey;">None</em>';
163 $question = $am->getAsset($q_id);
165 echo
'<table class="sq-backend-table">';
166 $options = $question->getOptions();
167 $var_value = array_get_index($var_rules[$q_id],
'value', Array());
168 $local_prefix = $prefix.
'_pass_through_value['.$q_id.
']';
169 foreach ($options as $key => $option_text) {
171 if (!($question instanceof Form_question_type_select) || !$question->isEmptyOption($key)){
173 $rule_value = array_get_index($var_value, $key,
'');
174 echo
'<td class="sq-backend-table-header" nowrap="nowrap">';
177 echo
'<td class="sq-backend-table-cell" width="100%">';
178 text_box($local_prefix.
'['.$key.
']', $rule_value);
185 echo
'The value supplied by the user will be passed through to the Payment Gateway.';
188 $am->forgetAsset($question);
190 echo
'<em style="color: grey;">Pass through variable is not enabled for this question</em>';
200 return $write_access;
218 $var_list = array_get_index($_REQUEST, $prefix.
'_var_enabled', Array());
220 $new_var_list = Array();
221 if (!empty($var_list)) {
222 $key_list = array_get_index($_REQUEST, $prefix.
'_pass_through_key', Array());
223 $value_list = array_get_index($_REQUEST, $prefix.
'_pass_through_value', Array());
224 foreach ($var_list as $id) {
226 $new_var_list[$id] = Array(
227 'key' => array_get_index($key_list, $id,
''),
228 'value' => array_get_index($value_list, $id, Array()));
232 $asset->setAttrValue(
'key_val_rules', $new_var_list);