Jump to content
Sign in to follow this  
Sambote

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More