Magento2
Power your online business with the most flexible and scalable ecommerce platform
Quick Query to the see all products that do not have images in magento2
use this query to see all products that do not have images in magento2
SELECT sku FROM `catalog_product_entity` WHERE `entity_id` not in (SELECT `entity_id` FROM `catalog_product_entity_media_gallery_value` )
ignoring the "Not Visible Individually" products
add phtml file to Static Block or CMS Page Magenot2
you have to add this code to the block or to the page
{{block class="Magento\Framework\View\Element\Template" template="{Vendor}_{Module}::pages/example.phtml"}}
Example
{{block class="Magento\Catalog\Block\Product\ListProduct" category_id="50" name="home.products.list.custom" template="Magento_Catalog::product/list.phtml"}}
Link Category by ID
{{widget type="Magento\Catalog\Block\Category\Widget\Link" anchor_text="MY Custom category" title="Custom Category" template="category/widget/link/link_block.phtml" id_path="category/12"}}
there are three templates
How to enable Magento 2 profiler?
Magento profiler can help you with the store performance tuning before the store release or during the exploitation.
The old UI for enabling/disabling the profiler is not available in Magento 2 and the profiler is disabled by default.
To enable one of the profiler formats mentioned above, you can edit .htaccess (a configuration file for Apache Web Server software):
Choose one of the next expressions:
Magento2 Change Maintenance Page content
Most of us wanted or liked to change the Maintenance Page content, but it had difficulties doing that, now we will show you how easy is that can be
Some important command in Magento2 after you change the mode to production
From the Magento root directory, switch to production mode:
bin/magento deploy:mode:set production
Enable JavaScript bundling:
bin/magento config:set dev/js/enable_js_bundling 1
Optimize bundling by minifying JavaScript files:
bin/magento config:set dev/js/minify_files 1
Enable cache busting on static file URLs. This ensures users get the latest version of the assets anytime they update:
How to enable or disable the static content signing?
in case we want to change this configuration
«Stores» → «Configuration» 3 → «Advanced» → «Developer» → «Static Files Settings» → «Sign Static Files»
we can execute this query
disable
Make the Tax ID mandatory in the checkout page
The easiest way to make the tax/vat id mandatory in the checkout page is to change the is_required in the eav_attribute table
you can use this Query to change the value from 0 => 1
UPDATE `eav_attribute` SET `is_required` = '1' WHERE `eav_attribute`.`attribute_code` = 'vat_id';
or you can use this code when you want to use a custom extesnion
$installer->updateAttribute('customer_address', 'vat_id', 'is_required', true);
Magento2 Form Validation
in this wiki we will provide a simple form with Validation that we can use in Magento2, hope this will be helpful for all readers
you can use the below code in phtml file
Magento 2 REST API - Add Order Comment
To add a new comment to existing order and change the order status you can use this endpoint
/rest/V1/orders/{order_id}/comments
and the json data is
{ "statusHistory": { "comment": "Your Comment Here", "created_at": "2018-06-05 15:22:04", "parent_id": {order_id}, "is_customer_notified": 0, "is_visible_on_front": 1, "status": "pending" } }