public function addlogAction() { if ($this->getRequest()->isGet()) { $mode = $this->_getParam('mode'); if ($mode == 'log') { //$name = iconv("UTF-8","Windows-1251",$_GET['good']); $id = $_GET['id']; $href = $_GET['href']; $ip = "unknown"; $db2 = new Application_Model_DbTable_Products(); $prod = $db2->getProductById($id); $prod = $prod[0]; $name = $prod['name']; $price = $prod['price']; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } $date = date("d-m-Y", time() + TIME_DIFFER); $datet = date("d-m-Y H:i:s", time() + TIME_DIFFER); $input = array('date' => $date, 'fdate' => $datet, 'ip' => $ip, 'goodid' => $id, 'name' => $name, 'mycat_id' => MYCAT, 'source' => $href, 'price' => $price); $db = new Application_Model_DbTable_Cart(); $db->addLog($input); echo ''; exit; } } }
public function getdetailsAction() { $item = $this->_getParam("item"); $this->view->item = $item; $intval = is_numeric($item); $db = new Application_Model_DbTable_Products(); if (!$intval) { $product = $db->getProductByTranslit($item); } else { $product = $db->getProductById($item); } if (count($product) > 0) { $product = $product[0]; $this->view->entrance = glob_makeEntrance($product); $watched = array(); if (isset($_COOKIE['watched'])) { $watched = $db->getProductsByIds($_COOKIE['watched']); } $this->view->watched = $watched; $this->product_addToAlreadyWatched($product['id']); $cats_ar = $this->category_getItemCats($product); $this->view->section = $cats_ar['section']; $this->view->cat = $cats_ar['cat']; $this->view->itemname = $product['name']; $this->view->details = $product; Zend_Registry::set('section', $cats_ar['section']); Zend_Registry::set('cat', $cats_ar['cat']); $where_ar = array(); $where_ar['name'] = $product['name']; $s = glob_makeWhereCondition($where_ar); $params = array('perpage' => SIMILAR_PROD_NUM, 'curpage' => 1, 'order' => '', 'where' => $s, 'search' => $product['name']); $pager = null; $db->getProductsBySearch($params, $pager); $this->view->similar = $pager->getCurrentItems(); //->toArray(); $this->view->adsense = glob_getGoogleAd(3); } else { $this->_helper->viewRenderer('noproduct'); } }