studioemma/magento2-module-core

Studio Emma Core module, with general functionality used in Magento 2 project

Installs: 9 390

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 24

Forks: 3

Open Issues: 1

Type:magento2-module

v2.1.3 2018-12-05 15:24 UTC

This package is auto-updated.

Last update: 2024-04-14 20:11:55 UTC


README

General

The purpose of this module is to offer general functionality that is usefull for different Magento 2 projects.

Functions

Product

getCurrentCategory

You can get the current category by using this code in the view template:

<?php
$_helper = $this->helper('StudioEmma\Core\Helper\Product');
$currentCategory = $_helper->getCurrentCategory();

echo $currentCategory->getName();
?>

getCurrentProduct

You can get the current product by using this code in the view template:

<?php
$_helper = $this->helper('StudioEmma\Core\Helper\Product');
$currentProduct = $_helper->getCurrentProduct();

echo $currentProduct->getName();
?>

Store

getCurrentStore

Return the current store

<?php
$_helper = $this->helper('StudioEmma\Core\Helper\Store');
$currentStore = $_helper->getCurrentStore();
?>

getLocale

Return the current locale associated with the current store.

<?php
$_helper = $this->helper('StudioEmma\Core\Helper\Store');
echo $_helper->getLocale();
?>

Customer

isLoggedIn

Checks if the customer is logged in

<?php
$_helper = $this->helper('StudioEmma\Core\Helper\Customer');
$isLoggedIn = $_helper->isLoggedIn();
?>

getCurrentCustomer

Returns the current customer if logged in. If not logged in, it will return false.

<?php
$_helper = $this->helper('StudioEmma\Core\Helper\Customer');
$customer = $_helper->getCurrentCustomer();
?>