Ubercart aggiornamento modulo uc_pma alla versione 7.x
Ciao,
per necessità sto cercando di aggiornare la versione del modulo http://drupal.org/project/uc_pma ferma alla 6.x.
Premessa non sono una cima e propio per questo ci voglio provare!
Ho eseguito i primi passi per installare il modulo sotto Drupal 7, ora il mio primo ostacolo è alla cassa sembra funzionare tutto ma non il file js che aggiorna il costo del metodo di pagamento non funziona!
Il codice è questo( riga 68 e 69 uc_pma.module):
elseif ($form_id == 'uc_cart_checkout_form') {
foreach ($form['panes']['payment']['payment_method']['#options'] as $key => $value) {
$adjustment = variable_get('uc_payment_method_'. $key .'_adjustment', '');
if (!empty($adjustment)) {
$form['panes']['payment']['payment_method']['#options'][$key] .= '<div class="description" style="padding-left: 2.5em;">'. payment_method_adjustment_description($key) .'</div>';
}
}
drupal_add_js(drupal_get_path('module', 'uc_pma') .'/uc_pma.js');
drupal_add_js("\$(document).ready( function () { update_method_line_item('". $form['panes']['payment']['payment_method']['#default_value'] ."'); } );", 'inline');
}
}analizzando il sorgente il file uc_pma.js è caricato nel head e anche la function (), ma non on click () sul radio button del pagamento.
il file uc_pma.js che dovrebbe aggiornare il totale dell'ordine:
var method_update;
$(document).ready(
function () {
$("input:radio[@name='panes[payment][payment_method]']").click(
function () {
update_method_line_item(this.value);
}
);
}
);
/**
* Update the payment method line item to reflect any payment specific subtotal adjustments
*/
function update_method_line_item(path) {
var order = serializeOrder();
if (!!order) {
// Get the timestamp for the current update.
var this_update = new Date();
// Set the global timestamp for the update.
method_update = this_update.getTime();
// Make the post to get the details for the chosen payment method.
$.post(Drupal.settings.basePath + 'cart/checkout/method_items/' + path, { order: order },
function(adjustment) {
if (this_update.getTime() == method_update) {
var return_values = adjustment.split('|');
if(return_values[0] && (return_values[0] >= .01 || return_values[0] <= -.01)) {
set_line_item('payment_method', return_values[1], return_values[0], 1);
}
else {
remove_line_item('payment_method');
render_line_items();
}
}
}
);
}
}qualcuno di voi individua il perchè non aggiunge l'evento click al radio button?
P.S. Per chi non conesce il modulo in questione, in poche parole aggiunge un costo/tassa a qualsiasi metodo di pagamento, io lo uso per il contrassegno altri per aggiungere le maggiorazioni per la carta di credito.
