Jump to content

Modifier construction d'une requête pour y inclure l'ip_address


Recommended Posts

Bonjour à tous,

 

Je tente d'inclure dans le tableau qui affiche les paniers sur mon BO, l'adresse ip des paniers existants.

 

J'ai donc inclus ma colonne, no problem  :D

 

mais maintenant, je tente de modifier la requête sauf que dans mon fichier AdminCartsController.php, elle ressemble à  :blink:

public function __construct()
	{
		$this->bootstrap = true;
		$this->table = 'cart';
		$this->className = 'Cart';
		$this->lang = false;
		$this->explicitSelect = true;

		$this->addRowAction('view');
		$this->addRowAction('delete');
		$this->allow_export = true;
		$this->_orderWay = 'DESC';

		$this->_select = 'CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) `customer`, a.id_cart total, ca.name carrier,
		IF (IFNULL(o.id_order, \''.$this->l('Non ordered').'\') = \''.$this->l('Non ordered').'\', IF(TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', a.`date_add`)) > 86400, \''.$this->l('Abandoned cart').'\', \''.$this->l('Non ordered').'\'), o.id_order) AS status, IF(o.id_order, 1, 0) badge_success, IF(o.id_order, 0, 1) badge_danger, IF(co.id_guest, 1, 0) id_guest';
		$this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = a.id_customer)
		LEFT JOIN '._DB_PREFIX_.'currency cu ON (cu.id_currency = a.id_currency)
		LEFT JOIN '._DB_PREFIX_.'carrier ca ON (ca.id_carrier = a.id_carrier)
		LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_cart = a.id_cart)
		LEFT JOIN `'._DB_PREFIX_.'connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', co.`date_add`)) < 1800)';

J'ai donc inclus "co.ip_address `connections`" dans ma requête après la première virgule mais ça ne marche pas !

Par ailleurs, je ne comprends pas trop cette syntaxe "a.id_cart total" car pour moi logiquement, elle aurait du être écrite comme ceci "a.id_cart a.total", non ?

 

Merci pour votre aide et pour votre éclairage

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...