Jump to content

[Résolu] Erreur de parsing


Recommended Posts

Bonjour à tous
J’espère avoir poster dans la bonne section, si ce n’est pas le cas je m'en excuse !

J'essaie de faire un affichage dans l'admin avec le code ci-dessous et je ne sais pas pourquoi il ne fait rien est-ce que quelqu'un pourrait m'aider svp.

Merci !!!

<?php


include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');

/**
* 
*
*/
class AdminPriceFixing extends AdminTab
{


   /**
    *le constructeur de la class 
    */
   public function __construct()
   {
       global $cookie;


       //**************************************************
       //********************la requete********************
       //**************************************************
       $this->table = 'product'; // FROM 

       // SELECT
       $this->_select = '
       IF(pa.`supplier_reference` > 0,pa.`supplier_reference`,a.`supplier_reference`)as reference, 
       pl.`name`as nom,
       GROUP_CONCAT(CONCAT(agl.`name` ," :  ", "       ",  al.`name` )) AS valeurs, 
       a.`weight`,
       IF(pa.`wholesale_price` > 0,pa.`wholesale_price`,a.`wholesale_price`) as prix_achat,
       (((100*(COALESCE(pa.`price`,0)))/(100+(t.`rate`)))+ a.`price`) as prix_vente_ht,
       t.`rate` ,
       ((1+(t.`rate`)/100)*(((100*(COALESCE(pa.`price`,0)))/(100+(t.`rate`)))+ a.`price`)) as prix_final,
       (((IF(pa.`wholesale_price` > 0,pa.`wholesale_price`,a.`wholesale_price`))/(((100*(COALESCE(pa.`price`,0)))/(100+t.`rate`))+ a.`price`))*100) as marge';


       $this->_join = '
       LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = a.`id_product`) AND pl.`id_lang` = " . $this->_lang. "
       LEFT JOIN `'._DB_PREFIX_.'tax` AS t ON t.`id_tax` = a.`id_tax`
       LEFT JOIN `'._DB_PREFIX_.'product_attribute`AS pa on (a.`id_product`=pa.`id_product`)
       LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` AS pac ON pac.`id_product_attribute`= pa.`id_product_attribute`
       LEFT JOIN `'._DB_PREFIX_.'attribute` AS atr ON atr.`id_attribute` = pac.`id_attribute`
       LEFT JOIN `'._DB_PREFIX_.'attribute_group` AS ag ON ag.`id_attribute_group` = atr.`id_attribute_group`
       LEFT JOIN `'._DB_PREFIX_.'attribute_lang` AS al ON (atr.`id_attribute` = al.`id_attribute`) AND al.`id_lang` = 2
       LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang`AS agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`) AND agl.`id_lang` =2';

       $this->_group="GROUP BY a.id_product, pa.id_product_attribute";


       //les champs à afficher
       $this->fieldsDisplay = array(
       'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 25),
       'nom' => array('title' => $this->l('Noms'), 'align' => 'center', 'width' => 25),
       'valeurs' => array('title' => $this->l('Valeurs'), 'align' => 'center', 'width' => 25),
       'prix_achat' => array('title' => $this->l('Prix Achat'), 'align' => 'center', 'width' => 25),
       'prix_vente_ht' => array('title' => $this->l('Prix Vente'), 'align' => 'center', 'width' => 25),
       'rate' => array('title' => $this->l('Taux'), 'align' => 'center', 'width' => 25),
       'prix_final' => array('title' => $this->l('Prix Final'), 'align' => 'center', 'width' => 25),
       'marge' => array('title' => $this->l('Marge'), 'align' => 'center', 'width' => 25)
       );

       parent::__construct();
   }

   // 
   /**
    * la methode pour afficher 
    */
   public function display()
   {
       global $cookie;

       $this->getList(intval($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'id_product' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
       $this->displayList();
   }
}

?>

Link to comment
Share on other sites

Salut,
je pense que tu dois modifier

$this->getList(intval($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'id_product' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
       $this->displayList();



par

$this->getList(intval($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'reference' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
       $this->displayList();



Bon courage,
Cdlt,
Pierre.

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...