Magento

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


6
如何解密加密的配置值?
protected $_paymentData; protected $_scopeConfig; protected $logger; public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Payment\Model\Method\Logger $logger, \Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Directory\Model\CountryFactory $countryFactory, \Stripe\Stripe $stripe, \Inchoo\Stripe\Model\StripeFactory $stripeFactory, array $data = array() ) { parent::__construct( $context, $registry, $extensionFactory, $customAttributeFactory, $paymentData, $scopeConfig, $logger, $moduleList, $localeDate, null, …

2
如何在Magento 2中设置配置值?
以前(即在Magento 1中),我们创建了一个名为Setup的模块,其中包含站点的设置。升级脚本如下所示: $installer = $this; $installer->startSetup(); $installer->setConfigData("fastsimpleimport/general/partial_indexing", 1); $installer->setConfigData("fastsimpleimport/product/disable_preprocess_images", 1); $installer->setConfigData('general/country/default', 'GB'); $installer->setConfigData('general/locale/firstday', 1); $installer->setConfigData('general/locale/timezone', 'Europe/London'); $installer->setConfigData('general/store_information/merchant_country', 'GB'); $installer->setConfigData('design/header/welcome', 'Enter your value'); $installer->setConfigData('design/head/title_suffix', 'Enter your value'); $installer->setConfigData('currency/options/base', 'GBP'); $installer->setConfigData('currency/options/default', 'GBP'); // ... 我不知道如何在M2中执行上述操作。 换句话说:我该如何在M2中设置配置数据?

2
如何在Magento 2中使用Knockout JS
我的问题: 我试图在Magento 2中编写一个小型的Knockout JS应用,但我正在努力初始化该应用,因为当我使用ko.applyBindings(AppViewModel, document.getElementById("koTest"));它破坏了Magento 使用的Knockout并引发此错误时: Uncaught Error: You cannot apply bindings multiple times to the same element. 我怀疑是因为: 我怀疑这是因为Magento的2已经在使用ko.applyBindings()中app/code/Magento/Ui/view/base/web/js/lib/knockout/bootstrap.js。而且由于未指定节点,因此无法ko.applyBindings再次使用。 如果我不在ko.applyBindings(AppViewModel, document.getElementById("koTest"))代码中使用,那么我的应用程序不会初始化。 这使我认为我需要以某种方式使用ko.applyBindings()基因敲除/bootstrap.js,但我不知道该如何使用,有人可以帮忙吗?我对淘汰赛的经验很少。 我的密码 <script type="text/javascript"> require([ 'ko' ], function(ko) { // This is a simple *viewmodel* - JavaScript that defines the data and behavior of your UI function AppViewModel() …



2
如何解决“暂停”的索引器状态(积压中的n)
被配置为按计划更新的索引器之一被锁定为“已暂停”状态,并且不再获取更新。 输出 bin/magento indexer:status +----------------------------+------------------+-----------+-------------------------------+---------------------+ | Title | Status | Update On | Schedule Status | Schedule Updated | +----------------------------+------------------+-----------+-------------------------------+---------------------+ | ... | | | | | | IntegerNet_Solr | Reindex required | Schedule | suspended (101028 in backlog) | 2018-09-24 15:28:44 | | ... | | | | | …

4
Magento 2.2通常非常慢,设置后处理器使用率达到100%:升级
我当前Magento 2.2, php7, Apache2在Amazon AWS EC2 c4.large实例上运行,但是当我将t2.micro实例用作开发服务器时,通常也可以。 出于某种原因,在运行自定义模块之一中的安装文件之一或安装第三方模块后,偶尔运行setup:upgrade时,我的服务器将变得非常慢,每次尝试时都保持100%cpu的使用率要加载页面,页面加载需要1分钟以上的时间,并且在不加载页面时将保持25%的CPU使用率。它只影响我称为setup:upgrade的magento网站,同一服务器上安装的其他magento上的页面仍将以正常速度加载。 有时可以通过以下方法解决问题:卸下刚刚升级的模块,重新启动服务器,然后重新安装模块,而无需对代码进行任何更改,有时进行第二次设置:upgrade可以解决问题,有时看来,我可以解决的唯一方法是通过完全重新安装Magento 2和模块。 我曾在Magento 2.1.6, 2.1.8, 2.1.9和上发生过这种情况2.2,主题和模块的各种不同组合在默认情况下似乎都不存在开发人员和生产模式的任何问题。 编辑:重要说明 如果您遇到此问题,并且像我一样肯定您从未禁用过缓存,那么从现在开始(Magento 2.3),一个公认的问题是composer update偶尔运行会禁用所有缓存。因此,即使您认为已启用缓存,也值得仔细检查。



1
@ media-common-我们为什么需要使用它?
在Magento 2 lib文档中,它包含以下内容: @ media-common:true | false-设置是否输出通用样式。对于常用样式,每次您要添加一些样式时都应使用 & when (@media-common = true) { your styles } 题 使用此代码和只写Less而没有它有什么区别?如: & when (@media-common = true) { body { background: blue; } } 如何将其编译为: body { background: blue; } 它将不会以styles-l.css和styles-m.css输出吗?

11
致命错误:无法实例化接口
我的magento商店抛出此错误: 致命错误:无法在第73行上的/Library/WebServer/Documents/magento/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php中实例化接口Magento \ Framework \ View \ Design \ Theme \ ResolverInterface 我不知道为什么它开始出现。我没有安装新模块。这家商店运作良好。 我已经检查了文件权限,但没有发现任何问题。还删除/ var /目录,以及我创建的所有文件夹/文件。 [编辑]首选项已定义为vendor / magento / magento2-base / app / etc / di.xml <preference for="Magento\Framework\View\Design\Theme\ResolverInterface" type="Magento\Theme\Model\Theme\Resolver" />
12 magento2  design 

1
Magento2插件在方法$ proceed上的可调用参数和闭包参数之间的方法不同
我检查了magento2,有两种类型的参数可以发送到 周围方法 \Closure $proceed 例 aroundSave(\Magento\Catalog\Model\Product $subject, \callable $proceed) \callable $proceed 例 aroundSave(\Magento\Catalog\Model\Product $subject, \Closure $proceed) 现在我的问题是: 关闭和可调用之间有什么区别? 为什么要使用$ proceed参数定义两个不同类型的类型? 这两种类型的参数有什么用? 任何可以描述它的细节吗

2
如何获得产品类型?
我正在Magento 2中创建一个新模块。我尝试在phtml文件中获取产品信息。我已经成功获取了entity_id和产品名称信息。但是当我得到产品类型信息时,就出错了。使用以下代码。 $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); //get current product echo $product->getId() . '<br/>'; echo $product->getName() . '<br/>'; echo $product->getProductType() . '<br/>'; //getting wrong product type
12 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.