Questions tagged «magento-2.1»

表示与Magento CE和EE 2.1.x相关的问题

2
如何在送货地址之前重新订购(切换)帐单地址
在一页结帐页面上,我需要在送货地址之前重新订购帐单地址。实际上,逻辑应该与现在相反。如果送货地址与帐单地址不同,则应该可以对其进行编辑。现在,您可以修改帐单邮寄地址(如果它与送货地址不同)。另外,帐单邮寄地址应与送货地址显示在同一“页面”上。当前在magento结帐步骤中的步骤1。 我该怎么做?也许有一个用于此的插件,但我找不到。 我附上了一家德国商店的屏幕截图,内容如下: 我找到了用于帐单的.html模板文件,看来这是在checkout_index_index.xml中结束的地方: <item name="billing-step" xsi:type="array"> <item name="component" xsi:type="string">uiComponent</item> <item name="sortOrder" xsi:type="string">2</item> <item name="children" xsi:type="array"> <item name="payment" xsi:type="array"> <item name="component" xsi:type="string">Magento_Checkout/js/view/payment</item> <item name="config" xsi:type="array"> <item name="title" xsi:type="string" translate="true">Payment</item> </item> <item name="children" xsi:type="array"> <!-- ... --> <!-- merge your payment methods here --> <item name="afterMethods" xsi:type="array"> <item name="component" xsi:type="string">uiComponent</item> <item …

1
在哪里可以找到系统值的默认值?magento 2.1
我想稍微更改url重写区域-我想问一下这个困扰了我一段时间的问题: 默认设置在哪里?例如对于url重写,我必须取消选中“使用系统值”以更改行为。在哪里可以更改此“系统值”? Use Categories Path for Product URLs Yes/No [x] Use system value Create Permanent Redirect for URLs if URL Key Changed Yes/No [x] Use system value

3
基本网址变更Magento2.1
我已经更改了Magento 2.1中的基本URL,但是它不起作用。 安装时,我已将基本网址设置为www.domain1.net。我需要将其更改为www.domain2.net。 我试过的 更新baseurl core_config_data: UPDATE core_config_data SET value = 'http://www.domain2.net/' WHERE path IN ('web/secure/base_url', 'web/unsecure/base_url'); 更换 design/head/includes/ UPDATE core_config_data SET value = REPLACE(value, 'http://www.domain1.net/', 'http://www.domain2.net/') WHERE path = 'design/head/includes'; 然后更改商店网址 php bin/magento setup:store-config:set --base-url="http://www.domain2.net/" php bin/magento setup:store-config:set --base-url-secure="https://www.domain2.net/" 最后清除了缓存: php bin/magento cache:flush 在搜索www.domain2.net之后,找不到服务器。 参考: https://mage2.pro/t/topic/22 http://blog.netgloo.com/2016/05/13/magento-2-change-base-url-using-the-command-line/ 在magento 2.1中更改基本url的正确方法是什么?


4
Magento 2在运输方式中添加下拉列表
我为一些物流公司开发运输方式。该公司有许多办事处,客户可以在此获得他的订单。我可以在API中按сity列出办公室列表,但是现在我不能更好地表示这一步了吗? 现在,我只是\Magento\Quote\Model\Quote\Address\RateResult\Method 为城镇中的每个办公室设置了新的设备,在大城市中,计数> 100,并且我认为在结帐中设置100条线不是很好。 这将是用于不同结帐设计的公共模块,因此在用户选择一种运输方式后,如何在选中的运输方式附近呈现一些下拉列表以及办公室列表,并设置价格和方法。

