本文整理汇总了PHP中Catalog::getOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Catalog::getOne方法的具体用法?PHP Catalog::getOne怎么用?PHP Catalog::getOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Catalog
的用法示例。
在下文中一共展示了Catalog::getOne方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Report
public static function Report()
{
$sql = 'SELECT * FROM {{orders}} WHERE loyalty=1 AND sent=0';
$list = DB::getAll($sql);
foreach ($list as $order) {
$sql = '
SELECT * FROM {{orders_items}}
WHERE orders=' . $order['id'] . '
';
$items = DB::getAll($sql);
$data = $order;
foreach ($items as $item) {
$temp = Tree::getInfo($item['tree']);
if ($temp['path'] != 'catalogopt') {
$data['list'][] = Catalog::getOne($item['tree']);
}
}
$text = View::getRenderEmpty('email/report', $data);
$mail = new Email();
$mail->Text($text);
$mail->Subject('Оставьте отзыв о товаре на сайте www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
$mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
$mail->To($order['email']);
$mail->Send();
$sql = '
UPDATE {{orders}}
SET sent=1
WHERE id=' . $order['id'] . '
';
DB::exec($sql);
}
}
示例2: getManagerBooks
public static function getManagerBooks()
{
$data = array();
$sql = '
SELECT {{tree}}.id, \'tree\' AS what, {{tree}}.mdate AS udate FROM {{tree}}
INNER JOIN {{catalog}} ON {{tree}}.id={{catalog}}.tree
WHERE (({{catalog}}.rejected=\'\' AND {{tree}}.visible=0) OR ({{catalog}}.status=\'salereq\')) AND filecover<>\'\'
ORDER BY {{tree}}.mdate DESC
';
$list = DB::getPagi($sql);
foreach ($list as $item) {
$data[] = Catalog::getOne($item['id']);
}
return $data;
}
示例3: getSales
function getSales()
{
$data = array();
$sql = '
SELECT {{catalog}}.tree FROM {{catalog}}
INNER JOIN {{tree}} ON {{catalog}}.tree={{tree}}.id
WHERE visible=1 AND {{catalog}}.price<{{catalog}}.oldprice
ORDER BY RAND() LIMIT 0,2
';
$list = DB::getAll($sql, 'tree');
foreach ($list as $item) {
$data[] = Catalog::getOne($item);
}
return $data;
}
示例4: books
function books()
{
if (is_numeric(Funcs::$uri[2]) && !isset($_GET['preview'])) {
$data = Catalog::getOne(Funcs::$uri[2]);
$seo['seo_title'] = $data['name'];
Funcs::setMeta($seo);
$data['list'] = Catalog::getCabinetBooksList($data['vendor']);
View::render('cabinet/booksOne', $data);
} elseif (is_numeric(Funcs::$uri[2]) && isset($_GET['preview'])) {
$data = Catalog::getOne(Funcs::$uri[2]);
$seo['seo_title'] = $data['name'];
Funcs::setMeta($seo);
View::render('cabinet/booksPreview', $data);
} elseif (Funcs::$uri[2] == 'del' && is_numeric(Funcs::$uri[3])) {
$data = Catalog::delBook(Funcs::$uri[32]);
$this->redirect($_GET['redirect']);
} elseif (Funcs::$uri[2] == 'saleoff') {
Catalog::saleOff($_GET['id']);
$this->redirect($_GET['redirect']);
} elseif (Funcs::$uri[2] == 'private') {
Catalog::saleOff($_GET['id']);
$this->redirect($_GET['redirect']);
} else {
$seo['seo_title'] = 'Мои книги';
Funcs::setMeta($seo);
$data['list'] = Catalog::getCabinetBooksList($_SESSION['iuser']['id']);
View::render('cabinet/books', $data);
}
}
示例5: getConfirm
public function getConfirm($id)
{
$sql = 'SELECT * FROM {{orders}} WHERE id=' . $id . '';
$data = DB::getRow($sql);
$sql = 'SELECT * FROM {{orders_items}} WHERE orders=' . $id . '';
$data['goods'] = DB::getAll($sql);
$sum = 0;
$count = 0;
$sale = 0;
foreach ($data['goods'] as $key => $item) {
$goods = Catalog::getOne($item['tree']);
$sum += $item['price'] * $item['num'];
$sale += ($goods['price'] - $item['price']) * $item['num'];
$count++;
$goods['sale'] = $item['sale'];
$goods['realprice'] = $goods['price'];
$goods['total'] = $item['price'] * $item['num'];
$goods['num'] = $item['num'];
$goods['price'] = $item['price'];
$data['goods'][$key] = $goods;
}
$data['sum'] = $sum;
$data['count'] = $count;
$data['sale'] = $sale;
return $data;
}
示例6: getHits
public static function getHits()
{
$data = array();
$ids = Tree::getChilds(2);
$sql = '
SELECT DISTINCT {{tree}}.id FROM {{tree}}
INNER JOIN {{catalog}} ON {{catalog}}.tree={{tree}}.id
WHERE {{tree}}.visible=1 AND {{tree}}.parent IN (' . implode(',', $ids) . ') AND {{catalog}}.hit=1
ORDER BY {{tree}}.num DESC LIMIT 0,4
';
//print DB::prefix($sql);
$list = DB::getAll($sql);
foreach ($list as $item) {
$data[] = Catalog::getOne($item['id']);
}
return $data;
}
示例7: getCompare
public static function getCompare()
{
if (count($_SESSION['compare']) > 0) {
$return = array();
$data = array();
$i = 0;
foreach ($_SESSION['compare'] as $id) {
if ($i < 3) {
$data[] = Catalog::getOne($id);
}
$i++;
}
$additional = array();
if (count($data) > 0) {
foreach ($data as $item) {
if (is_array($item['additional'])) {
foreach ($item['additional'] as $title => $values) {
if (is_array($values)) {
foreach ($values as $k => $v) {
$additional[$title][$k] = '';
}
}
}
}
//$additional
}
foreach ($data as $i => $item) {
foreach ($additional as $title => $values) {
foreach ($values as $k => $v) {
$data[$i]['additional'][$title][$k] = $item['additional'][$title][$k];
}
}
}
$additional = array();
if (is_array($data[0]['additional'])) {
foreach ($data[0]['additional'] as $title => $values) {
if (is_array($values)) {
foreach ($values as $k => $v) {
$tn = '';
foreach ($data as $key => $item) {
if ($tn != $item['additional'][$title][$k] && $item['additional'][$title][$k] != '' && $tn != '') {
$additional[$title][$k] = 1;
$n = 1;
}
$tn = $item['additional'][$title][$k];
}
}
} else {
$tn = '';
foreach ($data as $key => $item) {
if ($tn != $item['additional'][$title] && $item['additional'][$title] != '' && $tn != '') {
$additional[$title] = 1;
$n = 1;
}
$tn = $item['additional'][$title];
}
}
}
}
}
return array('items' => $data, 'additional' => $additional);
} else {
return array();
}
}
示例8: getFavorite
public static function getFavorite()
{
if (isset($_COOKIE['favorite'])) {
$favorite = explode(',', $_COOKIE['favorite']);
}
if (count($favorite) > 0) {
$tab = strtolower(__CLASS__);
$return = array();
$sql = '
SELECT DISTINCT {{tree}}.id FROM {{' . $tab . '}}
INNER JOIN {{tree}} ON {{' . $tab . '}}.tree={{tree}}.id
WHERE {{tree}}.id IN (' . implode(',', $favorite) . ')
';
$catalog = DB::getAll($sql, 'id');
foreach ($catalog as $item) {
$return[] = Catalog::getOne($item);
}
return $return;
} else {
return array();
}
}
示例9: askprice
function askprice()
{
if ($_SESSION['iuser']) {
View::$layout = 'popup';
View::render('popup/askprice', Catalog::getOne($_GET['id']));
}
}
示例10: getOrderGoods
public function getOrderGoods($order)
{
$data = array();
$sql = '
SELECT {{dealers_orders_items}}.*, {{tree}}.name FROM {{dealers_orders_items}}
INNER JOIN {{tree}} ON {{dealers_orders_items}}.tree={{tree}}.id
WHERE {{dealers_orders_items}}.`order`=' . $order . '
';
$list = DB::getAll($sql);
foreach ($list as $item) {
$sql = 'SELECT parent FROM {{tree}} WHERE id=' . $item['tree'] . '';
$id = DB::getOne($sql);
$item['fields'] = Fields::getFieldsByTree($item['tree']);
$data[] = array('goods' => Catalog::getOne($id), 'size' => $item);
}
return $data;
}
示例11: __construct
function __construct()
{
if ($_POST) {
DB::escapePost();
if (isset($_POST['report'])) {
$tree = Tree::getTreeByUrl();
$href = Catalog::getPathToTree($tree['id']);
Catalog::setReport($tree['id']);
View::$layout = 'empty';
View::render('site/redirect', array('href' => $href, 'text' => 'Отзыв успешно добавлен!'));
die;
}
if (isset($_POST['subscribe'])) {
$tree = Tree::getTreeByUrl();
$href = Tree::getPathToTree($tree['id']);
Catalog::setSubscribe($tree['id']);
die;
}
} else {
DB::escapeGet();
if (Funcs::$uri[1] == '' && isset($_GET['hits']) && Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
$tree = Tree::getTreeByUrl();
Funcs::setMeta($tree);
$tree = Catalog::getHitCatalog($tree['id']);
View::render('catalog/catalog', array('list' => $tree, 'name' => 'Все хиты'));
} elseif (Funcs::$uri[1] == '' && Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
$tree = Tree::getTreeByUrl();
Funcs::setMeta($tree);
$tree = Catalog::getPreviewCatalog($tree['id']);
//View::render('catalog/catalog',array('list'=>$tree));
} elseif (Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
$tree = Tree::getTreeByUrl(Funcs::$uri[0]);
if ($tree['info']['type'] == 'struct') {
$temp = Catalog::getInnerListPagi($tree['id']);
$tree['list'] = $temp['list'];
$tree['vendors'] = Catalog::getVendors($tree['id'], $tree['list']);
//$tree['options']['available']=array();
//$tree['options']['catalog']=Catalog::getType($tree['id'],$tree['parent']);
//$tree['options']['vendors']=Catalog::getVendors($tree['id']);
if ($_GET['ve']) {
$tree['name'] = $tree['seo_description'] = $tree['name'] . ' ' . Funcs::$referenceId['vendor'][$_GET['ve']]['name'];
Funcs::setMeta($tree);
}
$tree['options']['price'] = Catalog::getValuesPrice($tree['id']);
$tree['options']['price2'] = Catalog::getLink('pricelink');
//$tree['options']['rating']=array();
Funcs::setMeta($tree);
$tree['quantity'] = $temp['quantity'];
if ($_GET['ajax'] == 'act') {
print $tree['quantity'];
die;
} else {
View::render('catalog/list', $tree);
}
} else {
Funcs::setMeta($tree, 'goods');
$id = $tree['id'];
$tree = Catalog::getOne($id);
Catalog::setPopularity($id);
$tree['reports'] = Catalog::getReports($id);
Catalog::setViewed($id);
$tree['same_price'] = Catalog::getAdditionalgood($id, 'better_for_same_price');
$tree['accessories'] = Catalog::getAdditionalgood($id, 'accessories');
//$tree['similargoods']=Catalog::getAdditionalgood($id,'similargoods');
$tree['similargoods'] = Catalog::getMore($tree['id'], $tree['parent']);
$tree['reportme'] = Catalog::getReport($tree['id']);
if (isset($_GET['print'])) {
View::$layout = 'empty';
View::render('catalog/print', $tree);
die;
} else {
View::render('catalog/one', $tree);
}
}
}
}
}