Jump to content

erreur de syntax dans le fichier ajax.php


Recommended Posts

Bonjour,
cela continu, voici une erreur de syntax à la ligne 98 : Parse error: syntax error, unexpected ':' in /admin/ajax.php on line 98
voici ce que j'ai a cette ligne et la suite:

$products = Db::getInstance()->ExecuteS('
   SELECT p.`id_product`, pl.`name`
   FROM `'._DB_PREFIX_.'product` p
   NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
   WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
   AND p.`id_product` != '.(int)(Tools::getValue('id_product')).'
   AND p.`id_product` NOT IN (
       SELECT a.`id_product_2`
       FROM `'._DB_PREFIX_.'accessory` a
       WHERE a.`id_product_1` = '.(int)(Tools::getValue('id_product')).')
   ORDER BY pl.`name`');

   foreach ($products AS $accessory)
       $jsonArray[] = '{"value: "'.(int)($accessory['id_product']).'-'.addslashes($accessory['name']).'", "text":"'.(int)($accessory['id_product']).' - '.addslashes($accessory['name']).'"}';
   die('['.implode(',', $jsonArray).']');
}

if (isset($_GET['ajaxDiscountCustomers']))
{
   global $cookie;

   $currentIndex = 'index.php?tab=AdminDiscounts';
   $jsonArray = array();
   $filter = Tools::getValue('filter');

   if (Validate::isBool_Id($filter))
       $filterArray = explode('_', $filter);

   $customers = Db::getInstance()->ExecuteS('
   SELECT `id_customer`, `email`, CONCAT(`lastname`, \' \', `firstname`) as name
   FROM `'._DB_PREFIX_.'customer`
   WHERE `deleted` = 0 AND is_guest = 0
   AND '.(Validate::isUnsignedInt($filter) ? '`id_customer` = '.(int)($filter) : '(`email` LIKE "%'.pSQL($filter).'%"
   '.((Validate::isBool_Id($filter) AND $filterArray[0] == 0) ? 'OR `id_customer` = '.(int)($filterArray[1]) : '').'
   '.(Validate::isUnsignedInt($filter) ? '`id_customer` = '.(int)($filter) : '').'
   OR CONCAT(`firstname`, \' \', `lastname`) LIKE "%'.pSQL($filter).'%"
   OR CONCAT(`lastname`, \' \', `firstname`) LIKE "%'.pSQL($filter).'%")').'
   ORDER BY CONCAT(`lastname`, \' \', `firstname`) ASC
   LIMIT 50');

   $groups = Db::getInstance()->ExecuteS('
   SELECT g.`id_group`, gl.`name`
   FROM `'._DB_PREFIX_.'group` g
   LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($cookie->id_lang).')
   WHERE '.(Validate::isUnsignedInt($filter) ? 'g.`id_group` = '.(int)($filter) : 'gl.`name` LIKE "%'.pSQL($filter).'%"
   '.((Validate::isBool_Id($filter) AND $filterArray[0] == 1) ? 'OR g.`id_group` = '.(int)($filterArray[1]) : '')).'
   ORDER BY gl.`name` ASC
   LIMIT 50');

   $json = '{"customers" : ';
   foreach ($customers AS $customer)
       $jsonArray[] = '{"value":"0_'.(int)($customer['id_customer']).'", "text":"'.addslashes($customer['name']).' ('.addslashes($customer['email']).')"}';
   $json .= '['.implode(',', $jsonArray).'],
       "groups" : ';
   $jsonArray = array();
   foreach ($groups AS $group)
       $jsonArray[] = '{"value":"1_'.(int)($group['id_group']).'", "text":"'.addslashes($group['name']).'"}';
   $json .= '['.implode(',', $jsonArray).']}';
   die($json);
}

---------------------------------------

j'espere que cela suffit, car je debute et ne connais pas le langage PHP.


Merci

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