cancel
Showing results for 
Search instead for 
Did you mean: 

how create module for framework in magento 2

how create module for framework in magento 2

Hi

 

I want to load Several different files in framework Magento 2 When the Other language is selected like as Persian .

8 REPLIES 8

Re: how create module for framework in magento 2

Hi @savadkoohy,

 

Which kind of files do you want to load with another language?

Re: how create module for framework in magento 2

framework\App\Request\Http.php

framework\Filter\TranslitUrl.php

framework\Locale\Format.php

framework\Pricing\PriceCurrencyInterface.php

framework\Stdlib\DateTime\Timezone.php

framework\View\PageLayout\Config.php

 

Re: how create module for framework in magento 2

@savadkoohy,

 

So basically you need the same contentn/feature on different languages, right? You want to use I18n features.

Re: how create module for framework in magento 2

Ok,
Where should Make this file? In:
App/code or App
It is possible to show me an example ?

Re: how create module for framework in magento 2

Re: how create module for framework in magento 2

i am using a e-commerce site which is all set but some of the places the home page is not set search bar and cart symbols are not in proper way i ll share a code with you please help me out of this problem

 

 

 

 

 

 

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magento.com for more information.
*
* @category design
* @package rwd_default
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
/**
* @var Mage_Page_Block_Html_Header $this
*/
?>
<?php /*<?php $store_code = $_REQUEST['___store']; ?>
<?php if($_REQUEST['s'] == 1){ ?>
<script>
jQuery(window).load(function(){

var storecode = '<?php echo $store_code; ?>';
var storecode1 = storecode.replace('/','');
//window.location.replace('http://trainingpros.co/efeco/?___store='+storecode1);
//alert(storecode1);
jQuery('#select-store').val('http://trainingpros.co/efeco/?___store='+storecode1).trigger('change');
location.reload();
})
</script>
<?php } ?> */ ?>

<?php // Redirect to login page if not logged in ?>
<?php //echo $this->getLayout()->createBlock('core/template')->setTemplate('locus/redirect.phtml')->toHtml(); ?>

<?php


$getemployeeid =Mage::getSingleton('core/session')->getEmployeeId();
if($getemployeeid != "")
{
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customerData = Mage::getModel('customer/customer')->load($getemployeeid)->getData();
$customer_name = $customerData['firstname']." ".$customerData['lastname'];
}
else
{
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customerData = Mage::getModel('customer/customer')->load($customer->getId())->getData();
$customer_name = $customerData['firstname']." ".$customerData['lastname'];
}
?>
<?php if(Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms') { ?>
<!--=============================================== Home Page Header ========================================================= -->
<!--<div class="header-language-background">
<div class="header-language-container">
<div class="store-language-container">
<?php //echo $this->getChildHtml('store_language') ?>
</div>

<?php //echo $this->getChildHtml('currency_switcher') ?>

<p class="welcome-msg"><?php //echo $this->getChildHtml('welcome') ?> <?php //echo $this->getChildHtml('accountLinks') ?></p>
</div>
</div>-->

<section id="sp-slider">
<section id="sp-top-header">
<div class="customtopmenu">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('locus/header/homelinks.phtml')->toHtml(); ?>
<header id="cust-header" class="cust-page-header" style="display: inline-block;width: 60%;">
<div class="page-header-container">


<!-- Search -->
<div id="header-search" class="skip-content" style="display: inline-block;width: 10%;">
<?php echo $this->getChildHtml('topSearch') ?>
</div>

<?php // In order for the language switcher to display next to logo on smaller viewports, it will be moved here.
// See app.js for details ?>
<div class="header-language-container" style="display: inline-block">
<div class="store-language-container" style="max-width: 100% !important;">
<?php echo $this->getChildHtml('store_language') ?>
</div>
</div>

<!-- Skip Links -->

<div class="skip-links" style="display: inline-block">
<a href="#header-nav" class="skip-link skip-nav">
<span class="icon"></span>
<span class="label"><?php echo $this->__('Menu'); ?></span>
</a>

<a href="#header-search" class="skip-link skip-search">
<span class="icon"></span>
<span class="label"><?php echo $this->__('Search'); ?></span>
</a>

<div class="account-cart-wrapper" style="display: inline block">
<!-- Cart -->
<div class="header-minicart" style="display: inline block">
<?php echo $this->getChildHtml('minicart_head'); ?>
</div>
<span class="my-divi">|</span>
<?php
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
?>
<a href="<?php echo $this->helper('customer')->getAccountUrl(); ?>" data-target-element="#header-account" class="skip-link skip-account">
<!--<span class="icon"></span>-->
<span class="label"><?php echo $this->__('My Account'); ?></span>
</a>
<?php } else { ?>

<a href="<?php echo Mage::getUrl('customer/account/login'); ?>"><?php echo $this->__('Login'); ?></a>
<?php } ?>

