问题标签 [magento-2.3]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
11 浏览

magento - 管理员菜单不会滑出,配置菜单也不会打开。按钮也不起作用

  1. Magento 2.3.1
  2. Ubuntu 18.04.2 LTS
  3. PHP 7.2.17

在开发环境中工作并启用了一些优化参数,这使得管理面板无法访问并且按钮在正确的文本中看起来不正确,看起来缩小了。即使没有任何按钮注册点击,管理面板也不会抽出,因此我无法将配置更改回来。

所有这些配置都是从 magento 2.3.1 管理面板完成的。我试图加快我的网上商店,但它造成了严重破坏。

试过改回来

  1. 启用 JS 缩小/合并/捆绑
  2. 启用 CSS 缩小/合并
  3. 启用 Html 缩小。

但无济于事。

0 投票
1 回答
2968 浏览

magento - 以编程方式更新库存源

我目前正在研究 magento2.3 MSI。我已经安装了 MSI,现在我正在尝试处理它。我创建了 3 个来源和 1 个库存。我需要将库存分配给来源。目前我已经创建了用于导入库存的 csv 导入器,但在此过程中,我还想将源名称分配给现有产品。例如:我有 source1、source2 和 source3 之类的来源,我不仅要分配更新数量和库存状态,还要分配源名称。

我用过这段代码:

数量和 is_in_stock 运行良好,但无法更新源名称以分配给该产品。这段代码有什么问题吗?或者有没有其他方法可以解决这个问题。如果有人知道解决方案,那将是非常可观的。谢谢!

这是我的模型源代码:

预期结果是将源分配给该产品,如下图所示:

在此处输入图像描述

但源未分配给该产品。

0 投票
2 回答
444 浏览

magento2 - 产品导入后不生成 URL 重写

我正在尝试将产品导入我的商店,但是数据库中根本没有生成重写,因此保留了长的默认 url。有人遇到过这个问题并在不使用外部模块的情况下解决了这个问题吗?在产品页面上正确设置了 URL 键。

不正确的网址

0 投票
0 回答
380 浏览

php-7.1 - 如何“警告:htmlspecialchars() 期望参数 1 是字符串,

我收到警告:

第 68 行看起来像

请帮忙。PHP版本是7.1

0 投票
0 回答
401 浏览

ajax - Magento 2 How to pass js variable to controller and then call template with custom code?

I need dynamically change custom attribute on the configurable page when I click to the swatch color attribute. On this purpose I programmatically created custom attributes with options on the admin panel, where I can save for every product his own custom attributes. I figure out how to call my custom attributes on simple products but I can't to do this with configurable product.

