我在我的本地机器上使用Magento 2 EE.我一直在寻找这个问题几个小时.我想安装此处列出的示例页面模块:
https://github.com/magento/magento2-samples/tree/master/sample-module-newpage
而不是上传并尝试通过创建和上传文件和文件夹来敲击内部的一切,我在页面上阅读了这个引用:
This module is intended to be installed using composer.
Run Code Online (Sandbox Code Playgroud)
我是Composer的新手,Grunt和Github的世界以这种方式分叉和更新文件; 我老了但是想要适应.
我该怎么做呢?我已经设法在我的机器上安装Composer,并且我将终端打开到Magento 2的文件夹.我可以运行github命令或Composer命令; 我试过了:
#localhost:magento2ee: composer magento/sample-module-newpage
[InvalidArgumentException]
Command "magento/sample-module-newpage" is not defined.
Run Code Online (Sandbox Code Playgroud)
我也试过了
#localhost:magento2ee: composer require magento/sample-module-newpage
[InvalidArgumentException]
Could not find package magento/sample-module-newpage at any version for your minimum-stability (alpha). Check the package spelling or your minimum-stability
Run Code Online (Sandbox Code Playgroud)
以下是我的composer.json文件
{
"name": "magento/magento2ee",
"description": "Magento 2 (Enterprise Edition)",
"type": "magento-core",
"version": "1.0.0-beta4",
"license": [
"proprietary"
],
"require": {
"php": "~5.5.0|~5.6.0",
"zendframework/zend-stdlib": "2.4.0",
"zendframework/zend-code": "2.4.0",
"zendframework/zend-server": "2.4.0", …Run Code Online (Sandbox Code Playgroud) 我正在创建一个模块,它将支持不同商店视图的不同配置设置,如果有一个商店视图选择器类似于在管理员中编辑产品时出现的那个,那将是很好的.
我已设法使用代码将按钮添加到我的模块工具栏:
class Edit extends \Magento\Backend\Block\Template
{
protected function _prepareLayout()
{
$this->getToolbar()->addChild(
'save_button',
'Magento\Backend\Block\Widget\Button',
[
'label' => __('Save'),
'data_attribute' => [
'role' => 'save',
],
'class' => 'save primary',
'onclick' => "jQuery('#mp_mymodule_edit_form').submit();",
]
);
return parent::_prepareLayout();
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道是否可以使用Tools :: addChild方法插入商店视图选择器?一般来看看Stack Overflow和Google,并没有找到任何相关的东西.手指交叉,有人知道.
提前致谢
我在magento 2上创建了一个自定义小部件,我希望将文本字段用作(textarea).我尝试使用:
参数name ="text"xsi:type ="textarea"visible ="true"sort_order ="3"
但是我收到了这个错误:xsi:type属性的QName值'textarea'没有解析为类型定义.
如何在magento 2上的widget字段上使用textarea?
谢谢
如果屏幕宽度小于768px,我需要将产品图库导航缩略图移动到水平位置.
为此,我需要连接一个在完全加载库后触发的回调.
如何通过以下x-magento-init方法初始化图库窗口小部件时执行此操作:
<script type="text/x-magento-init">
{
"[data-gallery-role=gallery-placeholder]": {
"mage/gallery/gallery": {
...
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
我尝试添加:
<script type="text/javascript">
require(['jquery', 'mage/gallery/gallery'], function($, gallery){
console.log($('[data-gallery-role=gallery-placeholder]').data('gallery'));
});
</script>
Run Code Online (Sandbox Code Playgroud)
它输出undefined.但是当我从控制台调用相同的东西时(在加载库之后)它包含了我可以调用fotorama API方法的库对象.
那么如何.data('gallery')在图库初始化后获取对象?
非常感谢!
你好,我是magento2的新手
我想从指定的类别ID获取类别名称可以有人帮忙吗?
提前致谢
如何从属性集中获取magento 2中的产品属性组。我想通过使用组在列表页面上显示属性,以便将来可以添加更多属性
我是magento2的新手,我发现很难在新版本中获得常规代码片段.所以,请帮助我在这里解释magento2中以下片段的等价物:
Mage::getModel('catalog/product')->getCollection();
Mage::getModel('sales/order');
Mage::getModel('catalog/category')->getCollection();
Mage::getModel('customer/customer');
Mage::getModel('cart/quote');
Mage::getModel('checkout/cart');
Mage::getSingleton('customer/session');
Mage::getModel('catalog/category')->load(id);
Run Code Online (Sandbox Code Playgroud)
我希望这个问题能帮助所有新的magento 2开发人员在一个地方找到相关的查询.
几天来,我一直在为此苦苦挣扎...对于管理员扩展,我正尝试使用Ajax加载uiComponent以便在选项卡中显示。uiComponent已正确加载,但似乎未由客户端敲除逻辑完全处理。
namespace Man4x\MondialRelay2\Block\Adminhtml\Shipping;
class Tabs
extends \Magento\Backend\Block\Widget\Tabs {
protected function _construct()
{
parent::_construct();
$this->setId('mondialrelay2_shipping_tabs');
$this->setDestElementId('container');
$this->setTitle(__('MondialRelay'));
}
protected function _beforeToHtml()
{
$this->addTab(
'mass_shipping',
[
'label' => __('Mass Shipping'),
'title' => __('Mass Shipping'),
'url' => $this->getUrl('*/*/massshipping', ['_current' => true]),
'class' => 'ajax'
]
);
return parent::_beforeToHtml();
}
}
Run Code Online (Sandbox Code Playgroud)
这是简单的控制器布局:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<container name="root" label="Root">
<uiComponent name="mondialrelay2_massshipping_grid"/>
</container>
Run Code Online (Sandbox Code Playgroud)
注意:以标准方式(即非AJAX)加载时,此自定义uiComponent可以完美地发挥功能
跟踪AJAX响应时,我可以看到已为uiComponent加载了正确的HTML代码(包括Magento特定的“ x-magento-init”标签)。然后由jquery-ui回调处理:
this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
// support: jQuery <1.8
// jQuery <1.8 returns false …Run Code Online (Sandbox Code Playgroud) 我是Magento 2的新用户,我已经对此感到恼火,我进行了全新安装,并且在浏览器设置中一切正常,在前端和后端成功安装后出现错误,我无法在管理面板上登录,何时我加载管理页面给我这个错误:
Refused to execute script from '<URL>' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Run Code Online (Sandbox Code Playgroud)
我在线检查了一下,很多评论都说在pub / static中缺少htacess,但是一切都很好,我已经清理了缓存,编译,部署等。我做了所有的工作,但是无法理解为什么我仍然收到错误消息...
注意:我检查前端控制台错误的奇怪之处是错误行
http://mageuniversity.local/Magento_Theme/js/responsive.js net::ERR_ABORTED 404 (Not Found)
Run Code Online (Sandbox Code Playgroud)
我不明白在“ Magento_Theme / js ..”的根目录下到底是怎么回事。
magento2 ×10
magento ×5
php ×3
ajax ×1
composer-php ×1
fotorama ×1
javascript ×1
jquery ×1
linux ×1
magento-2.0 ×1
mysql ×1
parameters ×1
textarea ×1
uicomponents ×1