Magento

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

1
Magento 2 Override默认标题模板
我通过扩展Magento/Blank主题创建了自己的主题。 现在想的默认标题模板文件覆盖link.phtml,topmenu.phtml,header.phtml它位于vendor/module-theme/view/frontend/templates进我的主题。 我的主题位于 app/design/frontend/MyModule/MyTheme 因此,请让我知道如何覆盖以及它的结构。



2
Magento 2:应用自定义产品折扣后,分层导航价格过滤器不起作用
我正在开发产品折扣模块。我是通过插件和观察者完成的。在产品页面和列表页面上都可以正常工作。但是价格过滤器无法根据更新的产品价格运行。 这是我用来自定义价格的代码。 供应商名称/模块名称/etc/di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Catalog\Pricing\Price\FinalPrice"> <plugin name="custom_discount_catalog_pricing_price_finalprice" type="VendorName\ModuleName\Plugin\FinalPrice" /> </type> </config> VendorName / ModuleName / etc / events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <event name='catalog_product_get_final_price'> <observer name='customdiscount_finalprice' instance='VendorName\ModuleName\Observer\ProcessFinalPrice'/> </event> </config> VendorName / ModuleName / Observer / ProcessFinalPrice.php <?php namespace VendorName\ModuleName\Observer; use Magento\Framework\Event\ObserverInterface; class ProcessFinalPrice implements ObserverInterface { …

1
设置多选UI组件的默认值
我的magento 2安装中有一个自定义实体。 该实体中的字段之一是multiselect类型,包含所有国家/地区的列表。 我将ui组件用于我的管理表单。 由于选择中大约有200条记录,我不想使用多选字段,因为它不那么容易使用。 因此,我在添加/编辑产品管理部分中的类别类别中创建了一个精美的多选之一。 看起来更好,但是我无法为其设置默认值。 这是我的配置(请注意default配置项): <field name="affected_countries" formElement="select" component="Magento_Ui/js/form/element/ui-select" sortOrder="100"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="source" xsi:type="string">article</item> <item name="filterOptions" xsi:type="boolean">true</item> <item name="chipsEnabled" xsi:type="boolean">true</item> <item name="disableLabel" xsi:type="boolean">true</item> <item name="default" xsi:type="string">RO,MD</item> </item> </argument> <settings> <elementTmpl>ui/grid/filters/elements/ui-select</elementTmpl> <dataType>text</dataType> <label translate="true">Affected Countries</label> <dataScope>affected_countries</dataScope> <componentType>field</componentType> </settings> <formElements> <select> <settings> <options class="Magento\Config\Model\Config\Source\Locale\Country"/> …

4
如何在“管理员送货地址”框中显示自定义属性?
我在结帐页面上添加了带有自定义值的下拉自定义字段。它也可以正常工作,也可以将属性值保存在数据库中,但不会显示在订单运送地址中。知道如何显示吗? InstallSchema.php $connection->addColumn( $installer->getTable('quote_address'), 'mob_type', [ 'type' => \Magento\Framework\DB\Ddl\Table ::TYPE_TEXT, 'nullable' => true, 'default' => NULL, 'length' => 255, 'comment' => 'Mob Type' ] ); $connection->addColumn( $installer->getTable('sales_order_address'), 'mob_type', [ 'type' => \Magento\Framework\DB\Ddl\Table ::TYPE_TEXT, 'nullable' => true, 'default' => NULL, 'length' => 255, 'comment' => 'Mob Type' ] ); $installer->endSetup(); 插入 …


3
提高SOAP调用的性能
Magento 2.1出现性能问题 在我的商店中,我有90.000种产品。我将这些产品添加到肥皂中。当我这样做时,每篇文章(产品?)大约​​花费了7秒钟(Request> Response)。总而言之,初始化所有产品花了几天时间。 现在所有产品都在商店里。整整几周,我不得不更新文章(产品)上的某些内容。当我再次用肥皂擦洗时,需要花费相同的时间。更新后,商店将无法使用。请求和响应的示例在这里:https : //pastebin.com/aqnMJk98 https://pastebin.com/UAh0h8Zz 我的服务器具有12核心CPU,24 GB RAM和SSD。它运行带有Apache2 PHP7-fpm和MYSQL的Ubuntu 16.04。 当我观看更新过程时,我发现MySQL的5个核心正在以100%的速度工作,而其余的则处于闲置状态。仅使用少量的内存就iotop表明我的SSD很无聊。 我观察了数据库的性能,发现Magento在添加过程中向数据库触发了数千条命令。这个可以吗? 当我使用Magento CSV导入更新它时,它的速度要快得多。 我该怎么做才能加快Magento2的速度?在这种情况下,这家商店不可能很好地运作。

