toutpratique/modules/ganalyticscom/GanalyticsComs.php
ToutPratique 731a03a487 push prod
2016-06-23 10:23:03 +02:00

37 lines
1.0 KiB
PHP

<?php
class GanalyticsComs extends ObjectModel
{
public $id;
public $commande;
public $referer;
public $gclid;
public $ga_statut;
protected $fieldsRequired = array();
protected $fieldsValidate = array(
'id' => 'isUnsignedId', 'commande' => 'isUnsignedId', 'referer' => 'isMessage', 'gclid' => 'isMessage', 'ga_statut' => 'isUnsignedId');
protected $table = 'ganalyticscoms';
protected $identifier = 'id';
public function getFields()
{
$fields = array();
parent::validateFields(false);
$fields['commande'] = (int)$this->commande;
$fields['referer'] = pSQL($this->referer);
$fields['gclid'] = pSQL($this->gclid);
$fields['ga_statut'] = (int)$this->ga_statut;
return ($fields);
}
public function getByOrder($id_order)
{
if (!Validate::isUnsignedId($id_order))
die(Tools::displayError());
$result = Db::getInstance()->ExecuteS('
SELECT * FROM `'._DB_PREFIX_.'ganalyticscoms`
WHERE `commande` = '.(int)($id_order));
if (isset($result[0])) return $result[0];
else return false;
}
}