Witam
Potrzebuje poprawić część kodu którzy działa obecnie źle.
Otóż nie pokazuje podstron z produktami po modyfikacji tego zapytania:

  1. <?php
  2. $select = $db->select()->from(array('t' => DB_PREFIX . 'prod_translations'),
  3.        array('options', 'product_name', 'description'))->join(array('p' => DB_PREFIX .
  4.        'products'), 'p.product_id = t.pid', array('product_id', 'category_id', 'gfx',
  5.        'vat', 'promo', 'weight', 'in_stock', 'price', 'actual_price' =>
  6.        'IF(s.special_price, s.special_price, p.price)'))->joinLeft(array('g' =>
  7.        DB_PREFIX . 'gfx'), 't.pid = g.prod_id AND g.main_gfx = 1', array('unic_name'))->
  8.        joinLeft(array('s' => DB_PREFIX . 'special_offers'),
  9.        't.pid = s.pid AND s.date_from <= ' . strtotime(date("Y-m-d")) .
  10.        ' AND s.date_to >= ' . strtotime(date("Y-m-d")), array('special_price'))->where('t.lang = ?',
  11.        $session->lang)->where('t.active = 1')->limit($krok, $page * $krok);
  12. ?>


na to:
  1. <?php
  2. $select = $db->select()->from(array('t' => DB_PREFIX . 'prod_translations'),
  3.        array('options', 'product_name', 'description'))->join(array('p' => DB_PREFIX .
  4.        'products'), 'p.product_id = t.pid', array('product_id', 'category_id', 'gfx',
  5.        'vat', 'promo', 'weight', 'in_stock', 'price', 'actual_price' =>
  6.        'IF(s.special_price, s.special_price, p.price)'))->joinLeft(array('g' =>
  7.        DB_PREFIX . 'gfx'), 't.pid = g.prod_id AND g.main_gfx = 1', array('unic_name'))->
  8.        joinLeft(array('m' => DB_PREFIX . 'manufacturers'), 'p.producer_id = m.producent_id', array('name'))->
  9.        joinLeft(array('s' => DB_PREFIX . 'special_offers'),
  10.        't.pid = s.pid AND s.date_from <= ' . strtotime(date("Y-m-d")) .
  11.        ' AND s.date_to >= ' . strtotime(date("Y-m-d")), array('special_price'))->where('t.lang = ?',
  12.        $session->lang)->where('t.active = 1')->group('m.name')->limit($krok, $page * $krok);
  13. ?>


chciałem po prostu pogrupować według producenta,

kod do obliczenia ilości podstron itp jest taki:

  1. <?php
  2. // pobranie ilosci produktow;
  3.            $select->reset(Zend_Db_Select::COLUMNS)->reset(Zend_Db_Select::LIMIT_COUNT)->
  4.                reset(Zend_Db_Select::LIMIT_OFFSET)->reset(Zend_Db_Select::ORDER);
  5.  
  6. //            $select->from(null, array('ile' => 'count( product_id )'));
  7.            $select->from(null, array('ile' => 'count( producer_id )'));
  8.  
  9.  
  10.            $hash = md5((string )$select);
  11.            $resIleStron = $cache->load('productlist_select_num_' . $hash);
  12.            if ($resIleStron === false)
  13.            {
  14.                $resIleStron = $select->query()->fetch();
  15.                $cache->save($resIleStron, 'productlist_select_num_' . $hash, array('product'));
  16.            }
  17.  
  18.            $smarty->assign('filter_producer_found', true);
  19.  
  20.            $ile_stron = ceil($resIleStron["ile"] / $krok);
  21. ?>


Będę wdzięczny za pomoc.
Pozdrawiam