1.0.12 • Published 3 years ago

mda-assets-template v1.0.12

Weekly downloads
1
License
ISC
Repository
gitlab
Last release
3 years ago

Custom templates in Multiverse Dynamics ADS

This package was created to provide the necessary assets in order to load the products from MDA into a custom HTML template.

Getting started

In order to get and show the products correctly from MDA, you need to follow this steps:

1. Load in your HTML

CDN (Recommended)

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mda-assets-template/dist/mda.js"></script>

Download

https://cdn.jsdelivr.net/npm/mda-assets-template/dist/mda.js

2. Initialize

Initialize MDA in your script file or at the end of <body>:

<script>
  document.addEventListener("DOMContentLoaded", function() {
    MDA({
      productsContainer: 'products',
      notAvailableMessageContainer: 'notAvailableMessage',
      sample: true,
    });
  });
</script>

Options

OptionValueRequiredDefaultDescription
productsContainerstringyesproductsID of the products container. The products will be loaded here.
notAvailableMessageContainerstringyesnotAvailableMessageID of the not available message. It will be shown if something went wrong loading the banner.
mainContainerstringnocontainerID of the main container. Only used to set the size as a class. Helpful for responsiveness.
tokenstringnoBanner ID to identify the campaign. Use it when you want to test for a specific campaign
loadingContainerstringnoloadingID of the loading container. It will be shown when the products are loading.
sizestringno300x600Indicates the size of the banner. This size will be set as a class in the main container.
samplebooleannofalseIndicates whether it loads sample products or real products. Useful when designing template.
productsnumberno4Only use if sample option is true. Indicates how many products you want to load in your sample.

Optional CSS

You can add this CSS to get a ready-to-use style in your product list view:

CDN (Recommended)

<link href="https://cdn.jsdelivr.net/npm/mda-assets-template/dist/mda-theme.css" rel="stylesheet">

Download

https://cdn.jsdelivr.net/npm/mda-assets-template/dist/mda-theme.css

Styling

If you want to style the product list, this is the generated HTML for every product:

<!-- Class 'alert-stock' is only shown if this product has low stock or it could not be checked -->
<div class="product alert-stock">
  <!-- Product image-->
  <div class="image"></div>
  <!-- This img element is only loaded if you choose to show the store logo. The variable 'store-name' is set with the store name.  -->
  <img class="imageStore {store-name}">
  <!-- Container with name and price / button -->
  <div class="info">
    <!-- Product name -->
    <div class="name">{product-name}</div>
    <!-- Class 'price' if you choose to show the price, or class 'buyBtn' if you choose to show a button with the message 'Comprar' -->
    <div class="price | buyBtn">
      $25.000 | Comprar
    </div>
  </div>
</div>

Build

Install packages

npm install

Development

npm run dev

Compiles and minifies for production

npm run build
1.0.12

3 years ago

1.0.11

3 years ago

1.0.9

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago