本文整理匯總了PHP中Magento\Store\Model\Store::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Store::getId方法的具體用法?PHP Store::getId怎麽用?PHP Store::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Store\Model\Store
的用法示例。
在下文中一共展示了Store::getId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: saveCfgForRussian
private function saveCfgForRussian($path, $value)
{
$entity = Cfg::ENTITY_MAGE_CORE_CONFIG_DATA;
$stoerViewId = $this->storeRussianRu->getId();
$bind = [Cfg::E_CONFIG_A_SCOPE => Cfg::SCOPE_CFG_STORES, Cfg::E_CONFIG_A_SCOPE_ID => $stoerViewId, Cfg::E_CONFIG_A_PATH => $path, Cfg::E_CONFIG_A_VALUE => $value];
$this->repoGeneric->replaceEntity($entity, $bind);
}
示例2: getCollection
/**
* @inheritdoc
*/
protected function getCollection(Store $store)
{
/** @var \Magento\Sales\Model\ResourceModel\Order\Collection $collection */
$collection = $this->_orderCollectionFactory->create();
$collection->addAttributeToFilter('store_id', ['eq' => $store->getId()]);
return $collection;
}
示例3: getLogoImage
/**
* Get logo image
*
* @param \Magento\Store\Model\Store $store
* @return string|null
*/
public function getLogoImage($store)
{
$image = null;
if (null !== $store) {
$image = basename($this->_scopeConfig->getValue('design/header/logo_src', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store->getId()));
}
return $image;
}
示例4: beforeGetTargetStorePostData
/**
* Set redirect url for store view based on request path info
*
* @param \Magento\Store\Block\Switcher $switcher
* @param \Magento\Store\Model\Store $store
* @param array $data
* @return array
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function beforeGetTargetStorePostData(\Magento\Store\Block\Switcher $switcher, \Magento\Store\Model\Store $store, $data = [])
{
$urlRewrite = $this->urlFinder->findOneByData([UrlRewrite::TARGET_PATH => $this->trimSlashInPath($this->request->getPathInfo()), UrlRewrite::STORE_ID => $store->getId()]);
if ($urlRewrite) {
$data[ActionInterface::PARAM_NAME_URL_ENCODED] = $this->urlHelper->getEncodedUrl($this->trimSlashInPath($this->urlBuilder->getUrl($urlRewrite->getRequestPath())));
}
return [$store, $data];
}
示例5: clearIndex
/**
* @param \Magento\Store\Model\Store $store
* @return void
*/
private function clearIndex(\Magento\Store\Model\Store $store)
{
$dimensions = [$this->dimensionFactory->create(['name' => 'scope', 'value' => $store->getId()])];
$configData = $this->indexerConfig->getIndexer(FulltextIndexer::INDEXER_ID);
/** @var \Magento\CatalogSearch\Model\Indexer\IndexerHandler $indexHandler */
$indexHandler = $this->indexerHandlerFactory->create(['data' => $configData]);
$indexHandler->cleanIndex($dimensions);
}
示例6: aroundSave
/**
* Invalidate design config grid indexer on store creation
*
* @param StoreStore $subject
* @param \Closure $proceed
* @return StoreStore
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function aroundSave(StoreStore $subject, \Closure $proceed)
{
$isObjectNew = $subject->getId() == 0;
$result = $proceed();
if ($isObjectNew) {
$this->indexerRegistry->get(Config::DESIGN_CONFIG_GRID_INDEXER_ID)->invalidate();
}
return $result;
}
示例7: getCollection
/**
* @inheritdoc
*/
protected function getCollection(Store $store)
{
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
$collection = $this->_productCollectionFactory->create();
$collection->setVisibility($this->_productVisibility->getVisibleInSiteIds());
$collection->addAttributeToFilter('status', ['eq' => '1']);
$collection->addStoreFilter($store->getId());
return $collection;
}
示例8: getRequestPathByIdPath
/**
* Retrieve request_path using id_path and current store's id.
*
* @param string $idPath
* @param int|\Magento\Store\Model\Store $store
* @return string
*/
public function getRequestPathByIdPath($idPath, $store)
{
if ($store instanceof \Magento\Store\Model\Store) {
$storeId = (int) $store->getId();
} else {
$storeId = (int) $store;
}
$select = $this->_getReadAdapter()->select();
/** @var $select \Magento\Framework\DB\Select */
$select->from(array('main_table' => $this->getMainTable()), 'request_path')->where('main_table.store_id = :store_id')->where('main_table.id_path = :id_path')->limit(1);
$bind = array('store_id' => $storeId, 'id_path' => $idPath);
return $this->_getReadAdapter()->fetchOne($select, $bind);
}
示例9: getStoreConfig
/**
* @param \Magento\Store\Model\Store $store
* @return \Magento\Store\Api\Data\StoreConfigInterface
*/
protected function getStoreConfig($store)
{
/** @var \Magento\Store\Model\Data\StoreConfig $storeConfig */
$storeConfig = $this->storeConfigFactory->create();
$storeConfig->setId($store->getId())->setCode($store->getCode())->setWebsiteId($store->getWebsiteId());
foreach ($this->configPaths as $methodName => $configPath) {
$configValue = $this->scopeConfig->getValue($configPath, \Magento\Store\Model\ScopeInterface::SCOPE_STORES, $store->getCode());
$storeConfig->{$methodName}($configValue);
}
$storeConfig->setBaseUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, false));
$storeConfig->setSecureBaseUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, true));
$storeConfig->setBaseLinkUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, false));
$storeConfig->setSecureBaseLinkUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, true));
$storeConfig->setBaseStaticUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_STATIC, false));
$storeConfig->setSecureBaseStaticUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_STATIC, true));
$storeConfig->setBaseMediaUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, false));
$storeConfig->setSecureBaseMediaUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, true));
return $storeConfig;
}
示例10: addStoreFilter
/**
* Add store filter to collection
* @param array|int|\Magento\Store\Model\Store $store
* @param boolean $withAdmin
* @return $this
*/
public function addStoreFilter($store, $withAdmin = true)
{
if ($store === null) {
return $this;
}
if (!$this->getFlag('store_filter_added')) {
if ($store instanceof \Magento\Store\Model\Store) {
$this->_storeId = $store->getId();
$store = [$store->getId()];
}
if (!is_array($store)) {
$this->_storeId = $store;
$store = [$store];
}
if (in_array(\Magento\Store\Model\Store::DEFAULT_STORE_ID, $store)) {
return $this;
}
if ($withAdmin) {
$store[] = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
}
$this->addFilter('store', ['in' => $store], 'public');
}
return $this;
}
示例11: getId
/**
* {@inheritdoc}
*/
public function getId()
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'getId');
if (!$pluginInfo) {
return parent::getId();
} else {
return $this->___callPlugins('getId', func_get_args(), $pluginInfo);
}
}
示例12: getChooseFromStoreHtml
/**
* Get HTML of store chooser
*
* @param \Magento\Store\Model\Store $storeTo
* @return string
*/
public function getChooseFromStoreHtml($storeTo)
{
if (!$this->_storeFromHtml) {
$this->_storeFromHtml = '<select ' . 'class="admin__control-select" ' . 'name="copy_to_stores[__store_identifier__]" ' . 'disabled="disabled">';
$this->_storeFromHtml .= '<option value="0">' . __('Default Values') . '</option>';
foreach ($this->getWebsiteCollection() as $_website) {
if (!$this->hasWebsite($_website->getId())) {
continue;
}
$optGroupLabel = $this->escapeHtml($_website->getName());
$this->_storeFromHtml .= '<optgroup label="' . $optGroupLabel . '"></optgroup>';
foreach ($this->getGroupCollection($_website) as $_group) {
$optGroupName = $this->escapeHtml($_group->getName());
$this->_storeFromHtml .= '<optgroup label=" ' . $optGroupName . '">';
foreach ($this->getStoreCollection($_group) as $_store) {
$this->_storeFromHtml .= '<option value="' . $_store->getId() . '"> ';
$this->_storeFromHtml .= $this->escapeHtml($_store->getName()) . '</option>';
}
}
$this->_storeFromHtml .= '</optgroup>';
}
$this->_storeFromHtml .= '</select>';
}
return str_replace('__store_identifier__', $storeTo->getId(), $this->_storeFromHtml);
}
示例13: getTableNameByStore
/**
* Return index table name
*
* @param \Magento\Store\Model\Store $store
* @param bool $useTempTable
* @return string
*/
protected function getTableNameByStore(\Magento\Store\Model\Store $store, $useTempTable)
{
$tableName = $this->getMainStoreTable($store->getId());
return $useTempTable ? $this->addTemporaryTableSuffix($tableName) : $tableName;
}
示例14: isStoreSelected
/**
* @param \Magento\Store\Model\Store $store
* @return bool
*/
public function isStoreSelected(\Magento\Store\Model\Store $store)
{
return $this->getStoreId() !== null && (int) $this->getStoreId() === (int) $store->getId();
}
示例15: getStoreId
/**
* Loads default store view and returns its id
*
* @return int
*/
public function getStoreId()
{
$this->loadStore();
return $this->store->getId();
}