5
当您有相关产品并且启用了全页缓存时,产品页面上的错误
我在某些具有相关产品的产品上收到此错误: Warning: Invalid argument supplied for foreach() in vendor/magento/module-catalog/Block/Product/ProductList/Related.php on line 129 仅在打开全页缓存时才会发生此问题。不幸的是,由于速度差异巨大(禁用页面缓存快2秒钟以上),因此不能选择禁用它。 我尝试了我所知道的一切:删除了主题,自定义模块等。 环境:生产,2.1.0,清漆。 这是完整的堆栈跟踪: a:4:{i:0;s:190:"Warning: Invalid argument supplied for foreach() in vendor/magento/module-catalog/Block/Product/ProductList/Related.php on line 129";i:1;s:5441:"#0 vendor/magento/module-catalog/Block/Product/ProductList/Related.php(129): Magento\Framework\App\ErrorHandler->handler(2, 'Invalid argumen...', '/home/11396-492...', 129, Array) #1 var/generation/Magento/Catalog/Block/Product/ProductList/Related/Interceptor.php(37): Magento\Catalog\Block\Product\ProductList\Related->getIdentities() #2 vendor/magento/module-page-cache/Model/Layout/LayoutPlugin.php(71): Magento\Catalog\Block\Product\ProductList\Related\Interceptor->getIdentities() #3 vendor/magento/framework/Interception/Interceptor.php(152): Magento\PageCache\Model\Layout\LayoutPlugin->afterGetOutput(Object(Magento\Framework\View\Layout\Interceptor), ' <script>\n ...') #4 var/generation/Magento/Framework/View/Layout/Interceptor.php(494): Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', Array, …

7
在结帐页面Magento2中添加页眉和页脚
默认情况下,Magento 2 在CHECK OUT页面中不提供HEADER和FOOTER。 所以我检查了路径上的checkout_index_index.xml文件 app/design/frontend/package_name/theme_name/Magento_Checkout/layout/override/base 有删除页眉和页脚属性集 所以我将remove属性从remove = true取消设置为remove = false。 但是结帐页面上仍然没有显示页眉和页脚,因此有人可以告诉我如何在结帐页面上获取页眉和页脚吗?

1
Magento 2.1 Ui组件表单字段令牌输入
我想在输入字段中添加标签,其方式类似于在产品表单中添加类别的方法,如下图所示。 通过在Custom Ui表单中添加字段组件,我已经完成了很多任务 <field name="parent"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">Magento\Catalog\Ui\Component\Product\Form\Categories\Options</item> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Tags</item> <item name="componentType" xsi:type="string">field</item> <item name="formElement" xsi:type="string">select</item> <item name="component" xsi:type="string">Magento_Catalog/js/components/new-category</item> <item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item> <item name="dataScope" xsi:type="string">data.parent</item> <item name="filterOptions" xsi:type="boolean">true</item> <item name="showCheckbox" xsi:type="boolean">false</item> <item name="disableLabel" xsi:type="boolean">true</item> <item name="multiple" xsi:type="boolean">true</item> <item name="levelsVisibility" xsi:type="number">1</item> <item name="sortOrder" …

4
Magento 2-通过list.phtml渲染自定义产品集合
类别页面(前端)的产品网格是通过catalog_category_view.xml中的布局呈现的。 可以说我有一个自定义产品集合(通过 ProductRepositoryInterface::getList($searchCriteria) method 在自定义块类中并希望呈现此集合。呈现的结果应在前端显示为产品网格(就像任何类别页面一样)。 如何才能做到这一点 ? 通过查看catalog_category_view.xml有两条重要的线,它们负责呈现产品集合: <block class="Magento\Catalog\Block\Category\View" name="category.products" template="Magento_Catalog::category/products.phtml"> <block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml"> 如何为这些模板文件提供自定义产品集合,以便它们呈现我的集合? 如果我错了,请纠正我。 这是我的代码块的样子: <?php namespace Mod\Mod1\Block; use Magento\Framework\View\Element\Template; class Main extends Template { protected $_filterBuilder; protected $_filterGroupArray; protected $_filterGroupBuilder; protected $_searchCriteriaBuilder; protected $_productRepository; protected $_productFactory; protected $_list; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Api\ProductRepositoryInterface …

1
Magento2目录产品选项
我们在默认的Magento2.1中工作时发现了这个问题。 在为产品创建自定义选项时,如果我第二次选择下拉字段,则微调框永远不会停止加载。 请找到以下屏幕截图: 我认为这是Magento2的核心错误,任何人都可以确认并建议如何解决它? 谢谢

2
在Magento 2中加载自定义模型的最佳方法
由于我很难找到正确的方法,因此您可以在下面找到我制定的最佳实践。享受,如果需要,请更正我的英语,如果我是我,我就说我错了。:) 编辑: ...,我发现我在某些方面是错误的。因此,在Raphael的答案帮助我了解了更多信息之后,我更新了原始帖子。多亏他! 以下使用的概念: 如果您熟悉以下概念,将更容易理解以下代码和说明: 注入依赖性(因为$this->variable代码中的每个变量都被注入) 服务合同和资料库 厂 内容: 只是为了获得更多的上下文,假设我们有一个可以正确构造的模块: 包含方法的块类CustomBlock getCustomModel($id), 此方法根据在参数中传递的ID返回CustomModel对象, CustomModel类型对应于 \Vendor\Module\Model\CustomModel 此模型带有其资源模型(在中\Vendor\Module\Model\ResourceModel\CustomModel) 及其存储库(在中\Vendor\Module\Model\CustomModelRepository)。 问题: 让所有内容加载CustomModel对象的最佳实践是什么? 由于不建议使用load()此方法,因此不能使用CustomModel对象中的。 优良作法是您必须使用CustomModel服务合同。服务合同是数据接口(例如CustomModelInterface)和服务接口(例如CustomModelRepositoryInterface)。所以我的方块看起来像这样: / ** @var SlideRepositoryInterface * / 受保护的$ slideRepository; / ** * CustomBlock构造函数 * ... * @param CustomModelRepositoryInterface $ customModelRepository * ... * / 公共功能__construct( ... CustomModelRepositoryInterface $ customModelRepository ... …

3
Magento 2 StoreManagerInterface已存在于编译中的上下文对象中
我的扩展程序中出现此错误。 PackageName \ ModuleName \ Block \ Enhanced 在类中的PackageName \ ModuleName \ Block \ Enhanced在/var/www/html/app/code/PackageName/ModuleName/Block/Enhanced.php \ Magento \ Store \ Model \ StoreManagerInterface中已经存在上下文对象 public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\Session $catalogSession, \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = [] ) { parent::__construct($context, $data); $this->_catalogSession = $catalogSession; $this->_storeManager = $storeManager; }

1
配置参数“ componentType”是“ advanced_pricing_button”组件所必需的。| 升级Magento 2.0.7 => 2.1.0
经过很多问题后,我设法更新了Magento 2.0.7 => Magento 2.1.0 检查升级后,我看到两个问题:1.前端未显示任何产品。2.当我要在管理员中编辑产品时,出现以下错误: 1 exception(s): Exception #0 (Magento\Framework\Exception\LocalizedException): The configuration parameter "componentType" is a required for "advanced_pricing_button" component. Exception #0 (Magento\Framework\Exception\LocalizedException): The configuration parameter "componentType" is a required for "advanced_pricing_button" component. #0 /home/tm/public_html/vendor/magento/framework/View/Element/UiComponentFactory.php(360): Magento\Framework\View\Element\UiComponentFactory->mergeMetadataItem(Array, Array, false) #1 /home/tm/public_html/vendor/magento/framework/View/Element/UiComponentFactory.php(360): Magento\Framework\View\Element\UiComponentFactory->mergeMetadataItem(Array, Array, false) #2 /home/tm/public_html/vendor/magento/framework/View/Element/UiComponentFactory.php(360): Magento\Framework\View\Element\UiComponentFactory->mergeMetadataItem(Array, Array, false) #3 …

5
在VCS下,Magento 2项目的首选结构是什么?
当我开始一个新的M2项目时,我要做的第一件事是通过composer安装核心: composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition 现在,我可以在下编写我的自定义模块和主题app/code。然后,我composer.*将整个app/code文件夹添加到我的VCS中。到目前为止,一切都很好。 假设现在我想为我的项目使用一些构建工具,比如说Grunt或Gulp。 如果我自己提交Gruntfile.js,克隆仓库后magento/magento2-base运行时,它将被程序包覆盖composer install。 如果我提交了我gulpfile.js,我真的不能在a中定义我的依赖package.json,因为它也会被magento/magento2-base。 如果我决定使用Magento的Grunt设置并希望通过编辑/dev/tools/grunt(例如themes.js)下的文件来自定义它,则不能,因为我的更改将被覆盖magento/magento2-base。 我的理解是,您实际上无法在文档根目录中做很多事情。对于这个问题,当然有很多解决方案: 我可以git checkout -在安装后立即运行以重置自己的文件 我可以将构建文件存储在专用文件夹中,/build例如 我可以使用其他构建工具,例如Phing,Ant或Rake(尽管我的前端开发人员不会那么高兴) 我可以替换magento/magento2-base为具有针对核心文件的自定义映射的自定义包(虽然不是最佳选择,但是,这是一个选择) 我个人不喜欢所有这些选项,因此我想知道是否有一种首选或更好的方法来实现我要做的事情。 有人有同样的问题吗?您是如何解决的?您如何在VCS下构建项目? 更新 与项目设置有关的一个额外要点。在实验中,我注意到Magento作曲家安装程序具有文件覆盖标志: "extra": { "magento-force": "override" } 如果我没记错的话,它在内部被视为布尔值,因此我尝试将其设置false为跳过重写。当我运行时composer install,由于文件已存在,安装失败。基本上,如果我不让Magento覆盖文件,就无法安装。 那么,该标志的目的是什么?是否只想对我进行检查?老实说,这对我来说没有多大意义,但也许有人可以阐明这个话题。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.