M
M
msimrial2015-09-18 17:19:14
PHP
msimrial, 2015-09-18 17:19:14

Why not display a selection from the database with prestashop?

public static function getShiftFromOrderForEmail($id_order){
        $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
            'select  s.time_from
      from `'._DB_PREFIX_.'shift` as s
      join `'._DB_PREFIX_.'1c_orders` as c on c.id_shift = s.id_shift
      join `'._DB_PREFIX_.'orders` as o on o.id_order = c.id_order
      where o.id_order = '.(int)$id_order );


        $res2 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('select  s.time_from, s.time_to
                      from ps_shift as s
                      join ps_1c_orders as c on c.id_shift = s.id_shift
                      join ps_orders as o on o.id_cart = c.id_c
                      where o.id_order = 555'.(int)$id_order );


        $sql = new DbQuery();
        $sql->select('CONCAT(s.time_from, " - " ,s.time_to )');
        $sql->from('shift','s');
        $sql->innerJoin('1c_orders', 'c' , 'c.id_shift = s.id_shift')
        	$sql->innerJoin('orders', 'o' , 'o.id_order = c.id_order')
        	$sql->where('o.id_order = '.(int)$id_order);
        	$result = Db::getInstance()->getRow($sql);
 Db::getInstance()->getMsgError();
    return $result ? $result : 'none';
      


    }

I’ve been sorting it out for 2 hours already, I’ve been in 3 different ways (as you can see), the id_order value comes in, the request checked, it works, the text is displayed through return, if you put a fixed value in where = it also displays. But in the form where the incoming value is substituted - NO. HELP otherwise I think I'm going crazy

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2015-09-18
@MaxDukov

(int)$id_order in single quotes take

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question