</div>

</div>

<!-- Navigation -->

<div id="header-nav" class="skip-content">
<?php //echo $this->getChildHtml('topMenu') ?>
</div>

 

<!-- Account -->

<div id="header-account" class="skip-content">
<?php echo $this->getChildHtml('topLinks') ?>
</div>
</div>
</header>
<div id="logo" style="left: 0;margin-top: 0;display: inline-block;float: right;"><a href="<?php echo Mage::getBaseUrl() ?>"><img src="<?php echo Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_WEB ); ?>custom/images/logo.png" width="110" height="106" border="0"></a></div>
</div>

</section>
<div id="hand-over"></div>
<!--header-->
<section id="header-section" style="margin-top: -50px;">
<div id="contenttopbar" >
<?php
$currentStoreId=Mage::app()->getStore()->getStoreId();
switch($currentStoreId){
case 2:
case 10:
case 11:
case 12:
echo "<h1>esco drives</h1>";
break;
case 4:
case 7:
case 8:
case 9:
echo "<h1>esco antriebstechnik gmbh</h1>";
break;
case 5:
case 13:
case 14:
case 15:
echo "<h1>esco transmissions S.A.";
break;
default:
echo "<h1>Welcome to esco<h1>";
break;
}
?>
</div>
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('webandpeople/custommenu/top.phtml')->toHtml(); ?>

 


<hr />

<h1>International Success based on a Worldwide Network </h1>
<hr />


<p align="center"><br>
<img src="<?php echo Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_WEB ); ?>custom/images/map_firmengruppe.gif" width="580" class="homeimg"></p>
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('locus/header/homedesc.phtml')->toHtml();

switch($currentStoreId){
case 2:
case 10:
case 11:
case 12:
echo $this->getLayout()->createBlock('core/template')->setTemplate('locus/header/homeescodrivesadd.phtml')->toHtml();
break;
case 4:
case 7:
case 8:
case 9:
echo $this->getLayout()->createBlock('core/template')->setTemplate('locus/header/homeescogmbhadd.phtml')->toHtml();
break;
case 5:
case 13:
case 14:
case 15:
echo $this->getLayout()->createBlock('core/template')->setTemplate('locus/header/homeescosaadd.phtml')->toHtml();
break;
default:
break;
}
?>
</section>
<script language="javascript">
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}

// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {

var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
<!--============================================ End Home Page Header ========================================================= -->
<?php } else { ?>
<!--================================================ Other Page Header ======================================================== -->

<section id="sp-slider">
<section id="sp-top-header">
<div class="customtopmenu">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('locus/header/homelinks.phtml')->toHtml(); ?>
<header id="cust-header" class="cust-page-header" style="display: inline-block;width: 60%;">
<div class="page-header-container">


<!-- Search -->
<div id="header-search" class="skip-content" style="display: inline-block">
<?php echo $this->getChildHtml('topSearch') ?>
</div>

<?php // In order for the language switcher to display next to logo on smaller viewports, it will be moved here.
// See app.js for details ?>
<div class="header-language-container" style="display: inline-block">
<div class="store-language-container" style="max-width: 100% !important;">
<?php echo $this->getChildHtml('store_language') ?>
</div>
</div>

<!-- Skip Links -->

<div class="skip-links">
<a href="#header-nav" class="skip-link skip-nav">
<span class="icon"></span>
<span class="label"><?php echo $this->__('Menu'); ?></span>
</a>

<a href="#header-search" class="skip-link skip-search">
<span class="icon"></span>
<span class="label"><?php echo $this->__('Search'); ?></span>
</a>
</div>

<div class="account-cart-wrapper" style="display: inline-block">
<!-- Cart -->
<div class="header-minicart">
<?php echo $this->getChildHtml('minicart_head'); ?>
</div>
<span class="my-divi">|</span>
<?php
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
?>
<a href="<?php echo $this->helper('customer')->getAccountUrl(); ?>" data-target-element="#header-account" class="skip-link skip-account">
<!--<span class="icon"></span>-->
<span class="label"><?php echo $this->__('My Account'); ?></span>
</a>
<?php } else { ?>
<a href="<?php echo Mage::getUrl('customer/account/login'); ?>"><?php echo $this->__('Login'); ?></a>
<?php } ?>

</div>

<!-- Navigation -->

<div id="header-nav" class="skip-content">
<?php //echo $this->getChildHtml('topMenu') ?>
</div>

 

<!-- Account -->

<div id="header-account" class="skip-content">
<?php echo $this->getChildHtml('topLinks') ?>
</div>
</div>
</header>
<div id="logo" style="left: 0;margin-top: 0;display: inline-block;float: right;"><a href="<?php echo Mage::getBaseUrl() ?>"><img src="<?php echo Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_WEB ); ?>custom/images/logo.png" width="110" height="106" border="0"></a></div>
</div>

