Skip to content

Instantly share code, notes, and snippets.

View matheusgnreis's full-sized avatar

Matheus Reis matheusgnreis

View GitHub Profile

E-Com Plus - Manipulando BRINDE no aplicativo de descontos padrão

1. Busque o ID do aplicativo de descontos instalado na loja:

GET https://api.e-com.plus/v1/applications/app_id:1252.json
  -H "X-Store-ID: <store_id>"

O ID estará na resposta em _id:

@matheusgnreis
matheusgnreis / ECOMPLUS_LIBS.md
Last active April 15, 2024 13:09
Useful variables and libs from E-Com Plus storefront

Libs:

ecomUtils

http://developers.e-com.plus/utils/

If you wanna use on sections inside of ejs, you can reach him with #_.ecomUtils. Or if you just want to use in to pages.js, you can reach him with window.ecomUtils.

You have a lot of rich methods. Like: _.ecomUtils.inStock(product), will return a boolean meaning if has stock or not. Or _.ecomUtils.formatMoney(10.6, 'BRL', 'pt_br') => R$ 10,60

Just see the lib and enjoy.

@matheusgnreis
matheusgnreis / README.md
Last active June 12, 2023 13:28
Creating new configs, sections and folders to your E-Com Plus CMS

Basically, you need to access your GitHub repository and find the file template/public/admin/config.json.

If you only want to insert a section on a single page, you can simply follow this link: https://gist.github.com/matheusgnreis/27b4c5eda995a13f663c824e91cc790c.


However, if you want to combine your new sections with other sections from your website and/or add new collections, you will need to perform some additional steps, which may be a little complex. I will provide an example below and then explain each line to you.

From the default template, you can find where all the CMS sections are defined by visiting this link: https://github.com/ecomplus/storefront/tree/master/%40ecomplus/storefront-template/template/js/netlify-cms/base-config.

@matheusgnreis
matheusgnreis / slugify.js
Created June 16, 2022 15:53 — forked from codeguy/slugify.js
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@matheusgnreis
matheusgnreis / README.md
Created October 26, 2021 19:05 — forked from greyscaled/README.md
Sequelize + Express + Migrations + Seed Starter
@matheusgnreis
matheusgnreis / README.md
Last active August 30, 2021 15:22
Elementos por tamanho de tela

Existem algumas lojas que gostam de colocar um botão Meus Pedidos apenas para desktop. Logo, lá em header__buttons você pode colocar uma tag "a", como <a style="font-size: 1rem" class="d-none d-md-inline btn btn-lg" href="/app/#/account/orders">Meus pedidos</a>, com as classes d-none d-md-inline, que irá forçar um display none, porém como terá um display inline block para tamanhos de tela md (medium|desktop), irá mostrar apenas no desktop, para mobile será escondido.

Caso queira que mostre apenas no mobile, você pode colocar uma tag html com a classe d-md-none, que irá mostrar para todos os tamanhos de tela, porém para o tamanho md(desktop), irá esconder.

Um exemplo aplicando ambas modalidades é:

<a id="user-button" class="btn btn-lg" role="button" href="/app/#/account/" style="font-size: 1rem" title="Minha conta">
  <span class="d-none d-md-inline">Minha conta</span> 
 <span class="d-md-none"></span>
@matheusgnreis
matheusgnreis / README.md
Last active September 1, 2021 14:42
Creating new functionality to E-Com Plus CMS

First is adding a functionality in to an existence file. Go to a file that you gonna edit, just like footer.json. Add your propertie or array or object, just like:

  "stores": {
    "list": [
      {
        "title": "Title",
 "text": "Description"