Today we launched OpenCart code snippets VSCode extensions which you can find at https://marketplace.visualstudio.com/items?itemName=webocreationcom.ocsnippets, We published OpenCart code snippets VScode extensions for OpenCart developers. It contains some OpenCart code snippets for PHP and Twigs. Github repository for this https://github.com/rupaknepali/opencartsnippetsvscode.

How to use Opencart code snippets VSCode extensions?

  • Find “Opencart code snippets” extensions to install using the Extensions View.
  • Install an extension.
VScode extensions Install
  • Once you installed the “Opencart Code snippets”, open ***.php or ***.twig or ***.xml
  • Then start typing oc… then you will see a list of Opencart related code snippets available.
  • For example, create a file called install.xml, then start typing oc, it will show ocmod and ocmodf, these are the Opencart code snippets available in the VScode extensions that you installed.
Opencart code snippets
  • Once you finished the word like ocmod then it creates the codes automatically.
Ocmode code generated
  • It highlights the word to be changed, enter the word that you need and click tab, then it will highlights the another words to be change

In this way, you can use the OpenCart Code snippets for rapid development.

Creating and publishing Visual Studio code extensions

Creating and publishing Visual Studio code extensions is easy than I thought just follow https://code.visualstudio.com/api/get-started/your-first-extension and https://code.visualstudio.com/api/working-with-extensions/publishing-extension

vscode opencart

Opencart Snippets for Visual Studio Code

This VSCode extension is for OpenCart developer which has a collection of OpenCart snippets. This is just starting, Please let us know if need to add more Contact Us

Documentation

All snippets start with oc. Some of the snippets are:

PHP page supported snippets:

  • occ: It creates a new Controller class
  • ocm: It creates a new Method or function
  • occm: It creates new starter Model class
  • ocl: It creates new variables for language files
  • ocprf: It creates print_r with pre

Twig page supported snippets:

  • oct: It creates starting template layouts in twig files
  • octfor: It creates for loop in twig files
  • octif: It creates if statement in twig files
  • ocbtn: It creates button markup
  • ocimg: It creates image markup
  • ocbc: It creates breadcrumbs loop in twig files

OCMOD XML page supported snippets:

  • ocmod: It creates OCMOD XML code boilerplate
  • ocmodf: It creates OCMOD XML code boilerplate for files only

Release Notes

Users appreciate release notes as you update your extension.

1.2.0
– OCMOD support added.
– ocmod- for install.xml boilerplate creation
– ocmodf- OCMOD XML file boilerplate
– ocprf- print_r with pre

1.0.0

  • The initial release of Opencart Snippets for vscode
  • Added some snippets. Others are coming soon.

For more information

Please install the extension, try it out and share it with other Opencart developers which may help the development speed. It is free and open-source. Any suggestions, feedback, and other code snippets of Opencart are appreciated.

2 COMMENTS

  1. Hi Rupak,

    awesome extension but facing some issue with the occ command
    after tapping tab it shows something like this

    class ControllerD:\Opencart My modules\abcmodule\2.0\admin\controller\extension\moduleabcmodule extends Controller {
    public function index() {
    ..

    Will you be able to fix this?

LEAVE A REPLY

Please enter your comment!
Please enter your name here