$_objectManager->create() creates new instance of the object, no-matter-what
$_objectManager->get() first tries to find shared instance (already created), if it's not found - it just creates new shared instance
If you take a look at class Magento\Framework\ObjectManager\ObjectManager, you'll notice this block:
* Create new object instance
There are few steps are required for this.
Load order by Order Factory
Inject the factory class \Magento\Sales\Model\OrderFactory on __construct class.for getting order.
Then order get by order id
$order = $this->orderFactory->create()->load($orderId);
Get Invoice collection from Order object
Get Invoice collection from Order object using ...
There are not any functional bug resolved in Magento 2.1.5
Only Difference is updates of copyright date in each file.
See Comment from Magento devdocs file,
This release updates the copyright date in every file. It does not
contain any functional changes or security improvements. Isolating
these changes in a single release is intended to simplify ...
You need to rewrite the customer loginPost plugin file as per the below
public function __construct(
$this->_request = $context->getRequest();
$this->_response = $context->getResponse();
Here is the solution...
Create new module
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Module" setup_version="2.1.0">
Okay finally I've resolved this by myself here is the full code of my module...
In frontend suppose we want wysiwyg-editor on a textarea and textarea having id : description
<textarea id="description" name="textarea_name"></textarea>
and use below script to load jquery and wysiwyg tiny_mce and assign to #description
sales_order_place_after is not proper,bcoz of it is not fire every time.
sales_order_place_after naturally fires whenever call place() of Magento\Sales\Model\Order and it's call depend on payment method.
As suggestion, iam suggestion to you use
It will fire both for frontend /admin order
Check deploy mode, If deploy mode is not developer mode then set it.
php bin/magento deploy:mode:set developer
Check .htaccess is in pub/static/ folder or not. If not then please take from fresh magento and add it.
Delete this file pub/static/frontend/<vendor>/<theme>/Magento_Checkout/web/template/cart/totals.html
Deploy static content
rm -rf ...
Here's a simple method that can be used to make any required address field optional.
First create a plugin for Magento\Checkout\Block\Checkout\LayoutProcessor. Define the class as follow:
public function afterProcess(
You have to disable magnifier and full screen in your theme.
change etc/view.xml file of your theme as below
<var name="allowfullscreen">false</var> <!-- Turn on/off fullscreen (true/false) -->
<var name="enabled">false</var> <!-- Turn on/...
Here is your XML code with little correction , this line was entered twice
Once false and once true , see edit code below
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
In Magento2 use Observer checkout_onepage_controller_success_action for triggering event after place order
You can do this by using the Observer in
<observer name="mymodule_controller_success_action" instance="Vendorname\...
You can try to update your plugin code as described below.
Assume you are using a custom module name "Company_MyModule".
Create di.xml under YOUR-MAGENTO-ROOT/app/code/Company/MyModule/etc/
I have experienced this on my local machine, it was when caching was disabled so my first port of call would be to make sure all caches are enabled.
Also make sure you're running in production mode (if it's a production server) as when in developer mode a lot of code is generated on the fly.
You can customize login layout here
Account create layout
Do not edit directly core file. Copy customer_account_login.xml to your theme.
you can do it using override in your module with below way,
You must have to change referencename of your xml,
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:...
If you want to move your custom phtml file after search box, try below code
<block class="Magento\Framework\View\Element\Template" name="test.header" template="Vendor_Module::test.phtml" after="topSearch" />
You have to call below class in __consturct() function in your controller file and get and set value from customer.
public function __construct(
$this->customerRepository = $...
Unfortunately I can't paste the content (it's too extensive anyway) so I can just give a link.
If you read this answer you will hopefully still find it here:
With the information from above ...
public function __construct(
$this->_cart = $cart;
public function getProductData()
$productInfo = $this->_cart->getQuote()->getItemsCollection();
//$productInfo = $this->_cart->getQuote()->getAllItems(); /*****For All items *****/
foreach ($productInfo as $...
You may go to phpmyadmin and in your database check table cron_schedule and see if there is an entry for your reindexing cron job.
If you want to do it manually then connect your ssh to your server. If ssh is enabled then use this command
enter your password and then run this command in terminal
php bin/Magento indexer:reindex
Finally after three days. I got it working. Below is the correct way of overriding it.
* Override cart item block in custom module
public function afterGetItemRenderer(\Magento\Checkout\Block\Cart\AbstractCart $subject, $...
By default there is no option in magento2 for making the city field as dropdown like state and country in the checkout page.
An approach would be to add relations to the directory_country and/or directory_country_region tables to only show cities which belong to the specific country or region selected in the checkout.
you will need to overwrite of the ...
Solved: In regards to the attribute giving the error, I did not select the settings under 'Use in Product Listing' to 'Yes'. After I selected 'Yes' and did complete reindex the widget worked with the two conditions.