PEEL Shopping
Open source ecommerce : PEEL Shopping
historique_commandes.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: historique_commandes.php 46935 2015-09-18 08:49:48Z gboussin $
14 include("../configuration.inc.php");
16 
17 include("../lib/fonctions/display_caddie.php");
18 
19 $GLOBALS['DOC_TITLE'] = $GLOBALS['STR_ORDER_HISTORY'];
20 
21 define("IN_ORDER_HISTORY", true);
22 $GLOBALS['page_name'] = 'historique_commandes';
23 
24 $output = '';
25 switch (vb($_REQUEST['mode'])) {
26  case "details" :
27  $sql = "SELECT c.*, sp.technical_code AS statut_paiement
28  FROM peel_commandes c
29  LEFT JOIN peel_statut_paiement sp ON sp.id=c.id_statut_paiement AND " . get_filter_site_cond('statut_paiement', 'sp') . "
30  WHERE c.id = '" . intval($_GET['id']) . "' AND c.id_utilisateur = '" . intval($_SESSION['session_utilisateur']['id_utilisateur']) . "' AND c.o_timestamp = '" . nohtml_real_escape_string(vb($_GET['timestamp'])) . "' AND " . get_filter_site_cond('commandes', 'c') . "";
32  if ($this_order = fetch_assoc($qid_commande)) {
33  // On a bien rentré une URL qui est complète pour voir cette commande
34  if(!empty($GLOBALS['site_parameters']['payment_status_forbid_payment'])) {
35  $payment_status_forbid_payment = $GLOBALS['site_parameters']['payment_status_forbid_payment'];
36  } else {
37  $payment_status_forbid_payment = array('being_checked', 'completed', 'cancelled');
38  }
39  if(is_numeric(key($payment_status_forbid_payment))) {
40  $allow_status_change = !in_array($this_order['id_statut_paiement'], $payment_status_forbid_payment);
41  } else {
42  $allow_status_change = !in_array($this_order['statut_paiement'], $payment_status_forbid_payment);
43  }
44  $output .= affiche_resume_commande(intval($_GET['id']), true, true, $allow_status_change);
45  } else {
46  $tpl = $GLOBALS['tplEngine']->createTemplate('global_error.tpl');
47  $tpl->assign('message', $GLOBALS['STR_AUTH_DENIAL']);
48  $output .= $tpl->fetch();
49  }
50  break;
51 
52  case "product_ordered_history" :
53  // Récupération des produits des commandes réglées par l'utilisateur
54  $sql = "SELECT ca.nom_produit, ca.produit_id , ca.quantite, c.o_timestamp, c.numero, c.id
55  FROM peel_commandes_articles ca
56  INNER JOIN peel_commandes c ON ca.commande_id = c.id AND " . get_filter_site_cond('commandes', 'c') . "
57  LEFT JOIN peel_statut_paiement sp ON sp.id=c.id_statut_paiement AND " . get_filter_site_cond('statut_paiement', 'sp') . "
58  WHERE id_utilisateur = '" . intval($_SESSION['session_utilisateur']['id_utilisateur']) . "' AND sp.technical_code = 'completed' AND " . get_filter_site_cond('commandes_articles', 'ca') . "";
59  $Links = new Multipage($sql, 'affiche_product_ordered_history');
60  $Links->OrderDefault = "o_timestamp";
61  $Links->SortDefault = "DESC";
62  $HeaderTitlesArray = array('nom_produit' => $GLOBALS['STR_PRODUCT_NAME'], 'quantite' => $GLOBALS['STR_QUANTITY'], 'o_timestamp' => $GLOBALS['STR_DATE'], 'numero' => $GLOBALS['STR_ORDER_NUMBER']);
63  $Links->HeaderTitlesArray = $HeaderTitlesArray;
64  $results_array = $Links->Query();
65 
66  $tpl = $GLOBALS['tplEngine']->createTemplate('products_ordered_history.tpl');
67  if (empty($results_array)) {
68  $tpl->assign('STR_NO_ORDER', $GLOBALS['STR_NO_ORDER']);
69  } else {
70  foreach($results_array as $this_products_ordered_history) {
71  $product_object = new Product($this_products_ordered_history['produit_id']);
72  $tmpProd = array(
73  'nom_produit' => $this_products_ordered_history['nom_produit'],
74  'href_produit' => $product_object->get_product_url(),
75  'quantite' => $this_products_ordered_history['quantite'],
76  'o_timestamp' => $this_products_ordered_history['o_timestamp'],
77  'numero' => $this_products_ordered_history['numero']
78  );
79  $products[] = $tmpProd;
80  }
81  $tpl->assign('products', $products);
82  }
83  $tpl->assign('links_header_row', $Links->getHeaderRow());
84  $tpl->assign('links_multipage', $Links->GetMultipage());
85 
86  $tpl->assign('STR_PRODUCTS_PURCHASED_LIST', $GLOBALS['STR_PRODUCTS_PURCHASED_LIST']);
87  $output .= $tpl->fetch();
88  break;
89 
90  default :
91  $order = "o_timestamp";
92  $sort = "DESC";
93  $output .= affiche_liste_commandes($order, $sort);
94  break;
95 }
96 
97 include($GLOBALS['repertoire_modele'] . "/haut.php");
98 echo $output;
99 include($GLOBALS['repertoire_modele'] . "/bas.php");
100 
$qid_commande
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
Definition: database.php:400
$results_array
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
$GLOBALS['DOC_TITLE']
if(empty($_GET['id'])) if(!empty($GLOBALS['site_parameters']['allow_multiple_product_url_with_category'])) $product_object
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
Definition: fonctions.php:4643
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
Definition: database.php:158
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
Definition: fonctions.php:1596
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:28:54 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.