我正在创建一个magento 2主题.我想在cms主页上显示自定义块.
我想知道在phtml和xml布局中显示静态块,cms页面内容
我能怎么做?
我试图按照https://mage2.pro/t/topic/270和http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-i18n中的说明进行操作.html#config-cli-subcommands-xlate-example2 但我仍然失败了.
我正在尝试将标题中的搜索框的文本从"在此处搜索整个商店..."更改为"Suche ..."
现在,我在app/i18n/Test/de_ch中有以下文件
在composer.json中使用此内容
{
"name": "test/de_ch",
"description": "German (Switzerland) language",
"version": "100.0.1",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"magento/framework": "100.0.*"
},
"type": "magento2-language",
"autoload": {
"files": [
"registration.php"
]
}
}
Run Code Online (Sandbox Code Playgroud)
de_ch.csv
"Search entire store here...","Suche..."
Run Code Online (Sandbox Code Playgroud)
language.xml
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
<code>de_CH</code>
<vendor>Test</vendor>
<package>de_ch</package>
</language>
Run Code Online (Sandbox Code Playgroud)
为registration.php
<?php \Magento\Framework\Component\ComponentRegistrar::register(\Magento\Framework\Component\ComponentRegistrar::LANGUAGE,'Test_de_ch',__DIR__);
Run Code Online (Sandbox Code Playgroud)
在管理员中,我使用Deutsch(Schweiz)配置了商店(商店>配置>常规>常规>区域设置选项>区域设置).
然后,尝试php bin/magento setup:upgrade和php bin/magento cache:clean
但没有,搜索表单中的文字仍然是"在这里搜索整个商店......"
我在Productdetail页面上有一个带有ProdcutSlider的问题.我不知道如何设置容器宽度和高度.
我找到了Fotorama插件的一些配置,但没有关于widht和height的信息.
我的Productimages有另一个方面.
<div class="fotorama__stage" style="width: 581px; height: 581px; line-height: 581px;">
这是插件的尺寸.
我的图像尺寸是530px x 350px,因此有太多的空白区域(顶部/底部).
有任何想法吗?
我已经在localhost上成功安装了magento 2,但我无法看到管理面板,因为它向我呈现404错误.
其次,当我打开前端时,CSS和JavaScript没有加载.他们也渲染了404错误.
当我尝试运行命令时:
{your Magento install dir}/bin/magento setup:static-content:deploy
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
[InvalidArgumentException]
There are no commands defined in the "setup:static-content" namespace.
Run Code Online (Sandbox Code Playgroud) 我在magento 2中创建了类别"Bag".具有filter属性:
我正在尝试从"Bag"类别获取可过滤属性.
我没有找到任何解决方案.
我已经在magento 1.9中做了同样的事情:
Mage::app()->setCurrentStore($store);
$layer = Mage::getModel("catalog/layer");
$category = Mage::getModel("catalog/category")->load($categoryid);
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();
Run Code Online (Sandbox Code Playgroud)
但我没有在Magento 2.x中得到这个
请帮我
我正在从CSV文件导入产品.导入文件的categories-column具有如下值:
Store Amsterdam/Lunchbox;Store Amsterdam/Lunchbox/Hot Sandwiches
Run Code Online (Sandbox Code Playgroud)
我已经设置了";" 作为Magento 2导入设置中的多值分隔符.
不知何故,Magento只添加Store Amsterdam(root)类别并导入0个产品(可能是因为它没有达到目的地类别).
当我手动创建子类别时,所有产品都正确导入.但我不想为剩余的34家店铺做这件事.
在报告中它说: Category "Store Amsterdam/Lunchbox" has not been created. URL key for specified store already exists.
这里出了什么问题?也许在类别表上写权限?不同的Magento用户?
我试过调用[POST] /carts/mine/items,带有正确承载的标题和正文:
{
"cart_item": 1,
"sku": "MY_SKU",
"qty": 1
}
Run Code Online (Sandbox Code Playgroud)
我收到了以下回复:
{
"message": "Invalid value of \"%value\" provided for the %fieldName field.",
"parameters": {
"fieldName": "qty",
"value": null
}
}
Run Code Online (Sandbox Code Playgroud)
有两件事,我不明白要放在cart_item中的内容(但这是必需的)而且我不知道为什么它一直告诉我qty为null?
我正在尝试使用自定义产品列表在自定义页面上显示分层导航块.
现在我有自定义控制器,xml布局和产品列表模板.
<referenceContainer name="sidebar.main">
<!-- ??? -->
</referenceContainer>
主要是,这个问题是针对Magento 2的git特有的.我有一个有效的Magento 2项目,我使用github repo安装了一个扩展 - https://github.com/Adyen/adyen-magento2.
在我目前的情况下,我必须调试该扩展,并且必须检查我的远程服务器.我已经分配了那个repo,并为例如cc_debug.patch文件创建了一个补丁.现在,我已将该补丁添加到本地服务器上的根目录.然后,如果我使用git apply --apply --directory=vendor/adyen/module-payment/ cc_debug.patch它执行补丁,那就做技巧并修改供应商目录下的文件.我将更改推送到repo,并且由于部署脚本,该文件已移至远程服务器.
现在,我只通过远程服务器进行读取访问,并且没有初始化.git.如果我确实在远程服务器上应用补丁,它肯定会被执行但是如果我下次推送,由于部署脚本供应商将被重新生成并且补丁应用的更改将丢失.据我所知,这里有一些勾引图片,但我对钩子缺乏了解.
我假设我必须在我的git local repo中创建post-deploy hook,如下所示:
#!/bin/sh
patchfile = "cc_debug.patch"
patchingdirectory = "vendor/adyen/module-payment/"
if [ -f "$patchfile" ]
then
git apply --apply --directory=$patchingdirectory $patchfile
fi
Run Code Online (Sandbox Code Playgroud)
现在,我无法将该钩子推送到远程仓库(甚至没有初始化),因此这个解决方案对我不起作用.或者我知道更新后是特定于远程的东西(如果我错了就纠正我)所以我猜测由于这个钩子会在远程服务器上执行更改但是如果我再次在另一台本地机器上克隆,我必须再次创建post-deploy补丁,这不是理想的情况.
每次部署脚本执行时,应用补丁的原因是什么?[注意:部署脚本不在我手中,因为它是由Magento通过github提供的webhooks执行的.所以,我假设必须有一些webhook使用我必须应用补丁,这又是我缺乏知识.]我相信有人和我的情况相同.请指导我.TIA.
我想更改第三方模块的HTML布局,该模块在产品描述页面的数量输入字段上显示INC / DEC按钮。
为此,我必须重写我所做的并且工作正常的第三方模块的JS。
问题是,在第一个具有空缓存的请求上,它的依赖项未加载并出现以下错误:
TypeError: $.widget is not a function (\app\code\MyCompany\General\view\frontend\web\js\qtycontrol.js)
TypeError: $(...).qtycontrol is not a function (where it has been called)
Run Code Online (Sandbox Code Playgroud)
刷新页面一次,使其工作正常。
请在下面找到我创建要覆盖的模块的代码以及原始第3方模块的代码的详细信息。
替代模块(\ app \ code \ MyCompany \ General \ view \ frontend \ web \ js \ qtycontrol.js):
;define([
'jquery',
'jquery/ui'],
(function ($, window, document, undefined) {
$.widget("infortis.qtycontrol", {
, _create: function()
{
this._initPlugin();
}
, _initPlugin: function()
{
//Exetnded code to display inc/dec buttons on the quantity input field but with changes in …Run Code Online (Sandbox Code Playgroud) magento2 ×10
php ×3
javascript ×2
api ×1
css ×1
fotorama ×1
git-apply ×1
hook ×1
jquery ×1
magento ×1
magento2.0.2 ×1
rest ×1
slider ×1
translation ×1
webhooks ×1