25

You need to reset all column first, then select specific column. Try following way: $collection->getSelect() ->reset(\Zend_Db_Select::COLUMNS) ->columns(['id']);


13

$_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 * * @...


9

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 checkout_submit_all_after It will fire both for frontend /admin order


8

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 ...


8

You need to rewrite the customer loginPost plugin file as per the below <?php namespace VENDOR\MYMODULENAME\Plugin\Customer; class LoginPost { public function __construct( \Magento\Framework\App\Action\Context $context ) { $this->_request = $context->getRequest(); $this->_response = $context->getResponse(); ...


7

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 ...


7

Okay finally I've resolved this by myself here is the full code of my module... registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Vendor_Module', __DIR__ ); etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...


6

you can do it using override in your module with below way, You must have to change referencename of your xml, First create app/code/Custom/Addprofile/view/frontend/layout/checkout_cart_index.xml, <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:...


6

Here is the solution... Create new module Vendor/Module/etc/module.xml <?xml version="1.0"?> <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"> <sequence> <module ...


6

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 require([ 'jquery', 'mage/adminhtml/wysiwyg/tiny_mce/setup' ], function(jQuery){ ...


6

In Magento2 use Observer checkout_onepage_controller_success_action for triggering event after place order You can do this by using the Observer in app\code\Vendorname\Modulename\etc\frontend\events.xml <event name="checkout_onepage_controller_success_action"> <observer name="mymodule_controller_success_action" instance="Vendorname\...


5

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 ...


5

You can customize login layout here vendor/magento/module-customer/view/frontend/layout/customer_account_login.xml Account create layout vendor/magento/module-customer/view/frontend/layout/customer_account_create.xml Do not edit directly core file. Copy customer_account_login.xml to your theme. Final customer_account_login.xml: <?xml version="1....


5

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: <?php namespace Vendor\Module\Plugin; class LayoutProcessor { public function afterProcess( \Magento\Checkout\Block\Checkout\LayoutProcessor $subject, ...


5

You have to disable magnifier and full screen in your theme. change etc/view.xml file of your theme as below <var name="gallery"> <var name="allowfullscreen">false</var> <!-- Turn on/off fullscreen (true/false) --> ... </var> <var name="magnifier"> <var name="enabled">false</var> <!-- Turn on/...


5

Here is your XML code with little correction , this line was entered twice <var name="allowfullscreen">false</var> 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"> <media> <images ...


5

You can try to update your plugin code as described below. Assume you are using a custom module name "Company_MyModule". STEPP 1) Create di.xml under YOUR-MAGENTO-ROOT/app/code/Company/MyModule/etc/ File: YOUR-MAGENTO-ROOT/app/code/Company/MyModule/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...


4

Hello Himmat log in admin then go to store->configuartion->Advanced->Developer->Static File Setting and Sign Static Files set values to no


4

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.


4

You can also Try : $collection = $this->_collectionFactory->create()->addFieldToSelect('id')->addFieldToFilter('status', 0)->load();


4

As of Magento 2.1.x they have moved themes into content=>design


4

Finally after three days. I got it working. Below is the correct way of overriding it. app\code\Vendor\Module\Block\Cart\AbstractCart.php <?php /** * Override cart item block in custom module */ namespace Vendor\Custom\Block\Cart; class AbstractCart { public function afterGetItemRenderer(\Magento\Checkout\Block\Cart\AbstractCart $subject, $...


4

If you want to move your custom phtml file after search box, try below code <referenceContainer name="header-wrapper"> <block class="Magento\Framework\View\Element\Template" name="test.header" template="Vendor_Module::test.phtml" after="topSearch" /> </referenceContainer>


3

You can use this event sales_order_place_before to run callback before customer placing order.


3

You have to call below class in __consturct() function in your controller file and get and set value from customer. <?php public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository ) { $this->customerRepository = $...


3

In order to stop create an invoice when customer done Payment with Paypal. Then need to rewrite class the model class Magento\Paypal\Model\Ipn and stop create invoice at function _registerPaymentCapture di.xml at app/code/[Vendor]/[Modulename]/etc/ <?xml version="1.0" encoding="utf-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...


3

Try this public function __construct( \Magento\Checkout\Model\Cart $cart ) { $this->_cart = $cart; } public function getProductData() { $productInfo = $this->_cart->getQuote()->getItemsCollection(); //$productInfo = $this->_cart->getQuote()->getAllItems(); /*****For All items *****/ foreach ($productInfo as $...


3

Unfortunately I can't paste the content (it's too extensive anyway) so I can just give a link. I found Alan Storm has written a series where he explains the Javascript concepts of Magento 2. If you read this answer you will hopefully still find it here: http://alanstorm.com/category/magento-2/#magento2-advanced-javascript With the information from above ...


3

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 ssh username@host enter your password and then run this command in terminal php bin/Magento indexer:reindex this ...


3

Try this one <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="checkout_submit_before"> <observer name="unique_identifier" instance="ModuleName\ClassObserver" /> </event> </config>


Only top voted, non community-wiki answers of a minimum length are eligible