npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lovata/shopaholic-wish-list

v1.0.0

Published

Package adds helper methods for integration with [Wish list for Shopaholic](https://octobercms.com/plugin/lovata-wishlistshopaholic) and [Shopaholic](https://octobercms.com/plugin/lovata-shopaholic) plugins.

Downloads

132

Readme

Wish list for Shopaholic package

Package adds helper methods for integration with Wish list for Shopaholic and Shopaholic plugins.

Package will allow you to quickly add "Add to wish list", "Remove from wish list", "Clear wish list" buttons in your project.

installation

npm install @lovata/shopaholic-wish-list

shopaholic-add-wish-list

Class will allow you to quickly add "Add to wish list" button in your project.

Basic usage

<div class="_shopaholic-product-wrapper" data-product-id="{{ obProduct.id }}">
    <h2>{{ obProduct.name }}</h2>
    <button type="button" class="_shopaholic-add-wish-list-button" aria-label="Add to wish list">
</div>

Simple example:

import ShopaholicAddWishList from "@lovata/shopaholic-wish-list/shopaholic-add-wish-list";

const obHelper = new ShopaholicAddWishList();
obHelper.init();

Advanced example:

import ShopaholicAddWishList from "@lovata/shopaholic-wish-list/shopaholic-add-wish-list";

const obHelper = new ShopaholicAddWishList();
obHelper
  .setButtonSelector('.add-wish-list-button')
  .setAjaxRequestCallback((obRequestData, obButton) => {
    obRequestData.loading = '.preloader';
    obRequestData.update = {'wish-list/wish-list-info': '.wish-list-info-wrapper'};
    obRequestData.complete = () => {
      obButton.hide();
    };
    
    return obRequestData;
  })
  .init();

Methods

init()

Method adds 'click' event listener on "Add to wish list" button.

setAjaxRequestCallback()

You can set callback function. This callback function will be called before sending ajax request.

You can change request object inside callback function. For example: add called partial and selector, add preloader class, etc.

import ShopaholicAddWishList from "@lovata/shopaholic-wish-list/shopaholic-add-wish-list";

const obHelper = new ShopaholicAddWishList();
obHelper.setAjaxRequestCallback((obRequestData, obButton) => {
  obRequestData.loading = '.preloader';
  obRequestData.update = {'wish-list/wish-list-info': '.wish-list-info-wrapper'}; 
  obRequestData.complete = () => {
    obButton.hide();
  };
  
  return obRequestData;
}).init();

setButtonSelector()

Redeclare default selector of "Add to wish list" button. Default value is "._shopaholic-add-wish-list-button".

import ShopaholicAddWishList from "@lovata/shopaholic-wish-list/shopaholic-add-wish-list";

const obHelper = new ShopaholicAddWishList();
obHelper.setButtonSelector('.add-wish-list-button').init();

shopaholic-remove-wish-list

Class will allow you to quickly add "Remove from wish list" button in your project.

Basic usage

<div class="_shopaholic-product-wrapper" data-product-id="{{ obProduct.id }}">
    <h2>{{ obProduct.name }}</h2>
    <button type="button" class="_shopaholic-remove-wish-list-button" aria-label="Remove from wish list">
</div>

Simple example:

import ShopaholicRemoveWishList from "@lovata/shopaholic-wish-list/shopaholic-remove-wish-list";

const obHelper = new ShopaholicRemoveWishList();
obHelper.init();

Advanced example:

import ShopaholicRemoveWishList from "@lovata/shopaholic-wish-list/shopaholic-remove-wish-list";

const obHelper = new ShopaholicRemoveWishList();
obHelper
  .setButtonSelector('.remove-wish-list-button')
  .setAjaxRequestCallback((obRequestData, obButton) => {
    obRequestData.loading = '.preloader';
    obRequestData.update = {'wish-list/wish-list-info': '.wish-list-info-wrapper'};
    obRequestData.complete = () => {
      obButton.hide();
    };

    return obRequestData;
  })
  .init();

Methods

init()

Method adds 'click' event listener on "Remove from wish list" button.

setAjaxRequestCallback()

You can set callback function. This callback function will be called before sending ajax request.

You can change request object inside callback function. For example: add called partial and selector, add preloader class, etc.

import ShopaholicRemoveWishList from "@lovata/shopaholic-wish-list/shopaholic-remove-wish-list";

const obHelper = new ShopaholicRemoveWishList();
obHelper.setAjaxRequestCallback((obRequestData, obButton) => {
  obRequestData.loading = '.preloader';
  obRequestData.update = {'wish-list/wish-list-info': '.wish-list-info-wrapper'};
  obRequestData.complete = () => {
    obButton.hide();
  }; 
  
  return obRequestData;
}).init();

setButtonSelector()

Redeclare default selector of "Remove from wish list" button. Default value is "._shopaholic-remove-wish-list-button".

import ShopaholicRemoveWishList from "@lovata/shopaholic-wish-list/shopaholic-remove-wish-list";

const obHelper = new ShopaholicRemoveWishList();
obHelper.setButtonSelector('.remove-wish-list-button').init();

shopaholic-clear-wish-list

Class will allow you to quickly add "Clear wish list" button in your project.

Basic usage

<button type="button" class="_shopaholic-clear-wish-list-button" aria-label="Clear wish list">

Simple example:

import ShopaholicClearWishList from "@lovata/shopaholic-wish-list/shopaholic-clear-wish-list";

const obHelper = new ShopaholicClearWishList();
obHelper.init();

Advanced example:

import ShopaholicClearWishList from "@lovata/shopaholic-wish-list/shopaholic-clear-wish-list";

const obHelper = new ShopaholicClearWishList();
obHelper
  .setButtonSelector('.clear-wish-list-button')
  .setAjaxRequestCallback((obRequestData, obButton) => {
    obRequestData.loading = '.preloader';
    obRequestData.update = {'wish-list/wish-list-info': '.wish-list-info-wrapper'};
    obRequestData.complete = () => {
      obButton.hide();
    };
    
    return obRequestData;
  })
  .init();

Methods

init()

Method adds 'click' event listener on "Clear wish list" button.

setAjaxRequestCallback()

You can set callback function. This callback function will be called before sending ajax request.

You can change request object inside callback function. For example: add called partial and selector, add preloader class, etc.

import ShopaholicClearWishList from "@lovata/shopaholic-wish-list/shopaholic-clear-wish-list";

const obHelper = new ShopaholicClearWishList();
obHelper.setAjaxRequestCallback((obRequestData, obButton) => {
  obRequestData.loading = '.preloader';
  obRequestData.update = {'wish-list/wish-list-info': '.wish-list-info-wrapper'};
  obRequestData.complete = () => {
    obButton.hide();
  }; 
  
  return obRequestData;
}).init();

setButtonSelector()

Redeclare default selector of "Clear from wish list" button. Default value is "._shopaholic-clear-wish-list-button".

import ShopaholicClearWishList from "@lovata/shopaholic-wish-list/shopaholic-clear-wish-list";

const obHelper = new ShopaholicClearWishList();
obHelper.setButtonSelector('.clear-wish-list-button').init();

License

© 2019, LOVATA Group, LLC under GNU GPL v3.

Developed by Andrey Kharanenka.