New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

siteation/magento2-module-storeinfo

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

siteation/magento2-module-storeinfo

Get your store information with ease

magento2-module
Source
Packagist
This package is abandoned and is no longer maintained.
The author recommends using siteation/magento2-storeinfo instead.
This version has been yanked by its maintainers and should not be used.
Version
1.2.1
Version published
Total downloads
27K
Maintainers
1
Created
Source

Siteation - Magento 2 Module Store Info

Packagist Version Supported Magento Versions Hyvä Themes Supported License

This Magento 2 module adds the option to get the store information with ease.

So you can get the store phone number from the Stores > Config. Instead using static block or hard code it in your template directly.

Installation

Install the package via;

composer require siteation/magento2-module-storeinfo
bin/magento setup:upgrade

Note This Module requires Magento 2.3 or higher! For more requirements see the composer.json.

How to use

By defaut this module loads nothing.

Use one of the samples to get started.

Adding a address block

We have made an address block that uses the store information. And also comes with schema tags to enrich the Contact data.

To load the default store address block use 1 of the following xml samples in your template.

Hyva - XML Sample
<referenceBlock name="footer-content">
    <block
        name="footer.store.info"
        as="footer-store-info"
        template="Siteation_StoreInfo::hyva/store-address.phtml"
    />
</referenceBlock>
Luma - XML Sample
<referenceContainer name="footer">
    <block name="footer.store.info"
        as="footer-store-info"
        template="Siteation_StoreInfo::luma/store-address.phtml">
        <arguments>
            <argument name="viewModelStoreInfo" 
                xsi:type="object">Siteation\StoreInfo\ViewModel\StoreInfo</argument>
        </arguments>
    </block>
</referenceContainer>

Get Store info in your own block.

First get the viewModal in your template.

Hyva - Sample Phtml file head
<?php
declare(strict_types=1);

use Hyva\Theme\Model\ViewModelRegistry;
use Magento\Framework\View\Element\Template;
use Magento\Framework\Escaper;
use Siteation\StoreInfo\ViewModel\StoreInfo;

/** @var ViewModelRegistry $viewModels */
/** @var Template $block */
/** @var Escaper $escaper */

/** @var StoreInfo $storeInfo */
$storeInfo = $viewModels->require(StoreInfo::class);
Luma - Sample Phtml file head

For Luma templates, see the previous sample for the xml needed to load the viewModal.

<?php
declare(strict_types=1);

use Magento\Framework\View\Element\Template;
use Magento\Framework\Escaper;

/** @var Template $block */
/** @var Escaper $escaper */

/** @var Siteation\StoreInfo\ViewModel\StoreInfo $storeInfo */
$storeInfo = $block->getData('viewModelStoreInfo');

After this you can load any Magento StoreInfo field as text in your phtml;

<?php
// Get specific predefined store info field
$storeInfo->getPostcode();
$storeInfo->getSalesEmail();

// Get the same as above, using the global functions
$storeInfo->getStoreInfo('postcode'); // 'general/store_information/%s'
$storeInfo->getStoreEmail('email', 'ident_sales'); // 'trans_email/%2$s/%1$s'

Keywords

address

FAQs

Package last updated on 15 Dec 2022

Related posts