问题标签 [magento2]

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 投票
2 回答
6198 浏览

payment-gateway - Magento 2 - 没有重定向到外部支付提供商

今天我开始为 Magento 2 开发一个支付模块。经过多次尝试和错误,我现在有了一个可以配置且有限制的支付模块。

现在,下一步是在下订单后启动交易请求。在 Magento 1 中,我将使用 getOrderPlaceRedirectUrl() 返回一个将消费者重定向到的 url。

当我使用 Magento 2 尝试此操作时,会调用该函数,但不会重定向到返回 url。

有谁知道这在 Magento 2 中是否发生了变化或者我做错了什么?

该函数如下所示:

0 投票
1 回答
3408 浏览

magento - Magento 2:自定义模块不起作用

我在 Magento 2 中创建了一个简单的自定义模块。但它不起作用。谁能建议我哪里出错了?

我的代码是

应用程序/etc/config.xml

应用程序/代码/Sparx/Helloworld/etc/module.xml

应用程序/代码/Sparx/Helloworld/Controller/Index/Index.php

应用程序/代码/Sparx/Helloworld/Block/Helloworld.php

应用程序/代码/Sparx/Helloworld/etc/frontend/routes.xml

应用程序/代码/Sparx/Helloworld/etc/view/frontend/layout/helloworld_index_index.xml

应用程序/代码/Sparx/Helloworld/view/frontend/templates/helloworld.phtml

我得到以下错误 在此处输入图像描述

我不确定出了什么问题。请只做那些需要的。

谢谢

0 投票
1 回答
919 浏览

magento2 - Magento2 Composer 安装不工作

运行推荐“作曲家安装”后得到此响应


使用包信息加载作曲家存储库从锁定文件安装依赖项(包括 require-dev) - 安装 squizlabs/php_codesniffer (1.5.3) 下载:正在连接...

无法获取https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/396178ada8499ec492363587f037125bf7b07fcc,请创建一个 GitHub OAuth 令牌以超过 API 速率限制

前往https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+sis245-desktop+2015-10-30+2032 检索令牌。它将存储在“/root/.composer/auth.json”中以供 Composer 将来使用。

令牌(隐藏):

- - - - - - - - - 请帮忙 - - - - - - - - - -

0 投票
10 回答
23414 浏览

magento - Magento 2:重新索引不起作用

我无法在magento 2中进行重新索引。谷歌后,我得到了我们可以用 shell 命令重新索引的解决方案

但它给出了错误

因为我在dev中看不到shell文件夹。

0 投票
2 回答
3705 浏览

php - 如何使用 composer 安装 Magento2 示例模块?

我在本地机器上使用 Magento 2 EE。我已经在这个上搜索了几个小时。我想安装此处列出的示例页面模块:

https://github.com/magento/magento2-samples/tree/master/sample-module-newpage

我没有上传并尝试通过创建和上传文件和文件夹来阻止里面的所有内容,而是在页面上阅读了以下引用:

我对 Composer 和 Grunt 和 Github 的世界以这种方式分叉和更新文件很陌生;我是老派,但正在努力适应。

我该怎么做呢?我已经设法在我的机器上安装了 Composer,并且终端打开到 Magento 2 的文件夹。我可以只运行 github 命令或 Composer 命令吗?我试过了:

我也试过

下面是我的 composer.json 文件

0 投票
2 回答
8940 浏览

magento - 如何在 magento 2.0 中获取原始大小的图像 url

我是 Magento 2.0 的新手,我一直在努力寻找解决方案。我的第一个问题,我还没有弄清楚,如何达到特定的功能?因为我注意到很多人使用 Magento 1.+ 中的那些:

或者

(例如获取原始图片 url Magento (1.6.1.0)

但我不能在 Magento 2.0 中使用它们。如果这种使用在上一个版本中不再可用,我可以用它作为实现功能的替代方法吗?

至于另一个问题,我无法在 grid.phtml (目录列表)中获得原始大小的图像。以下是获取图像的方法:

结果是这样的:

正如我上面提到的,我想获得原始大小的图像 url 而不是 small_image。我希望我能解释我的问题。如果有人有任何想法,请告诉我。谢谢!

0 投票
2 回答
9534 浏览

api - How to add an Item to a quote/cart via API on Magento2

I have tried calling [POST] /carts/mine/items, headers with correct bearer, and body:

and I get the folowing response:

Two things, I do not understand what to put in cart_item (but it is required) and I do not why it keeps telling me qty is null?

0 投票
1 回答
994 浏览

php - 作曲家 - 如何忽略一些地图文件?

我在我的 PHP 项目中使用作曲家。有一个模块将大量文件映射到根目录。这包括文件README.mdCHANGELOG.md并且会generation autolod files引发错误:

是否可以选择忽略映射中的文件列表并且不使用覆盖选项?

0 投票
2 回答
13744 浏览

api - 如何使用 Magento2 API 下订单?

我正在寻找使用 Magento2 的 REST API 下订单的完整“快乐路径”。到目前为止,这些是我遵循的所有步骤。我还缺少什么?

  1. 创建用户:[POST] /rest/V1/customers

  2. 登录(创建令牌):[POST] /rest/V1/integration/customer/token

  3. 获取导航产品类别:[GET] /rest/V1/categories

  4. 获取产品:

    4.1 获取分类产品:[GET] /rest/V1/categories/{category_id}/products

    4.2 或搜索产品:[GET] /rest/V1/products

  5. 创建购物车:[POST] /rest/V1/carts/mine

  6. 将商品添加到购物车:[POST] /rest/V1/carts/mine/items

  7. 获取购物车付款信息[GET] /rest/V1/carts/mine/payment-information

  8. ...

我还需要做什么才能下订单?

0 投票
2 回答
1469 浏览

magento2 - 在 Magento2 稳定版中创建新模块?

Magento2稳定版发布了,我们应该如何创建一个新的模块呢?在 Magento2 稳定版中创建新模块所需的确切步骤是什么?有什么方法可以将 Magento2 Beta 模块转换为稳定版模块?

期待听到你的想法。