I see when I change color attribute - price is changed for every simple product([it's default thing), how to do same but with my custom attributes? I have one idea but I don't know how this one implement. So I know how to get current product id when you clicked on the color attribute(through js code) then I need pass this id data to the controller via ajax. I need to know how exactly to do this, how to pass js data through ajax to controller and then call needed block on the category page every time when I click on the color attribute? ? When I will be know how to do that I get with this id data - custom attribute values and call this template in the needed place. Code below is that what call custom attributes on the configurable product, but it's call all attributes for all simple products included in the configurable product. I need call these attributes for current product every time when I cliked on the color attribute. For example: if I click on the black color (which related to the product with id 123 ) I get custom block with custom attributes without reloading page(like price).color attributes

0 投票
1 回答
587 浏览

magento2 - 错误:运行 setup:upgrade 时,事务中不允许使用 DDL 语句。运行数据补丁

Magento 2.3.1

在以下位置制作数据补丁后:

vendor/ModuleName/Setup/Patch/Data/AddMyColumnPatch.php

(下面给出的代码AddMyColumnPatch.php

当我运行bin/magento setup:upgrade安装此补丁时,我在 cli 处收到以下错误:

事务中不允许使用 DDL 语句

我使用以下文件作为参考,使用数据补丁将列添加到我的表中:

vendor/magento/module-quote/Setup/Patch/Data/InstallEntityTypes.php

从 47 到 65 行。

我的AddMyColumnPatch.php代码是:

0 投票
1 回答
32 浏览

magento2 - 缺少css文件的没有背景的按钮

网站上的按钮失去了它们的风格,这使得它们变得不可见,所有人都认为它们仍然存在,但是是白色的,客户看不到它们。错误是混合内容:“ https://.com/mazhe/obleklo/dolnishta.html ”的页面是通过 HTTPS 加载的,但请求了不安全的样式表“ http://.com/theme_options/css/index/ ” . 此请求已被阻止;内容必须通过 HTTPS 提供。

0 投票
1 回答
817 浏览

magento - 安装后magento的Admin页面是空白的

安装后我无法登录或打开magento的管理页面,当我打开日志文件时,我发现了这个错误。请协助修复。[10-Jun-2019 07:05:15 UTC] PHP 致命错误:未捕获的 RuntimeException:指定的“C:/wamp64/www/Magento/generated/code/Magento/Framework/ObjectManager/Config/Reader/Dom/Proxy. php.15900" 文件无法写入。警告!file_put_contents(C:/wamp64/www/Magento/generated/code/Magento/Framework/ObjectManager/Config/Reader/Dom/Proxy.php.15900):无法打开流:权限被拒绝 Class Magento\Framework\ObjectManager\ Config\Reader\Dom\Proxy 生成错误:请求的类没有正确生成,因为“生成”目录权限是只读的。如果 --- 在运行 'bin/magento setup:di:compile' CLI 命令后,当 'generated' 目录权限设置为写---请求的类没有正确生成,那么你必须将生成的类对象添加到相关构造方法的签名中,才可以。在 C:\wamp64\www\Magento\vendor\magento\framework\Code\Generator.php:135 堆栈跟踪:

0 C:\wamp64\www\Magento\vendor\magento\framework\Code\Generator\Autoloader.php(35): Magento\Framework\Code\Generator->generateCl 在 C:\wamp64\www\Magento\vendor\magento \framework\Code\Generator.php 在第 135 行

[10-Jun-2019 07:33:12 UTC] PHP 致命错误:未捕获的 RuntimeException:指定的“C:/wamp64/www/Magento/generated/code/Magento/Backend/Model/MenuFactory.php.7848”文件无法不写。警告!file_put_contents(C:/wamp64/www/Magento/generated/code/Magento/Backend/Model/MenuFactory.php.7848):未能打开流:资源暂时不可用类 Magento\Backend\Model\MenuFactory 生成错误:The请求的类没有正确生成,因为“生成的”目录权限是只读的。如果 --- 运行 'bin/magento setup:di:compile' CLI 命令后 'generated' 目录权限设置为 write --- 请求的类没有正确生成,那么您必须将生成的类对象添加到仅相关构造方法的签名。在 C 中:

0 C:\wamp64\www\Magento\vendor\magento\framework\Code\Generator\Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\Backend...')

1【内部函数】:35行C:\wamp64\www\Magento\vendor\magento\framework\Code\Reader\ClassReader.php中的ma

0 投票
2 回答
2264 浏览

php - “创建对象时出现类型错误:Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Config”

我从 Magento 1.9.1.0 迁移到 Magento 2.3.1...迁移完成并出现警告,在我重新索引和刷新缓存并设置升级、编译和部署后,单击管理后端的所有客户显示错误,可以' t 查看所有客户,但订单页面中缺少一些客户信息,例如送货地址、账单地址、联系人和姓名。

我已经用不同的解决方案重新迁移了无数次,但我仍然遇到同样的错误。

{"0":"创建对象时出现类型错误:Magento\Eav\Model\Entity\Attribute\Source\Config","1":"#1 Magento\Framework\ObjectManager\Factory\Compiled->create('Magento \Eav\Mode...', array()) 在 [vendor/magento/framework/ObjectManager/ObjectManager.php:56] 调用

我期待客户页面应该正确加载,并且查看所有客户不应该给出错误,因为我真的经历了地狱试图解决这个问题。如有任何帮助,我将不胜感激。

0 投票
1 回答
941 浏览

email - 不推荐使用的功能:idn_to_ascii() Magento 2.3.1 和 PHP 7.2

我正在使用 Magento 2.3.1 和 PHP 7.2,在管理员端创建客户帐户时遇到错误。

在互联网上找到了一些降低 PHP 版本的资源。

在不降低 PHP 7.2 的情况下还有其他可用选项吗?

日志:

main.CRITICAL:异常消息:不推荐使用的功能:idn_to_ascii():INTL_IDNA_VARIANT_2003 在第 560 行的 /public_html/vendor/zendframework/zend-validator/src/EmailAddress.php 中已弃用

第 560 行的 idn_to_ascii():