Magento

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

2
如何使用Magento 2以编程方式在core_config_data中设置值?
我知道您可以使用以下命令在Magento 1中设置配置数据: Mage::getModel('core/config')->saveConfig('my/path/whatever', $value); 您可以使用以下命令在Magento 2中获取配置数据: protected $_scopeConfig public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) { $this->_scopeConfig = $scopeConfig; } + $this->_scopeConfig->getValue( 'path/of/config', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); 但我不知道如何在Magento 2中保存配置数据


3
Magento 2:将下订单按钮从付款移动到结帐页面上的侧边栏?
我想将下订单按钮从付款移动到结帐页面的侧边栏中。 有人可以给我一个建议吗? 编辑:这甚至可能(提供答案/方法)吗? 根据我的研究,每种付款方式都有自己的.html模板,其中包括自己的按钮。该按钮不是从kickout.js模板加载的。例如,“免费”付款方式的一部分: <div class="checkout-agreements-block"> <!-- ko foreach: $parent.getRegion('before-place-order') --> <!-- ko template: getTemplate() --><!-- /ko --> <!--/ko--> </div> <div class="actions-toolbar"> <div class="primary"> <button class="action primary checkout" type="submit" data-bind=" click: placeOrder, attr: {title: $t('Place Order')}, css: {disabled: !isPlaceOrderActionAllowed()} "> <span data-bind="i18n: 'Place Order'"></span> </button> </div> </div> 虽然“支票/汇票”付款方式如下所示(只有差异,enable: (getCode() == …

3
Magento2-如何阻止以编程方式将产品添加到购物车?
我想做的是,如果在引号中设置了我的自定义属性,那么我不想在购物车中添加任何产品。我的自定义属性已正确设置。 为了阻止产品添加到购物车,我编写了一个观察该事件的观察者 controller_action_predispatch_checkout_cart_add 我的观察者文件代码: public function execute(\Magento\Framework\Event\Observer $observer) { $addedItemId = $observer->getRequest()->getParam('product'); $quote = $this->_cart->getQuote(); if(!empty($quote)) { $customAttribute = $quote->getData('custom_attribute'); if(!empty($customAttribute)) { $controller = $observer->getControllerAction(); $storeId = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId(); $product = $this->_productRepository->getById($addedItemId, false, $storeId); $observer->getRequest()->setParam('product', null); $this->_messageManager->addError(__('This product cannot be added to your cart.')); echo false; $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true); $this->redirect->redirect($controller->getResponse(), 'checkout/cart/index'); …

7
如何在Magento 2中翻译JS错误消息或文本?
我有两个视图,英语和阿拉伯语默认js验证错误消息需要翻译成阿拉伯语,所以怎么办?另外,我还提供了一些有关如何执行此操作的自定义文字。 我创建了一个阿拉伯语的i18n,如果我在PHTML或PHP文件中执行回显,则工作正常,同样在Magento 2中如何将其桥接到js中 有人帮我


1
Magento 2自定义主题布局XML和CSS不起作用
我创建了一个新主题,它运行良好,但是几天后,我意识到有些事情不起作用。 default_head_blocks.xml不再提取我包含的任何CSS文件(托管的和外部的) default.xml不会覆盖父项。 我不确定是什么原因造成的。我什至尝试删除/ var /文件夹以及/ pub / static / frontend /
13 layout  theme  css 

8
Magento 2.1如何创建表单组件字段自定义依赖于另一个字段值?
我有一个字段选择,其中有一些选项。其中一个将有一些字段取决于值,另一个字段将被隐藏。我已经为我的领域复制并扩展了组件js,但是没有用,或者我做错了方法。ui组件支持此功能吗?我该如何实现? 以下是我所做的: <field name="field1"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">Namespace\ModuleName\Model\Config\Source\Options</item> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Field name</item> <item name="visible" xsi:type="boolean">true</item> <item name="dataType" xsi:type="string">number</item> <item name="formElement" xsi:type="string">select</item> <item name="source" xsi:type="string">item</item> <item name="dataScope" xsi:type="string">field1</item> <item name="component" xsi:type="string">Pathto/js/form/element/options</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item> </item> </argument> </field> <field name="field2Depend1"></field> <field name="field3Depend1"></field> …




1
SUPEE-9767 V2可能的问题和已解决的问题
Magento的只是版本更新的版本SUPEE-9767和Magento - CE 1.9.3.4。 所以我的问题是解决了哪些错误,如果我们已经申请过V2,我们是否需要重新V2申请v1。 以及的新变化是CE 1.9.3.4,它是仅用新的安全补丁修复还是更多? 以及此v2版本之后仍存在哪些错误。

2
Magento 2获取所有没有产品ID的产品属性
我想检索所有可用的产品属性,然后将其转换为“我的选择选项”字段的名称和值。在Magento 1中,我可以这样实现: public function getMagentoAttributes() { $values[] = array( 'value' => '', 'label' => 'Pick Product Attribute' ); $categories = Mage::getResourceModel('catalog/product_attribute_collection')->getItems(); foreach ($categories as $category) { if ($category->getFrontendLabel() != '') { $label = $category->getFrontendLabel(); } else { $label = $category->getAttributecode(); } $values[] = array( 'value' => $category->getAttributecode(), 'label' => $label …

5
Magento 2.2.0无效的文档元素“资源”:属性“标题”为必填项,但缺少
我正在尝试将网站从Magento 2.1.8 升级到2.2.0 我已经为2.2.0配置了composer,并且还通过命令行对其进行了更新。 现在,当我magento setup:upgrade在运行模式中停止运行并显示以下注释时:pfa了解更多信息。 正在重复执行模式...无效的文档元素“资源”:属性“标题”是必需的,但缺少。行:12 元素“资源”:属性“标题”是必需的,但缺少。行:13

3
magento 2:'i18n:collect-phrases'命令创建不同的csv文件
php bin\magento i18n:collect-phrases -o "C:\xampp\htdocs\magento\app\design\i18n\xx_YY.csv" -m 收集magento应用程序中的所有短语,并输出包含4列的csv文件: php bin\magento i18n:collect-phrases -o "C:\xampp\htdocs\magento\app\design\i18n\xx_YY2.csv" C:\xampp\htdocs\magento\app\design\frontend 收集app \ design \ frontend中的所有短语,并输出包含两列的csv文件: 这两个文件有什么区别? 另外,我目前正在使用来自https://github.com/splendidinternet/Magento2_German_LocalePack_de_DE的 de_DE.csv (我认为)可以转换整个magento应用程序。为什么此文件有2列而不是4列(例如我创建的xx_YY.csv)? 另外,当我安装一个新主题时,是否可以将该主题的所有短语收集到一个csv文件(2列)中->然后将其内容粘贴并粘贴到文件末尾,de_DE.csv然后一切正常?

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.