E-commerce Platforms
Magento2 Deploy specific theme with specific locale language
In this wiki, i will show you how to deploy the static content for specific theme and the locale languages
First of all, we know that the Deploy command is
php bin/magento setup:static-content:deploy
Now , if you need to deploy a theme we need to use this command
theme name : {vendor}/{them name}
Command: php bin/magento setup:static-content:deploy --theme {vendor}/{them name}
if you want to deploy many locale you can use this command
locales are : en_US, fr_FR
Log In By Customer ID
Magento1
// for security we should add custom IP $IP = "192.168.0.1"; $customer_id = 1; if($_SERVER['REMOTE_ADDR']==$IP){ Mage::getSingleton ( 'customer/session' )->loginById ( $customer_id ); }
Magento2
Display PHTML file or Static Block in CMS page Magento2
Yo display phtml file in CMS page put this line
{{block class="Magento\Framework\View\Element\Template" name="test_block" template="{Vendor}_{Module}::test_block.phtml"}}
the same way in XML layout file you can use
<block class="Magento\Framework\View\Element\Template" name="test_block" template="{Vendor}_{Module}::test_block.phtml"/>
if you want to put it in phtml file
Send rest password link email to customer programmatically in magento
How to Send rest password link email to customer programmatically in magento?
Usually you need to load the customer first, then call the function on customer logic like this
Get All Orders using REST Magento2
To get the all orders using RESt in Magento2, please follow these steps
1- Get the token using your backend credentail
Add Product to Cart if it is Not Exist magento1
if you want to add product to cart programmatically only if the product is not exist you have to use this code,
in this code you will check if the product is not exist in the Cart Quote, then if it is not exist you will add it