Bonsoir tous le monde
Voilla trois jours que j'essaye de récupéré le contenue d'un champ pour l'inséré dans ma base de donnée order.
donc voila mes champ dans le fichier cc
Ces champs plus loin dans le même fichier enregister en global
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 $confirmation = array('id' => $this->code, 'module' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('$cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_CC_TEXT_MENS, 'field' => tep_draw_pull_down_menu('$cc_mens',$montants_array, $mens_selected)), array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('$cc_number')), array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('$cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('cc_expires_year', $expires_year)))); return $confirmation; }
puis on inclus et enregistre les donner grâce a la classe order_carte
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 function process_button() { global $HTTP_POST_VARS; include(DIR_WS_CLASSES . 'cc_validation.php'); $cc_validation = new cc_validation(); $result = $cc_validation->validate($HTTP_POST_VARS['cc_number'], $HTTP_POST_VARS['cc_mens'], $HTTP_POST_VARS['cc_expires_month'], $HTTP_POST_VARS['cc_expires_year']); $this->cc_card_type = $cc_validation->cc_type; $this->cc_card_number = $cc_validation->cc_number; $process_button_string = tep_draw_hidden_field('cc_owner', $HTTP_POST_VARS['cc_owner']) . tep_draw_hidden_field('cc_mens', $HTTP_POST_VARS['cc_mens']) . tep_draw_hidden_field('cc_expires', $HTTP_POST_VARS['cc_expires_month'] . $HTTP_POST_VARS['cc_expires_year']) . tep_draw_hidden_field('cc_type', $HTTP_POST_VARS['cc_mens']) . tep_draw_hidden_field('cc_number', $this->cc_card_number); return $process_button_string; } function before_process() { global $HTTP_POST_VARS, $order; if ( (defined('MODULE_PAYMENT_CC_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_CC_EMAIL)) ) { $len = strlen($HTTP_POST_VARS['cc_number']); $this->cc_middle = substr($HTTP_POST_VARS['cc_number'], 17, ($len-8)); $order->info['cc_number'] = substr($HTTP_POST_VARS['cc_number'], 0, 17) . str_repeat('X', (strlen($HTTP_POST_VARS['cc_number']) - 17)) . substr($HTTP_POST_VARS['cc_number'], -17); } }
voici order_carte
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 function after_process() { global $insert_id; require(DIR_WS_CLASSES . 'order_carte.php'); $sql_data_array = array('cc_type' => $order_carte->carte['cc_type'], 'cc_owner' => $order_carte->carte['cc_owner'], 'cc_number' => $order_carte->carte['cc_number'], 'cc_expires' => $order_carte->carte['cc_expires']); tep_db_perform(TABLE_ORDERS, $sql_data_array);
mais malheureusement ca ne marche pas et je ne comprend pas pourquoi.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 <?php /* $Id: order_carte.php,v 1.1.1.1 2009/04/16 19:03:49 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License Badibad */ tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$orders_id . "'"); tep_db_query('INSERT INTO `orders`(cc_type, cc_owner, cc_number, cc_expires) VALUES ("cc_type", "cc_owner", "cc_number", "cc_expires")'); class order_carte { var $carte; function order_carte($oID) { $this->carte = array(); $this->query($oID); } function query($oID) { $order_invoice_query = tep_db_query("select cc_type, cc_owner, cc_number, cc_expires from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); $order_carte = tep_db_fetch_array($order_invoice_query); $this->carte = array('cc_type' => $order_carte['cc_type'], 'cc_owner' => $order_carte['cc_owner'], 'cc_number' => $order_carte['cc_number'], 'cc_expires' => $order_carte['cc_expires']); } } ?>
Merci d'avance
Partager