for example
Author: Radhika R
Read a file in node js
The fs.readFile() method is an inbuilt method which is used to read the file. This method read the entire file into buffer. To load the fs module we use require() method. For example: var fs = require(‘fs’); Syntax: fs.readFile( filename, encoding, callback_function ) Parameters: The method accept three parameters as mentioned above and described below:… Continue reading Read a file in node js
API to fetch a file from a server in node Js
curl –location –request POST ‘http://localhost:3100/request/csvfile’ \–header ‘Content-Type: text/plain’ \–data-raw ‘product_1632761261.csv’
Create a tab Notification Centre with messages list inside it in customer record
Solution First create a subtab Notification Center in the customer record Navigate customization->Forms->subtab Entity->Notification Centre Then created a custom record for notification with a field message,message subject and date and set its parent as the customer. Navigate customization->list,record and field ->Record Type Notification Navigate to the notification tab in the customer record where we… Continue reading Create a tab Notification Centre with messages list inside it in customer record
How to place a div on the bottom left of another div
Make its parent div as ‘position: relative’, and the div you want to place on the bottom left as ‘position: absolute, bottom: 0, left: 0’ HTML CSS . parent {position: relative;}. child {position: absolute;bottom: 0;left: 0;}
Items are not showing on the web store.
1 Display in Website should be checked 2 Item record must have online/base price set 3 If Show Uncategorized Items is not checked (Commerce > Websites > Website List > under Setup tab), make sure the item record has an assigned site category under Web Store tab > Web Site Categories subtab. Please take note: If an account has multi-site set up, an item assigned to at… Continue reading Items are not showing on the web store.
Address book /Registration Page require Company name field
When My account Address book/Registration page need Company name field in the formGoto website record->shopping sub tabUnder Registration page section there is a checkbox DISPLAY COMPANY FIELD ON REGISTRATION PAGETick this optionYou will get company name option in both registration page and Address Book.
Issue: No delivery methods available for this address
Checkout page when we get this warning SolutionThe Default Shipping Method can be set at Commerce > Websites > Website List > Edit Website > Shopping tab. If shipping items are not showing on the dropdown field on the Set Up Web Site page, these shipping items are not set to be displayed on the… Continue reading Issue: No delivery methods available for this address
How to run Cron Jobs in Node.js
These are the tasks that run periodically by the operating system. Users can schedule commands the OS will run these commands automatically according to the given time. We will use a package called node-cron which is a task scheduler in pure JavaScript for node.js. We are also using express as a server. Install the required… Continue reading How to run Cron Jobs in Node.js
How to send email using nodemailer and nodejs
Nodemailer is the Node.js npm module that allows you to send email easily. Install nodemailer npm install nodemailer Include the nodemailer module in the code using require(‘nodemailer’). Use nodemailer.createTransport() function to create a transporter who will send mail. It contains the service name and authentication details (user ans password). Declare a variable mailDetails that contains… Continue reading How to send email using nodemailer and nodejs