Magento

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


3
Magento 2结帐-400错误的请求
使用付款方式“货到付款”在Magento 2商店下订单时,我遇到以下错误。 POST http://yoursite.com/rest/ae_en/V1/carts/mine/payment-information 400 (Bad Request) 有没有人遇到过同样的问题?



2
Magento 2:-将选择属性添加到类别
我想将select / dropdown属性添加到类别并在后端显示它,以便商店所有者选择它。经过一番研究,我发现以下几点: 通过Setupscript创建属性 通过UI组件声明包括它 这就是我所做的: public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var $eavSetup \Magento\Eav\Setup\EavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $eavSetup->addAttribute( \Magento\Catalog\Model\Category::ENTITY, 'attribute_code', [ 'type' => 'int', 'label' => 'Top Navigation CMS Block', 'input' => 'select', 'source' => 'Magento\Catalog\Model\Category\Attribute\Source\Page', 'required' => false, 'sort_order' => 10, 'global' => …

4
Magento 2 update.log每分钟都会增加大量文件
更新: 我最终使用logrotate实用程序来处理不断增长的日志文件。我还设置了一些cron作业,这些作业将不时检查不需要的临时文件。 我已经配置并运行了标准的Magento 2 cron。两天后,在“管理”面板中运行某些操作时遇到了一些问题。当检查服务器日志时,我发现这是磁盘空间问题。经过进一步调查,我发现这update.log.txt是罪魁祸首。文件大小每分钟增加> 1MB。曾经有一段时间它达到了20GB以上。 标准Magento 2设置正常吗?还是可以&如何禁用它或至少将其最小化? 它同时发生在开发人员模式和生产模式中。 Cron设置基于此指南。 Cron标签: * * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install …
9 magento2  cron  log 

2
如何在Magento 2的管理表单中添加自定义字段?
我已经使用UI组件在管理员中创建了一个表单,因此view/adminhtml/ui_component/[module]_[entity]_form.xml我拥有以下内容: <field name="configuration"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">text</item> <item name="label" xsi:type="string" translate="true">Configuration</item> <item name="formElement" xsi:type="string">textarea</item> <item name="source" xsi:type="string">form</item> <item name="sortOrder" xsi:type="number">30</item> <item name="dataScope" xsi:type="string">configuration</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item> </item> </argument> </field> 现在,我不想将此值设为textarea,但是我想在后端为此值创建自己的HTML魔术。这个“ HTML Magic”最终将是很多JS / KnockOut,在发布表单时,水下仍会发送一些隐藏数据,因此它必须是表单的一部分。我尝试通过添加添加渲染: <item name="renderer" xsi:type="object">Vendor\Module\Block\Adminhtml\Renderer\Configurator</item> 但这仍会呈现文本区域。然后,我尝试用formElement自定义类替换,如下所示: <item name="formElement" xsi:type="object">Vendor\Module\Component\Form\Element\Configurator</item> …

2
按子产品属性过滤产品集合
我有分配给子产品的2属性之类的情况 1)person_height_from和2)person_height_to具有DropDown类型属性 仅在子产品中分配,而在母产品中不分配, 我想使用此属性过滤类别页面中的产品集合 喜欢 length = 175 $collection->addAttributeToFilter('person_height_from', array('lteq' => $length)); $collection->addAttributeToFilter('person_height_to', array('gteq' => $length)); 这是否可能只获得类别产品中子产品分配高于值的那些父产品 您的帮助将不胜感激

4
切换商店后如何更改商店语言
我有两家商店,一是英语,一是法语。 也可以用英语和法语创建产品和类别,但是我不能为法语创建类别或产品。 请帮忙,如何为法语商店创建类别,产品等内容?


1
消费者无权访问Magento2 rest API的%resources
我创建了一个新客户并获得了完美的令牌,但是当我尝试访问任何API时,例如 http://myhost.com/index.php/rest/V1/customers/me?Authorization=Bearerhy23vc01x9s1jd2t8gho47g58trllc0b 得到了错误 <?xml version="1.0"?> <response> <message>Consumer is not authorized to access %resources</message> <parameters> <resources>self</resources> </parameters> <trace>#0 /var/www/myhost.com/public_html/vendor/magento/module-webapi/Controller/Rest/RequestValidator.php(70): Magento\Webapi\Controller\Rest\RequestValidator->checkPermissions() #1 /var/www/myhost.com/public_html/vendor/magento/module-webapi/Controller/Rest/InputParamsResolver.php(80): Magento\Webapi\Controller\Rest\RequestValidator->validate() #2 /var/www/myhost.com/public_html/vendor/magento/module-webapi/Controller/Rest.php(299): Magento\Webapi\Controller\Rest\InputParamsResolver->resolve() #3 /var/www/myhost.com/public_html/vendor/magento/module-webapi/Controller/Rest.php(216): Magento\Webapi\Controller\Rest->processApiRequest() #4 /var/www/myhost.com/public_html/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(24): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http)) #5 /var/www/myhost.com/public_html/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #6 /var/www/myhost.com/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch() #7 /var/www/myhost.com/public_html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http)) #8 {main}</trace> </response> 请任何帮助
9 magento2 

1
Magento 2以迷你车的特价显示正常价格
我可以在将自定义功能放入核心文件的同时设置“ 正常价格”和“ 特价” vendor/magento/module-weee/Block/Item/Price/Renderer.php public function getUnitItemPriceExclTax() { $priceExclTax = $this->getItem()->getProduct()->getPrice(); return $priceExclTax; } 然后将此功能调用到核心文件中 vendor/magento/module-weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml 因此,正确获取两个价格,但我想覆盖它 vendor/magento/module-weee/Block/Item/Price/Renderer.php 阻止我的自定义模块。 我用以下代码创建了di.xml: <preference for="Magento\Weee\Block\Item\Price\Renderer" type="<namespace\<module_name>\Block\Item\Price\Renderer"/> 并将该getUnitItemPriceExclTax()函数放在该块中。



1
通过ui_component XML添加列时更新ui_bookmark表
在Magento 2中,ui_component基于网格的网格允许您对列进行重新排序,Magento下次登录时将记住您的设置。这是通过Magento ui_bookmark(通过Magento\Ui\Model\Bookmark模型对象)将数据保存在表中来完成的。 尽管此功能很简洁,但是当扩展开发人员或系统集成商使用Magento ui_componentXML向表中添加列时,它可能会带来问题。如果有自定义数据,ui_bookmark则Magento将(似乎)忽略新列的排序顺序,并且可能会发生奇怪/意外的事情。 对于想要将列添加到UI网格(Magento或自己的列)并确保列与其他列相关的扩展开发人员,是否有最佳实践和/或系统?即-“此第二个操作按钮应始终显示在最后,或始终显示倒数第二个”,或“名称字段应始终在ID之后。 扩展开发人员是否需要通过app/code/Package/Module/Setup/...类到达ui_bookmark表并自己更新这些条目?还是有更好的方法来做到这一点?还是当用户已经有一个条目时,扩展开发人员是否只需要将一列添加到意外的地方ui_bookmark?

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.