</section>
<div id="hand-over"></div>
<!--header-->
<section id="header-section" style="margin-top: -50px;">
<div id="contenttopbar" >
<?php
$currentStoreId=Mage::app()->getStore()->getStoreId();
switch($currentStoreId){
case 2:
case 10:
case 11:
case 12:
echo "<h1>esco drives</h1>";
break;
case 4:
case 7:
case 8:
case 9:
echo "<h1>esco antriebstechnik gmbh</h1>";
break;
case 5:
case 13:
case 14:
case 15:
echo "<h1>esco transmissions S.A.";
break;
default:
echo "<h1>Welcome to esco<h1>";
break;
}
?>
</div>
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('webandpeople/custommenu/top.phtml')->toHtml(); ?>

 

<hr />
<!--=============================================== Other Page Header ======================================================== -->
<?php } ?>
<?php echo $this->getChildHtml('topContainer'); ?>


<?php /*default code

 

<link href="<?php echo $this->getSkinUrl('css/dropdown.css'); ?>" rel="stylesheet" type="text/css">
<script src="<?php echo $this->getSkinUrl('js/jquery.dropdown.js'); ?>"></script>

<!--<div class="header-language-background">
<div class="header-language-container">
<div class="store-language-container">
<?php //echo $this->getChildHtml('store_language') ?>
</div>

<?php //echo $this->getChildHtml('currency_switcher') ?>

<p class="welcome-msg"><?php //echo $this->getChildHtml('welcome') ?> <?php //echo $this->getChildHtml('accountLinks') ?></p>
</div>
</div>-->

<header id="header" class="page-header">
<div class="page-header-container">
<a class="logo" href="<?php echo $this->getUrl('') ?>">
<img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" class="large" />
<img src="<?php echo $this->getLogoSrcSmall() ?>" alt="<?php echo $this->getLogoAlt() ?>" class="small" />
<div class="store_name"><?php echo $code = Mage::app()->getStore()->getName(); ?></div>
</a>


<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/html/innermenu.phtml')->toHtml(); ?>

<!-- Search -->
<div id="header-search" class="skip-content">
<?php echo $this->getChildHtml('topSearch') ?>
</div>

<?php // In order for the language switcher to display next to logo on smaller viewports, it will be moved here.
// See app.js for details ?>
<div class="store-language-container"></div>

<!-- Skip Links -->

<div class="skip-links">
<a href="#header-nav" class="skip-link skip-nav">
<span class="icon"></span>
<span class="label"><?php echo $this->__('Menu'); ?></span>
</a>

<a href="#header-search" class="skip-link skip-search">
<span class="icon"></span>
<span class="label"><?php echo $this->__('Search'); ?></span>
</a>

<div class="account-cart-wrapper">
<!-- Cart -->
<div class="header-minicart">
<?php echo $this->getChildHtml('minicart_head'); ?>
</div>
<span class="my-divi">|</span>
<?php
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
?>
<a href="<?php echo $this->helper('customer')->getAccountUrl(); ?>" data-target-element="#header-account" class="skip-link skip-account">
<!--<span class="icon"></span>-->
<span class="label"><?php echo $this->__('My Account'); ?></span>
</a>
<?php } else { ?>
<a href="<?php echo Mage::getUrl('customer/account/login'); ?>">Login</a>
<?php } ?>

 

 

</div>


</div>

<!-- Navigation -->

<div id="header-nav" class="skip-content">
<?php //echo $this->getChildHtml('topMenu') ?>
</div>

 

<!-- Account -->

<div id="header-account" class="skip-content">
<?php echo $this->getChildHtml('topLinks') ?>
</div>
</div>
</header> */?>

 

 

 

Capture.PNG

Re: how create module for framework in magento 2

i dnt know how to create the div's in magento will you people please suggest me  how can i use the div's in  magento

 

Re: how create module for framework in magento 2

Hello,

 

please study xml so you will got idead how to create div.

 

<container name="header.panel.wrapper" htmlClass="panel wrapper" htmlTag="div" before="-">
<container name="header.panel" label="Page Header Panel" htmlTag="div" htmlClass="panel header">
<block class="Magento\Framework\View\Element\Template" name="skip_to_content" template="Magento_Theme::html/skip.phtml">
<arguments>
<argument name="target" xsi:type="string">contentarea</argument>
<argument name="label" translate="true" xsi:type="string">Skip to Content</argument>
</arguments>
</block>
<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="switch/languages.phtml"/>
<block class="Magento\Framework\View\Element\Html\Links" name="top.links">
<arguments>
<argument name="css_class" xsi:type="string">header links</argument>
</arguments>
</block>
</container>
</container>


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer