本文整理汇总了PHP中comquick2cartHelper::getStoreIds方法的典型用法代码示例。如果您正苦于以下问题:PHP comquick2cartHelper::getStoreIds方法的具体用法?PHP comquick2cartHelper::getStoreIds怎么用?PHP comquick2cartHelper::getStoreIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comquick2cartHelper
的用法示例。
在下文中一共展示了comquick2cartHelper::getStoreIds方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchElement
/**
* Fetch custom Element view.
*
* @param string $name Field Name.
* @param mixed $value Field value.
* @param mixed $node Field node.
* @param mixed $control_name Field control_name/Id.
*
* @since 2.2
* @return null
*/
public function fetchElement($name, $value, $node, $control_name)
{
$db = JFactory::getDBO();
$user = JFactory::getUser();
$comquick2cartHelper = new comquick2cartHelper();
// Getting user accessible store ids
$storeList = $comquick2cartHelper->getStoreIds();
$options = array();
$app = JFactory::getApplication();
$jinput = $app->input;
$zone_id = $jinput->get('id');
$defaultSstore_id = 0;
if ($zone_id) {
// Load Zone helper.
$path = JPATH_SITE . DS . "components" . DS . "com_quick2cart" . DS . 'helpers' . DS . "zoneHelper.php";
if (!class_exists('zoneHelper')) {
JLoader::register('zoneHelper', $path);
JLoader::load('zoneHelper');
}
$zoneHelper = new zoneHelper();
$defaultSstore_id = $zoneHelper->getZoneStoreId($zone_id);
}
foreach ($storeList as $store) {
$storename = ucfirst($store['title']);
$options[] = JHtml::_('select.option', $store['store_id'], $storename);
}
$fieldName = $name;
return JHtml::_('select.genericlist', $options, $fieldName, 'class="inputbox required" size="1" ', 'value', 'text', $defaultSstore_id, $control_name);
}
示例2: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
if (!$user->id) {
?>
<div class="<?php
echo Q2C_WRAPPER_CLASS;
?>
my-coupons">
<div class="well" >
<div class="alert alert-error">
<span><?php
echo JText::_('QTC_LOGIN');
?>
</span>
</div>
</div>
</div>
<?php
return false;
}
$zoneHelper = new zoneHelper();
// Check whether view is accessible to user
if (!$zoneHelper->isUserAccessible()) {
return;
}
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->params = $app->getParams('com_quick2cart');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
throw new Exception(implode("\n", $errors));
}
$this->publish_states = array('' => JText::_('JOPTION_SELECT_PUBLISHED'), '1' => JText::_('JPUBLISHED'), '0' => JText::_('JUNPUBLISHED'));
// Get toolbar path
$comquick2cartHelper = new comquick2cartHelper();
$this->toolbar_view_path = $comquick2cartHelper->getViewpath('vendor', 'toolbar');
// get store id (list))from model and pass to getManagecoupon()
$this->store_role_list = $store_role_list = $comquick2cartHelper->getStoreIds();
if ($this->store_role_list) {
$this->store_id = $store_id = !empty($change_storeto) ? $change_storeto : $store_role_list[0]['store_id'];
$this->selected_store = $store_id;
if ($this->store_id) {
//$this->authorized_store_id= storeid of user
$this->authorized_store_id = $authorized_store_id = $comquick2cartHelper->createCouponAuthority($store_id);
}
}
// Setup TJ toolbar
$this->addTJtoolbar();
$this->_prepareDocument();
parent::display($tpl);
}
示例3: getListQuery
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
// Select the required fields from the table.
$query->select($this->getState('list.select', 'a.*'));
$query->from('`#__kart_coupon` AS a');
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = ' . (int) $published);
} elseif ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.id = ' . (int) substr($search, 3));
} else {
$search = $db->Quote('%' . $db->escape($search, true) . '%');
$query->where('( a.name LIKE ' . $search . ' OR a.code LIKE ' . $search . ' OR a.value LIKE ' . $search . ' )');
}
}
// Filter by store.
$filter_store = $this->state->get("filter.store");
// Get all stores by logged in user
$comquick2cartHelper = new comquick2cartHelper();
$my_stores = $comquick2cartHelper->getStoreIds($user->id);
if (count($my_stores)) {
// Get all store ids
foreach ($my_stores as $key => $value) {
$stores[] = $value["store_id"];
}
// If store filter is selected, check it in my stores array
if ($filter_store) {
if (in_array($filter_store, $stores)) {
$query->where("a.store_id = '" . $db->escape($filter_store) . "'");
}
} else {
$stores = implode(',', $stores);
if (!empty($stores)) {
$query->where(" a.store_id IN (" . $stores . ")");
}
}
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol && $orderDirn) {
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
}
示例4: getListQuery
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select($this->getState('list.select', 'a.*'));
$query->from('`#__kart_taxrates` AS a');
// Get all rec that having store in store table.
$query->select('z.name as zonename, z.store_id');
$query->select('s.title');
// Query $query->join('LEFT', '#__users AS created_by ON created_by.id = a.created_by');
$query->join('INNER', '#__kart_zone AS z ON z.id = a.zone_id');
$query->join('INNER', '#__kart_store AS s ON s.id = z.store_id');
// Getting user accessible store ids
$comquick2cartHelper = new comquick2cartHelper();
$storeList = $comquick2cartHelper->getStoreIds();
$storeIds = array();
foreach ($storeList as $store) {
$storeIds[] = $store['store_id'];
}
$accessibleStoreIds = '';
if (!empty($storeIds)) {
$accessibleStoreIds = implode(',', $storeIds);
$query->where('(z.store_id IN (' . $accessibleStoreIds . '))');
}
// Filter by published state
$published = $this->getState('filter.state');
if (is_numeric($published)) {
$query->where('a.state = ' . (int) $published);
} elseif ($published === '') {
$query->where('(a.state IN (0, 1))');
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.id = ' . (int) substr($search, 3));
} else {
$search = $db->Quote('%' . $db->escape($search, true) . '%');
$query->where('( a.name LIKE ' . $search . ' OR z.name LIKE ' . $search . ' )');
}
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol && $orderDirn) {
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
}
示例5: array
class="input-large bill inputbox required validate-name"
placeholder="<?php
echo Jtext::_('PLG_QTC_DEFAULT_ZONESHIPPING_METH_NAME_TOOLTIP');
?>
"
type="text" value="<?php
echo !empty($shipFormData['name']) ? $shipFormData['name'] : '';
?>
">
</div>
</div>
<!-- STORE LIST -->
<?php
// Getting user accessible store ids
$storeList = $comquick2cartHelper->getStoreIds();
$defaultSstore_id = !empty($shipFormData['store_id']) ? $shipFormData['store_id'] : '';
$options = array();
$options[] = JHtml::_('select.option', "", JText::_('PLG_QTC_DEFAULT_SELECT_STORE'));
foreach ($storeList as $store) {
$storename = ucfirst($store['title']);
$options[] = JHtml::_('select.option', $store['store_id'], $storename);
}
?>
<div class="control-group">
<label for="qtcShipMethStoreId" class="control-label" title="<?php
echo JText::_('PLG_QTC_DEFAULT_ZONESHIPPING_STORE_NAME_DESC');
?>
">
<?php
echo JText::_('PLG_QTC_DEFAULT_ZONESHIPPING_STORE_NAME');
示例6: getListQuery
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
$jinput = JFactory::getApplication()->input;
$layout = $jinput->get('layout', 'default', 'STRING');
// Select the required fields from the table.
$query->select($this->getState('list.select', 'a.*'));
$query->from('`#__kart_items` AS a');
$query->JOIN('LEFT', '`#__categories` AS c ON c.id=a.category');
// Filter by search in title.
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.item_id = ' . (int) substr($search, 3));
} else {
$search = $db->Quote('%' . $db->escape($search, true) . '%');
$query->where('( a.name LIKE ' . $search . ')');
}
}
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.state = ' . (int) $published);
} elseif ($published === '') {
if ($layout == 'my') {
$query->where('(a.state IN (0, 1))');
} else {
$query->where('(a.state = 1)');
}
}
// Filter by category.
$filter_menu_category = $this->state->get("filter.menu_category");
if ($filter_menu_category) {
$filter_show_subcat_products = $this->state->get("filter.show_subcat_products");
if ($filter_show_subcat_products) {
$catWhere = $this->getWhereCategory($filter_menu_category);
if ($catWhere) {
foreach ($catWhere as $cw) {
$query->where($cw);
}
}
} else {
$query->where("a.category = '" . $db->escape($filter_menu_category) . "'");
}
} else {
$filter_category = $this->state->get("filter.category");
if ($filter_category) {
$catWhere = $this->getWhereCategory($filter_category);
if ($catWhere) {
foreach ($catWhere as $cw) {
$query->where($cw);
}
}
}
}
if ($layout == 'default') {
// Show only the native products and published category,
$query->where(" c.published = 1");
$query->where(" a.parent = 'com_quick2cart'");
$storeHelper = new storeHelper();
$storeIds = $storeHelper->getStoreIds(1);
if (!empty($storeIds)) {
$storeidStr = implode(',', $storeIds);
$query->where(" a.store_id IN (" . $storeidStr . ')');
} else {
// If all stores are unpublished then dont show
$query->where(" a.store_id = -1");
}
$filter_category = $this->state->get("filter.category");
if ($filter_category) {
// Show from decedor category
$catWhere = $this->getWhereCategory($filter_category);
if ($catWhere) {
foreach ($catWhere as $cw) {
$query->where($cw);
}
}
}
} else {
// My stores view.
// Filter by store.
$filter_store = $this->state->get("filter.store");
// Get all published stores by logged in user
$comquick2cartHelper = new comquick2cartHelper();
$my_stores = $comquick2cartHelper->getStoreIds($user->id);
if (count($my_stores)) {
// Get all store ids
foreach ($my_stores as $key => $value) {
$stores[] = $value["store_id"];
}
//.........这里部分代码省略.........
示例7: isVendorsStoreId
/**
* FOR STORE OWNER :: ALL PRODUCT VIEW
* This public function checks whether current_store is releated to logged in user (vendpor)
*
* @param integer $change_storeto store id.
*
* @since 2.2
* @return boolean.
*/
public function isVendorsStoreId($change_storeto)
{
$comquick2cartHelper = new comquick2cartHelper();
$store_role_list = $comquick2cartHelper->getStoreIds();
$store_list = array();
if (empty($store_role_list)) {
return 0;
}
foreach ($store_role_list as $store) {
$store_list[] = $store['store_id'];
}
// FOR STORE OWNER :: ALL PRODUCT VIEW, check change_storeto
if (!in_array($change_storeto, $store_list)) {
// Change store does not beloning to store owners then set vendors first store id as..
$change_storeto = $store_role_list[0]['store_id'];
} elseif (empty($change_storeto)) {
// If current_store=0
$change_storeto = $store_role_list[0]['store_id'];
// Not previously set in main frame
}
return $change_storeto;
}
示例8: isUserAccessible
/**
* Method check whether view is accessible or not.
*
* @param string $view view name.
* @param string $layout layout name.
* @param string $viewTpe viewTpe.
*
* @since 2.2
* @return boolean true or false.
*/
public function isUserAccessible($view = '', $layout = "default", $viewTpe = "list")
{
$comquick2cartHelper = new comquick2cartHelper();
// Getting user accessible store ids @TO DO use store_authorize FUNCTIPN HERE
$storeList = $comquick2cartHelper->getStoreIds();
if (empty($storeList)) {
?>
<div class="<?php
echo Q2C_WRAPPER_CLASS;
?>
" >
<div class="well" >
<div class="alert alert-error">
<span ><?php
echo JText::_('COM_QUICK2CART_TAXTRATES_S_STORE_NOT_FOUND');
?>
</span>
</div>
</div>
</div>
<?php
return false;
}
return true;
}