Go to the documentation of this file.
14 'title' =>
'_ch_store_page_title_browse',
15 'table' =>
'ch_store_products',
16 'ownFields' => array(
'id',
'title',
'uri',
'created',
'author_id',
'thumb',
'price_range',
'rate',
'desc'),
17 'searchFields' => array(
'title',
'desc',
'tags',
'categories'),
21 'table' =>
'Profiles',
22 'mainField' =>
'author_id',
24 'joinFields' => array(
'NickName'),
27 'restriction' => array(
28 'activeStatus' => array(
'value' =>
'approved',
'field'=>
'status',
'operator'=>
'='),
29 'owner' => array(
'value' =>
'',
'field' =>
'author_id',
'operator' =>
'='),
30 'tag' => array(
'value' =>
'',
'field' =>
'tags',
'operator' =>
'against'),
31 'category' => array(
'value' =>
'',
'field' =>
'Category',
'operator' =>
'=',
'table' =>
'sys_categories'),
32 'category_type' => array(
'value' =>
'',
'field' =>
'Type',
'operator' =>
'=',
'table' =>
'sys_categories'),
33 'public' => array(
'value' =>
'',
'field' =>
'allow_view_product_to',
'operator' =>
'='),
35 'paginate' => array(
'perPage' => 14,
'page' => 1,
'totalNum' => 0,
'totalPages' => 1),
45 'DateTimeUTS' =>
'created',
58 if (
false !==
ch_get(
'ch_store_filter'))
60 $this->aCurrent[
'restriction'][
'activeStatus'][
'value'] =
'pending';
61 $this->sBrowseUrl =
"administration";
62 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_pending_approval');
63 unset($this->aCurrent[
'rss']);
68 $this->aCurrent[
'restriction'][
'owner'][
'value'] = $oMain->_iProfileId;
69 $this->aCurrent[
'restriction'][
'activeStatus'][
'value'] =
'pending';
70 $this->sBrowseUrl =
"browse/user/" .
getNickName($oMain->_iProfileId);
71 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_pending_approval');
72 unset($this->aCurrent[
'rss']);
77 $this->aCurrent[
'restriction'][
'keyword'] = array(
'value' => $sValue,
'field' =>
'',
'operator' =>
'against');
81 $this->aCurrent[
'join'][
'category'] = array(
83 'table' =>
'sys_categories',
89 $this->aCurrent[
'restriction'][
'category_type'][
'value'] = $this->aCurrent[
'name'];
90 $this->aCurrent[
'restriction'][
'category'][
'value'] = $sValue2;
91 if (is_array($sValue2)) {
92 $this->aCurrent[
'restriction'][
'category'][
'operator'] =
'in';
95 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
96 $sValue2 =
$GLOBALS[
'MySQL']->unescape($sValue2);
97 $this->sBrowseUrl =
"search/$sValue/" . (is_array($sValue2) ? implode(
',',$sValue2) : $sValue2);
98 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_search_results') .
' ' . (is_array($sValue2) ? implode(
', ',$sValue2) : $sValue2) .
' ' . $sValue;
99 unset($this->aCurrent[
'rss']);
106 $this->isError =
true;
108 $this->aCurrent[
'restriction'][
'owner'][
'value'] =
$iProfileId;
109 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
110 $this->sBrowseUrl =
"browse/user/$sValue";
117 if ($aData[
'Avatar']) {
118 $a = array (
'ID' => $aData[
'author_id'],
'Avatar' => $aData[
'thumb']);
120 if (!$aImage[
'no_image'])
121 $this->aCurrent[
'rss'][
'image'] = $aImage[
'file'];
127 $this->aCurrent[
'restriction'][
'owner'][
'value'] = 0;
128 $this->sBrowseUrl =
"browse/admin";
129 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_admin_products');
133 $this->aCurrent[
'join'][
'category'] = array(
135 'table' =>
'sys_categories',
140 $this->aCurrent[
'restriction'][
'category_type'][
'value'] = $this->aCurrent[
'name'];
141 $this->aCurrent[
'restriction'][
'category'][
'value'] = $sValue;
142 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
143 $this->sBrowseUrl =
"browse/category/" .
title2uri($sValue);
144 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_browse_by_category', $sValue);
148 $this->aCurrent[
'restriction'][
'tag'][
'value'] = $sValue;
149 $sValue =
$GLOBALS[
'MySQL']->unescape($sValue);
150 $this->sBrowseUrl =
"browse/tag/" .
title2uri($sValue);
151 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_browse_by_tag', $sValue);
155 $this->aCurrent[
'restriction'][
'price'] = array(
'value' =>
'Free',
'field' =>
'price_range',
'operator' =>
'=');
156 $this->sBrowseUrl =
"browse/free";
157 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_browse_free_products') .
' ' . $sValue;
161 $this->sBrowseUrl =
'browse/recent';
162 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_browse_recent');
166 $this->sBrowseUrl =
'browse/top';
167 $this->aCurrent[
'sorting'] =
'top';
168 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_browse_top_rated');
172 $this->sBrowseUrl =
'browse/popular';
173 $this->aCurrent[
'sorting'] =
'popular';
174 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_browse_popular');
178 $this->aCurrent[
'restriction'][
'featured'] = array(
'value' => 1,
'field' =>
'featured',
'operator' =>
'=');
179 $this->sBrowseUrl =
'browse/featured';
180 $this->aCurrent[
'title'] =
_t(
'_ch_store_page_title_browse_featured');
184 $this->aCurrent[
'restriction'][
'calendar-min'] = array(
'value' =>
"UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')",
'field' =>
'created',
'operator' =>
'>=',
'no_quote_value' =>
true);
185 $this->aCurrent[
'restriction'][
'calendar-max'] = array(
'value' =>
"UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')",
'field' =>
'created',
'operator' =>
'<=',
'no_quote_value' =>
true);
186 $this->sEventsBrowseUrl =
"browse/calendar/{$sValue}/{$sValue2}/{$sValue3}";
191 $this->sBrowseUrl =
'browse/';
192 $this->aCurrent[
'title'] =
_t(
'_ch_store');
193 unset($this->aCurrent[
'rss']);
197 $this->isError =
true;
202 $this->aCurrent[
'paginate'][
'perPage'] = $oMain->_oDb->getParam(
'ch_store_perpage_browse');
204 if (isset($this->aCurrent[
'rss']))
205 $this->aCurrent[
'rss'][
'link'] = CH_WSB_URL_ROOT . $oMain->_oConfig->getBaseUri() .
$this->sBrowseUrl;
208 $this->aCurrent[
'ownFields'][] =
'desc';
209 $this->aCurrent[
'ownFields'][] =
'created';
210 $this->aCurrent[
'paginate'][
'perPage'] = $oMain->_oDb->getParam(
'ch_store_max_rss_num');
217 $this->sFilterName =
'ch_store_filter';
219 parent::__construct();
224 if ($this->aCurrent[
'sorting'] ==
'last') {
226 $aSql[
'order'] =
" ORDER BY `ch_store_products`.`created` DESC";
228 } elseif ($this->aCurrent[
'sorting'] ==
'top') {
230 $aSql[
'order'] =
" ORDER BY `ch_store_products`.`rate` DESC, `ch_store_products`.`rate_count` DESC";
232 } elseif ($this->aCurrent[
'sorting'] ==
'popular') {
234 $aSql[
'order'] =
" ORDER BY `ch_store_products`.`views` DESC";
243 $s = parent::displayResultBlock ();
248 $GLOBALS[
'oSysTemplate']->addDynamicLocation($oMain->_oConfig->getHomePath(), $oMain->_oConfig->getHomeUrl());
249 $GLOBALS[
'oSysTemplate']->addCss(array(
'unit.css',
'twig.css'));
250 return $GLOBALS[
'oSysTemplate']->parseHtmlByName(
'default_padding.html', array(
'content' =>
$s));
257 return db_arr (
"SELECT * FROM `sys_modules` WHERE `title` = 'Store' AND `class_prefix` = 'ChStore' LIMIT 1");
277 return CH_WSB_URL_ROOT . $oMain->_oConfig->getBaseUri() .
'view/' . $a[
'uri'];
286 'created' =>
'created',
287 'author_id' =>
'author_id',
288 'NickName' =>
'NickName',
290 'price_range' =>
'price_range',
process_db_input($sText, $iStripTags=0)
__construct($sMode='', $sValue='', $sValue2='', $sValue3='')
ch_import($sClassName, $aModule=array())
ch_store_import($sClassPostfix, $aModuleOverwright=array())
db_arr($query, $bindings=[])
_t($key, $arg0="", $arg1="", $arg2="")
const CH_WSB_LOCALE_DATE_SHORT
getID( $str, $with_email=1)
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
getLocaleDate($sTimestamp='', $iCode=CH_WSB_LOCALE_DATE_SHORT)
if( $sMembersList) $iProfileId