Magento 2 get parent categories


Magento 2 get parent categories We can use dependency injection or object manager to get all parent categories. Here in this article we are going to create one example in which we will get all parent categories using object manager.


Magento 2 get parent categories Example

Using object Manager You can get all parent categories simply below-

Magento 2 get parent categories Example:

$categoryId = 5;
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $_objectManager->create('Magento\Catalog\Model\Category')->load($categoryId);
foreach ($category->getParentCategories() as $parent) {
    echo $parent->getId();
}

The above example will return all parent categories.

Magento 2 get category Url


Magento 2 get category Url Path By Id: We can get category url from category object. Here in this tutorial, we are going to explain how you can get category url using category id.


Magento 2 get category Url Path By Id Example

You can get category url using category id simply as below-

Get Cetgory Url Example:

$categoryId = 5;
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $_objectManager->create('Magento\Catalog\Model\Category')->load($categoryId);
$url = $category->getUrl();

Vue.js Get Url Query String

Vue.js Get Url Query String | Get Url Parameters– We can get query string in vue.js using route. Here in this post we are going to explain how you can get Query String from url.

How to get Url Query String Value in Vue.js ?

You can get query string using vue.js route. Here is an example-

Vue.js Get Url Query String | Get Url Parameters Example:

  //suppose current url is something like this 
  "/mypage?q=food"; 
  // you can get value of q simply as below- 
  this.$route.query.q; // this will give food

Thus you can get any query string value from url in vue.js

Vue.js get Current Url


Vue.js get Current Url – It is very simple to get current url in vue.js. We can use window.location.pathname to get the current url in JavaScript.


Vue.js get Current Url | Get Current Route Example

You get the current url/current Route in Vue.Js Simply as below-

Vue.js get Current Url Syntax:

var currentUrl = window.location.pathname;

So you can get current url using the above example without using anything else.

Magento 2 Recurring Payments Extension


Magento 2 Recurring Payments Extension Download – This extension is best suitable for recurring & Subscription, Using this extension we can create subscriptions for our products or services in Magento 2. This extension enables you manage multiple products in single subscription, mass actions and Supports major payment gateway.


Magento 2 Recurring Payments Extension & Subscription Extension Download

Features

Magento 2 Recurring Payments Extension

Here are core features of this module –

  1. Multiple products It supports Multiple products in single subscription.
  2. Trial and initial fees Configured as per product.
  3. Mass Actions Mass Action available for creating subscriptions.
  4. Payment Gateway It supports Stripe, PayPal Express and Authorize.Net payments methods.

Supports

It Supports the following version of Community & enterprise version-

  1. Community: 2.1.0 – 2.1.9
  2. Enterprise: 2.1.0 – 2.1.9

Additional Services

Following services are provided free of cost with this plugin-

  1. 45-Day Money Back
  2. Free Installation
  3. 90 -Day Free Support
  4. Free Lifetime Updates

Download


You can download this extension from the below links-

  • Download For Enterprise Edition:Download
  • Download For Community Edition:Download

Vue.Js Get Current Date time


Vue.Js Get Current Date time We can use native JavaScript Date function to get current date and time in Vue.js. Here in this article we are going to explain how to get current datetime in Vue.Js using native JavaScript Date Function.


Vue.Js Get Current Date time Example

You can get the current date time using native JavaScript date Function simply as below-

Vue.Js Get Current Date time Example:


Try it »

If you run the above example it will produce output something like this-

Get Current Date in YYYY-MM-DD Format

You can get in YYYY-MM-DD format simply as below-

Vue.Js Get Current Date time Example:


Try it »

If you run the above example it will produce output something like this-

Vue.js get currnet date in y-m-d format

Vue.Js toggle Class on click


Vue.Js toggle Class on click – It is very simple to toggle the class in vue.js. Here in this tutorial, we are going to explain how you can toggle class in Vue.js. You can also use our online demo to run and see the output online.


Vue.Js toggle Class on click Example

You can toggle the class in vue.js simply as below-

Vue.Js toggle Class on click Example:




CLick me
Active Class = {{myClass}}

Try it »

In the above example the active class is applied based on click event. You can use the above code on other events as well. If you run the above example it will produce output something like this-

Vue.Js toggle Class on click Example

Vue.JS get Data From JSON


Vue.Js get Data From JSON As We know most of single page apps works with apis and we deal with json data so here in this article we are going to explain how you can get data from JSON file.


Vue.JS get Data From JSON File | Get Data From URL Example

Here we are going to create a simple example which will read data from JSON file using vue.js-

JSON File

Here is simple json file which contains the following data –

Vue.JS get Data From JSON Example:

{"users":[{"id":"1","name":"John","email":"johnk@yopemail.com","phone":"121323232"},{"id":"2","name":"Kelly","email":"kellyk@yopemail.com","phone":"121212122"},{"id":"3","name":"Ryan","email":"ryank@yopemail.com","phone":"22222212"},{"id":"4","name":"Kojo","email":"kojao@yopemail.com","phone":"12144444"},{"id":"5","name":"Kinjal","email":"kinjal@yopemail.com","phone":"22555212"},{"id":"6","name":"Jonny","email":"jonny@yopemail.com","phone":"121334444"},{"id":"7","name":"Barak","email":"barak@yopemail.com","phone":"2444444512"},{"id":"8","name":"Uman","email":"uman@yopemail.com","phone":"12334444"}]}

Read Data From JSON file in Vue.js

Now let us understand how to read this json object file which contains list of users data.

Read Data List From JSON Url Example:





Id : {{ udata.id }} Name: {{ udata.name }}

Try it »

If You run the above demo it will produce output something like this-

Vue.JS get Data From JSON Example & Demo

Vue.js change {{ }} tags


Vue.js change {{ }} tags– You can change {{}} tags by changing the configuration delimeter.


Vue.js change {{ }} tags Configuration Example

You can change {{}} in vue.js by modifying thr delimeter property of configuration Object.

Vue.js change {{ }} tags Example:

new Vue({
    el: '#app',
    data: data,
    delimiters: ["<%","%>"]
});