magento2

Magento 2 static cache

被刻印的时光 ゝ 提交于 2019-12-12 02:37:05
问题 When I would change something in template, I need flush static cache(pub/static) because I didn't saw any changes in front end, but after that this folders has some empty folder and in front end I have some error ReferenceError: require is not defined and I need use this command c:\xampp\php\php.exe -f d:\projects\localsites\magento2.local\magento\bin\magento -- setup:static-content:deploy to generate static content. Maybe I do something wrong? 回答1: When you developing something for magento2

INVALID_REQUEST: Field [order.avsDetails.billToFirstname] was not in charset [ISO-8859-1]

可紊 提交于 2019-12-12 02:25:04
问题 For some Reasons when I use OnTap MasterCard Extension , Any Arabic characters in shippment addresses throws an error: INVALID_REQUEST: Field [order.avsDetails.billToFirstname] was not in charset [ISO-8859-1] The extension link : https://marketplace.magento.com/ontap-module-mastercard.html Please help. 回答1: You can try encoding the data generated in the Builders (inside the Gateway/Request folder) by using plugins. You can read more how to create plugins here that perform the encoding on all

How to override CSS file in custom theme in magento 2

China☆狼群 提交于 2019-12-12 01:27:51
问题 In Magento 2, I have create new theme. I tried to add less file app/design/frontend/mage_vender/sample(theme)/web/css/source‌​/_extend.less. But it is not showing changes. Please can anyone tell me, how can we do ? I am using magento 2.1.3 Thank you 回答1: The first thing you need to do is to create your theme, don't forget to add all the required files like the theme.xml and registration.php . Last time I checked the magento 2 documentation it was up to date and had enough information

Show custom text field on category list page

喜夏-厌秋 提交于 2019-12-11 19:35:57
问题 I've added a custom module for adding an extra description to category pages. It's showing in Admin but I can't get it to show on category frontend pages. I'm probably not understanding the childtheme inheritance structure. I've read and tried every article here but none of them provide the exact information I need. Luma Childtheme is active: app>design>frontend>MyCompany>Luma_child Custom module: app>code>MyCompany>CategoryAttribute I've tried adding app/code/MyCompany/CategoryAttribute/view

Magento 2 - Get Customer Address Id through Shipping Address at Checkout Session

梦想的初衷 提交于 2019-12-11 17:36:48
问题 I'm having trouble with getting customer address Id as it returns a null value. This is what I have tried: $checkout = $this->_sessionCheckout->getQuote(); if ($checkout) { $shippingAddress = $checkout->getShippingAddress(); if ($shippingAddress) { $addressId = $shippingAddress->getCustomerAddressId(); $this->_logger->log(100, print_r('address Id: ' . $addressId , true)); //Returns null /** @var \Magento\Customer\Api\Data\AddressInterface $address */ $address = $this->_addressRepository-

What is the simplest way to use an external php library in a custom magento 2 module?

纵饮孤独 提交于 2019-12-11 17:32:48
问题 I am new on magento I am currently working on a custom module for magento2 and I want to use an external php library (PHPMailer) within a Block file. my project files structure: ModuleFolder ---etc . . ---Block ------- Main.php ---lib ------- PHPMailer . . I tried to include the PHPMailer class within my block main.php using: require_once(__DIR__."/../lib/PHPMailer/src/PHPMailer.php"); and for the class declaration i used : $mail = new PHPMailer(); also i tried to include the PHPMailer

Magento 2.2.4: “Sorry, no quotes are available for this order at this time”

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 17:02:55
问题 The checkout was working smoothly and I've checked the test orders in admin panel. While during the maintenance I clean up the cache and upgrade the static content. Right after unexpectedly, I am getting message at the time of checkout "Sorry, no quotes are available for this order at this time". I have configured UPS shipping method under configuration. You can also replicate it, by accessing the website at https://awscales.com I have also tried cache clean, re-index but no luck. I am unable

Magento 2 session unsetting itself

雨燕双飞 提交于 2019-12-11 16:14:25
问题 I need to be able to store some custom session variables that exist for the custom, regardless of whether they're signed in or not, but for some reason my sessions keep deleting themselves. I have used this example to help me add my session code in. Here's my code Block file <?php namespace MyVendor\MyModel\Block; use Magento\Framework\View\Element\Template; class ProductSearch extends Template { protected $_customSession; public function __construct( \Magento\Framework\View\Element\Template

Add custom attribute in magento 2

做~自己de王妃 提交于 2019-12-11 15:54:45
问题 How to add a custom field to the frontend registration form. I already added required feilds in database by following public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $eavSetup->addAttribute( \Magento\Customer\Model\Customer::ENTITY, 'sample_attribute', [ 'type' => 'varchar', 'label' => 'Sample Attribute', 'input' => 'text', 'required' => false, 'visible' => true, 'user_defined' => true

Get Fix from Magento repository to my project

為{幸葍}努か 提交于 2019-12-11 15:01:32
问题 I have a question. How can I download the changes in this hotfix: https://github.com/magento/magento2/commit/1e78fe2e37af0012b7f60b29c658221b8ab8467b Version Magento in my project is 2.1.2 and I have a problem with this exception: Configurable product "44583" does not have sub-products So, How can I download only this fix to my repository? 回答1: You can use composer-patch to apply Magento fix. To use it, you can do the following steps: Install composer patch: composer require cweagans/composer