3
Magento 2:模型与数据模型之间的差异
我知道Magento 2引入了数据模型作为服务合同体系结构的一部分。数据模型通常实现在模块的Api / Data /中定义的接口。 但是,Magento似乎也保留了旧模型。 让我们以模块客户为例。 在Api / Data / CustomerInterface.php中定义的数据模型接口 上面的接口在Model / Data / Customer.php中实现 数据模型具有客户变量的所有getter和setter函数,正如人们所期望的那样 除上述内容外,还有一个Model / Customer.php。这也具有getter和setter功能。这更像是连接到ResourceModel(Model / ResourceModel / Customer.php)的Magento 1模型。 在Model / ResourceModel / CustomerRepository.php中,各种函数从Magnento 1模型收集数据,将它们传输到数据模型,然后返回数据模型。 为什么需要旧模型?为什么数据模型不能直接与ResourceModel连接?

3
以编程方式创建客户
我想以编程方式创建一些客户,并且在保存网站ID时遇到问题。 我有多个网站ID: 0 => admin 1 => germany 2 => hungary 3 => romania 这是我的代码: $customer = Mage::getModel("customer/customer"); $customer->setWebsiteId(3); $customer->setStoreId(1); ..... $customer->save(); 当我保存一个客户时,我Admin从网站下拉列表中选择了值。无论我给网站ID(如12321)赋予什么价值,我都得到了Admin价值。为什么呢 谢谢。

1
Magento 2使用模态按钮添加类别树渲染器输入
我正在尝试使用uicomponent表单为我的自定义表单放置类别输入。 我可以创建下拉菜单,但是如何创建按钮并从中打开新的模式呢? 我可以使用uicomponent 创建按钮并从中打开模式吗?我想有一个按钮代替的新类别我想补充选择产品按钮并希望添加节目列表从产品选择在网格类别。 这是用于创建类别输入的xml <field name="parent"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">Magento\Catalog\Ui\Component\Product\Form\Categories\Options</item> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Parent Category</item> <item name="componentType" xsi:type="string">field</item> <item name="formElement" xsi:type="string">select</item> <item name="component" xsi:type="string">Magento_Catalog/js/components/new-category</item> <item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item> <item name="dataScope" xsi:type="string">data.parent</item> <item name="filterOptions" xsi:type="boolean">true</item> <item name="showCheckbox" xsi:type="boolean">false</item> <item name="disableLabel" xsi:type="boolean">true</item> <item name="multiple" xsi:type="boolean">false</item> <item name="levelsVisibility" …


2
请更正XML数据,然后重试。元素“ referenceBlock”:不应使用此元素
请更正XML数据,然后重试。元素'referenceBlock':不应使用此元素。预期是(referenceContainer,container,update,move)之一。行数:1 尝试通过设计 -> 布局更新XML删除页面标题时遇到此错误 这是我用来删除代码块的代码: <referenceBlock name="page.main.title" remove="true"/> referenceContainer工作正常,但仅与referenceBlock有关
13 magento2 

1
Magento2 Rest API订单流程
我正在对magento网站进行REST API调用以下订单。以下是我的通话顺序。 创建购物车 rest/V1/guest-carts/ 取得购物车 rest/V1/guest-carts/bae0af147b83f1561f66cc4e3c97916e 将产品添加到购物车 rest/V1/guest-carts/24/items 添加帐单信息,设置付款方式和下订单 rest/V1/guest-carts/24/payment-information 在此序列中,订单的订单状态为“待处理”。我想知道如果涉及任何付款网关(例如PayPal)来处理付款和生成发票,如何通过api捕获付款。 上面的流程中是否缺少用于捕获付款的任何api。

1
是否有充分的理由在两个try AND catch块中放入相同的代码?
在方法中的file:中app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php,render()似乎在try和catch块中正在运行完全相同的代码。根本不处理异常。我很想知道写这样的代码的原因(如果有的话): try { $data = Mage::app()->getLocale() ->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format); } catch (Exception $e) { $data = Mage::app()->getLocale() ->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format); }

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.