Scenario User would like to get the current date in a different time zone using JavaScript. Solution In the following code snippet, currDate variable holds the current date and time in the given time zone: var toTimeZone=”+5:30″;var tz;if(toTimeZone.search(“:”)==-1){tz=parseFloat(toTimeZone);}else{tz=parseFloat(toTimeZone.slice(0,toTimeZone.search(“:”)))+parseFloat(toTimeZone.slice(toTimeZone.search(“:”)+1)/60)}var date = new Date();var utc = date.getTime() + (date.getTimezoneOffset() * 60000);var currDate = new Date(utc + (3600000*tz));currDate = currDate.toString();var currDate… Continue reading Convert Date() to a Different Time Zone Using JavaScript
Month: December 2022
How to create Customer Deposit from Sales Order using script
Creating customer Deposit automatically whenever a sales order is created. Note: If we create a sales order in currency other than the primary currency of the customer, by default the script will take the primary currency of the customer as the currency in customer deposit. This will throw an error while running the script. That… Continue reading How to create Customer Deposit from Sales Order using script
Add a New Module to the Checkout with the Extensibility API
Understanding the Checkout Wizard If you want to make changes to your checkout, it’s good to try and figure out if it can be achieved through configuration (including the web site setup tool) and theming, as these will be the easiest and safest ways to make changes. The Wizard In SC the majority of the… Continue reading Add a New Module to the Checkout with the Extensibility API
CSS Layout – Horizontal & Vertical Align
Center Align Elements To horizontally center a block element (like <div>), use margin: auto; Setting the width of the element will prevent it from stretching out to the edges of its container. The element will then take up the specified width, and the remaining space will be split equally between the two margins: Center Align Text… Continue reading CSS Layout – Horizontal & Vertical Align
Accounting Period close and Quick close feature
Permissions related to Accounting Period management Prior to accessing accounting period management, relevant permissions need to be assigned to the Roles. Edit or Full level of the Manage Accounting Periods permission is required to set up, edit, lock transactions for the period close, or reopen accounting periods. Users with the View level of this permission can see the Manage Accounting Periods page… Continue reading Accounting Period close and Quick close feature
TO ADD SURCHARGE FOR EVERY INVOICES CREATED
Here we want to add a surcharge of 1% to every invoice created. SOLUTION It can be done by creating a markup item and add ‘subtotal’ and ‘markup’ item created to every invoice using a workflow. List>Accounting>Item>New Select Markup item Give item name and in the rate field add 1% add a tax schedule for… Continue reading TO ADD SURCHARGE FOR EVERY INVOICES CREATED
List and Grid view using JQuery
We use all the HTML code for List and grid view Button. Styling List and Grid view buttons by using the body tag selector. Now the styling of List and Grid buttons can be done by using the class selector. When the user press the buttons, the List or grid view will reveal itself. Now… Continue reading List and Grid view using JQuery
How to resolve the SyntaxError: “use strict” occured in Java Script
The JavaScript exception “’use strict’ not allowed in function” occurs when a “use strict” directive is used at the top of a function with default parameters, rest parameters, or destructing parameters. Error: SyntaxError: Illegal ‘use strict’ directive in function with non-simple parameter list (V8-based) SyntaxError: “use strict” not allowed in function with default parameter (Firefox) SyntaxError: “use strict” not… Continue reading How to resolve the SyntaxError: “use strict” occured in Java Script
Entry should not be allowed in “Parent Account”
Requirement: The transaction entries should be posted only in the child account, not the parent account. Solution: Step 1: Go to Setup -> Accounting -> Chart of Account -> Edit the chart of account record. Step 2: Check the Summary field on the account record. Step 3: Click Save.
Get product details by product id in Magento 2
create a block and write the following code on it,