Posts

Magento 2 404 error for scripts and css

 Magento 2 404 error for scripts and css 1)  Please check mistakenly not deleted .htaccess file at pub/static path. 2) When Magento is not running on production mode , it will create symlinks for some static resource. So what to do is delete pub/static/frontend and pub/static/adminhtml   Alert : Do not delete .htaccess under pub/static/ folder.  3) Changing the behavior. Open up app/etc/di.xml and find the virtualType name="developerMaterialization" section. In that section one may find code item name="view_preprocessed" that needs to be modified or deleted. You can modify it by changing the contents from  Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink   to  Magento\Framework\App\View\Asset\MaterializationStrategy\Copy This should  have solve your problem with the symlink creation. If like efforts, Please share, comment and subscribe for future posts and inspire more.

How to use Zend log Magento 2

 To use Zend log use below code in any PHP file. $yourmessageString = 'Hey from magento zend log'; $yourmessageArray = ['Hey from magento zend log Array ']; $writer = new \Zend\Log\Writer\Stream(BP . ‘/var/log/custom.log’); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $logger->info($yourmessageString); $logger->info(print_r($yourmessageArray,true)); //for array and objects

Knock out js Short hands

 Knock out JS short hand properties. You can use  1.  this.knockoutProperty /= value;  instead  this.knockoutProperty(this.knockoutProperty() / value) 2.   this.knockoutProperty *= value;  instead  this.knockoutProperty(this.knockoutProperty() * value) 3. this.knockoutProperty -= value;  instead  this.knockoutProperty(this.knockoutProperty() - value) 4.  this.knockoutProperty += value;  instead  this.knockoutProperty(this.knockoutProperty() + value) Please like , share and subscribe.

How to add product attribute value in minicart magento 2

How to add product attribute value in minicart magento 2? First need to do is create a plugin so add plugin at di.xml at first. di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nonamespaceschemalocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Checkout\CustomerData\DefaultItem"> <plugin disabled="false" name="AddAttPlug" sortorder="10" type="Your\Module\Plugin\DefaultItem"> </plugin></type> </config> Now create a plugin class and below line of code.   Default.php <?php namespace Your\Module\Plugin; use Magento\Quote\Model\Quote\Item; class DefaultItem { public function aroundGetItemData($subject, \Closure $proceed, Item $item) { $data = $proceed($item); $product = $item->getProduct(); $atts = [ "product_weight" => $product->ge...

How to create a order from quote?

How to create a order from quote in magento 2? Find full answer below. We will load one product than we will create a quote for it and than we will convert that quote into an order. <?php use Magento\Framework\App\Action\Action; class OrderCreateTest extends Action {     protected $_quoteFactory;     protected $_orderModel;     protected $_productModel;     protected $_customerRepository;     protected $_quoteManagementModel;          public function __construct(\Magento\Quote\Model\QuoteFactory $quoteFactory, \Magento\Sales\Model\Order $orderModel, \Magento\Catalog\Model\Product $productModel, \Magento\Framework\App\Action\Context $context, \Magento\Quote\Model\QuoteManagement $quoteManagementModel, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository)     {         $this->_quoteFactory         = $...

Understand Magento type node and how to use for own benefits.

Hey folks, Today we will going to learn fundamental of < type /> node which used in di.xml. So let's start without time waste let's talk about <type />  node. To understand this concept we will use an example for that we will create sample module. So let's do this together.  If you already know how to create a module you can skip this intro. To create a module there is two files are required. registration.php module.xml So let's create a registration.php path :  app/code/Extrembler/Base \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Extrembler_Base', __DIR__ ); Second we need to create module.xml path : app/code/Extrembler/Base/etc <?xml version="1.0"?> <!-- /** * @category Extrembler * @package Extrembler_Base * @author Extrembler <gaurangpadhiyar1993@gmail.com> */ --> <config xmlns:xsi="http://www...

Magento Currency Symbol

Image
Magento Currency Symbol Do want to change look of currency or fronted display symbol or do not want a symbol at all? If yes, you landed at correct place to while searching for a solutions. We are bringing a extension solution for you guys so without help of developer you can change look of currency symbol. Extension which we have developed. Currency Symbol - By Extrembler Features Easily enable/disable functionality Simply set currency symbol from pre-defined options Multi-store compatibility Enable/disable module store wise Change behaviours of currency symbol store wise Remove Currency Symbol using option no symbol Comes With Free Lifetime Updates 100% Open Source Multi-Store Supported Support If you have any questions about this extension, you can  Contact Us . If like efforts, Please share, comment and subscribe for future posts and inspire more.