BoxGoods.php
1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
*
* @author liuziyang
* @version
*/
/**
* BoxGoods helper
*
* @uses viewHelper Zend_View_Helper
*/
class Web_View_Helper_BoxGoods extends Zend_View_Helper_Abstract {
/**
* @var Zend_View_Interface
*/
public $view;
/**
*
*/
public function boxGoods(array $goods, $query_str = '') {
if (empty($goods)) {
return $this->view->render('index/nome.phtml');
}
$goods_str = implode('-', $goods);
$query_key = 'search-goods-lists-' . md5($goods_str);
$mc = Q_Cache::factory(array(
'domain' => 'search',
'class' => 'goods'
));
$productData = $mc->get($query_key);
if (empty($productData)) {
$productData = QModels_Product_Client::getProductAllByIds($goods);
$mc->set($query_key, $productData, 300);
}
$this->view->productData = $productData;
return $this->view->render('box/goods.phtml');
}
/**
* Sets the view field
* @param $view Zend_View_Interface
*/
public function setView(Zend_View_Interface $view) {
$this->view = $view;
}
}