### Install Shopaholic Coupon Package
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-coupon/README.md
Installs the Shopaholic Coupon package using npm.
```bash
npm install @oc-shopaholic/shopaholic-coupon
```
--------------------------------
### Install Shopaholic Search Package
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-search/README.md
Installs the JavaScript helper package for Shopaholic search integration using npm.
```bash
npm install @oc-shopaholic/shopaholic-search
```
--------------------------------
### Install URL Generation Package (Bash)
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/url-generation/README.md
Installs the `@oc-shopaholic/url-generation` package using npm. This command is essential for integrating the library into your project's dependencies.
```bash
npm install @oc-shopaholic/url-generation
```
--------------------------------
### Basic Usage of URL Generation (JavaScript)
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/url-generation/README.md
Demonstrates the initial setup and basic operations of the URL Generation package. It shows how to initialize the generator, remove a parameter, set a new parameter, and apply the changes.
```javascript
import UrlGeneration from "@oc-shopaholic/url-generation";
UrlGeneration.init();
UrlGeneration.remove('page');
UrlGeneration.set('sorting', 'popularity|desc');
UrlGeneration.update();
```
--------------------------------
### Install Shopaholic Product List Package
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-product-list/README.md
Installs the Shopaholic product list package using npm. This command is the initial step to integrate the package's functionalities into your project.
```bash
npm install @oc-shopaholic/shopaholic-product-list
```
--------------------------------
### Install Shopaholic Wish List Helpers
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-wish-list/README.md
Installs the JavaScript helper package for Shopaholic's wish list functionality using npm.
```bash
npm install @oc-shopaholic/shopaholic-wish-list
```
--------------------------------
### Install @oc-shopaholic/shopaholic-filter Package
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Installs the shopaholic-filter package using npm. This is the initial step to integrate the filter panel helpers into your project.
```bash
npm install @oc-shopaholic/shopaholic-filter
```
--------------------------------
### HTML Search Input Element
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-search/README.md
Example of the HTML input element used for search queries. It requires a specific class name for the JavaScript to target.
```html
```
--------------------------------
### Install Shopaholic Cart Package
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Installs the necessary JavaScript package for cart functionality using npm. This is the first step to integrate cart features into your project.
```bash
npm install @oc-shopaholic/shopaholic-cart
```
--------------------------------
### Shopaholic Clear Wish List Basic Usage
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-wish-list/README.md
Provides the HTML structure for a 'Clear wish list' button and a simple JavaScript example to initialize the helper class.
```html
```
```
```javascript
import ShopaholicClearWishList from "@oc-shopaholic/shopaholic-wish-list/shopaholic-clear-wish-list";
const obHelper = new ShopaholicClearWishList();
obHelper.init();
```
--------------------------------
### Shopaholic Sorting Basic Usage
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-product-list/README.md
Shows the basic setup for the Shopaholic Sorting class. It integrates with ShopaholicProductList to handle sorting changes via AJAX requests, updating the product display accordingly.
```javascript
import ShopaholicProductList from "@oc-shopaholic/shopaholic-product-list/shopaholic-product-list";
import ShopaholicSorting from "@oc-shopaholic/shopaholic-product-list/shopaholic-sorting";
const obListHelper = new ShopaholicProductList();
obListHelper.setAjaxRequestCallback((obRequestData) => {
obRequestData.update = {'catalog/catalog-ajax': `.catalog_wrapper`};
return obRequestData;
});
const obSortingHelper = new ShopaholicSorting(obListHelper);
obSortingHelper.init();
```
--------------------------------
### Initialize Shopaholic Search (Basic)
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-search/README.md
Basic initialization of the ShopaholicSearch helper. It sets up an AJAX request callback to define loading indicators and update targets, then initializes the search functionality.
```javascript
import ShopaholicSearch from "@oc-shopaholic/shopaholic-search";
const obHelper = new ShopaholicSearch();
obHelper.setAjaxRequestCallback(function(obRequestData) {
obRequestData.loading = '.preloader';
obRequestData.update = {'search/search-result': '.search-result-wrapper'};
return obRequestData;
}).init();
```
--------------------------------
### ShopaholicSearch Methods
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-search/README.md
Documentation for key methods of the ShopaholicSearch class, including initialization, setting AJAX callbacks, search limits, and search delays.
```APIDOC
ShopaholicSearch:
__init__():
Initializes the search functionality by adding event listeners to the designated search input elements.
setAjaxRequestCallback(callback: function(obRequestData): object):
Sets a callback function that is executed before an AJAX request is sent. This allows modification of the request object, such as adding loading indicators or specifying update targets.
- Parameters:
- callback: A function that accepts the request data object and returns a modified request data object.
- Example:
obHelper.setAjaxRequestCallback(function(obRequestData) {
obRequestData.loading = '.preloader';
obRequestData.update = {'search/search-result': '.search-result-wrapper'};
return obRequestData;
})
setSearchLimit(limit: number):
Sets the minimum number of characters a user must enter before an AJAX search request is triggered. The default value is 3.
- Parameters:
- limit: The minimum character count required to initiate a search.
- Example:
obHelper.setSearchLimit(5)
setSearchDelay(delay: number):
Sets the delay in milliseconds after the user stops typing before an AJAX search request is sent. The default value is 400ms. This prevents excessive requests during rapid typing.
- Parameters:
- delay: The delay time in milliseconds.
- Example:
obHelper.setSearchDelay(600)
```
--------------------------------
### Initialize Shopaholic Search (Advanced)
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-search/README.md
Advanced initialization of the ShopaholicSearch helper, configuring search limits and delays along with AJAX request callbacks. This allows for finer control over search behavior and performance.
```javascript
import ShopaholicSearch from "@oc-shopaholic/shopaholic-search";
const obHelper = new ShopaholicSearch();
obHelper
.setSearchLimit(5)
.setSearchDelay(600)
.setAjaxRequestCallback(function(obRequestData) {
obRequestData.loading = '.preloader';
obRequestData.update = {'search/search-result': '.search-result-wrapper'};
return obRequestData;
}).init();
```
--------------------------------
### Shopaholic Product List Basic Usage
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-product-list/README.md
Demonstrates the fundamental usage of the ShopaholicProductList class. It initializes the helper and configures a callback function to define how AJAX requests are made, including which parts of the page to update.
```javascript
import ShopaholicProductList from "@oc-shopaholic/shopaholic-product-list/shopaholic-product-list";
const obListHelper = new ShopaholicProductList();
obListHelper.setAjaxRequestCallback((obRequestData) => {
obRequestData.update = {'catalog/catalog-ajax': `.catalog_wrapper`};
return obRequestData;
});
```
--------------------------------
### Shopaholic Clear Wish List Methods Documentation
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-wish-list/README.md
API documentation for the ShopaholicClearWishList class, detailing its methods for initialization, setting custom selectors, and configuring AJAX request callbacks.
```APIDOC
ShopaholicClearWishList:
__init__():
Adds a 'click' event listener to the 'Clear wish list' button.
setButtonSelector(selector: string):
Redeclares the default selector for the 'Clear from wish list' button.
Default value is "._shopaholic-clear-wish-list-button".
Parameters:
selector: The CSS selector for the clear wish list button.
Returns: The current instance of ShopaholicClearWishList for chaining.
setAjaxRequestCallback(callback: function):
Sets a callback function to be executed before sending an AJAX request.
This allows modification of the request object, such as adding loading indicators, specifying partial updates, or defining completion actions.
Parameters:
callback: A function that accepts two arguments: obRequestData (the request object) and obButton (the button element).
The function should return the modified obRequestData.
Example Callback:
(obRequestData, obButton) => {
obRequestData.loading = '.preloader';
obRequestData.update = {'wish-list/wish-list-info': '.wish-list-info-wrapper'};
obRequestData.complete = () => {
obButton.hide();
};
return obRequestData;
}
Returns: The current instance of ShopaholicClearWishList for chaining.
```
--------------------------------
### Initialize Shopaholic Coupon Helpers
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-coupon/README.md
Initializes the Shopaholic coupon add and remove functionalities by attaching event listeners to the relevant buttons.
```javascript
import ShopaholicCouponAdd from "@oc-shopaholic/shopaholic-coupon/shopaholic-coupon-add";
import ShopaholicCouponRemove from "@oc-shopaholic/shopaholic-coupon/shopaholic-coupon-remove";
const obShopaholicCouponAdd = new ShopaholicCouponAdd();
const obShopaholicCouponRemove = new ShopaholicCouponRemove();
obShopaholicCouponAdd.init();
obShopaholicCouponRemove.init();
```
--------------------------------
### Shopaholic Pagination Basic Usage
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-product-list/README.md
Demonstrates the basic integration of the Shopaholic Pagination class. It initializes the pagination helper with a ShopaholicProductList instance and sets up an AJAX request callback to update specific DOM elements.
```javascript
import ShopaholicProductList from "@oc-shopaholic/shopaholic-product-list/shopaholic-product-list";
import ShopaholicPagination from "@oc-shop-aholic/shopaholic-product-list/shopaholic-pagination";
const obListHelper = new ShopaholicProductList();
obListHelper.setAjaxRequestCallback((obRequestData) => {
obRequestData.update = {'catalog/catalog-ajax': `.catalog_wrapper`};
return obRequestData;
});
const obPaginationHelper = new ShopaholicPagination(obListHelper);
obPaginationHelper.init();
```
--------------------------------
### Shopaholic Coupon Methods API
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-coupon/README.md
Documentation for the methods available in the Shopaholic Coupon JavaScript package.
```APIDOC
ShopaholicCouponAdd:
__constructor()
Initializes a new instance of the ShopaholicCouponAdd class.
init(): ShopaholicCouponAdd
Method adds 'click' event listener on buttons with classes '_shopaholic-coupon-add'.
Returns the instance for chaining.
setAjaxRequestCallback(callback: function(obRequestData, inputNode, buttonNode): object): ShopaholicCouponAdd
Sets a callback function that is executed before sending an AJAX request.
This callback can modify the request object, for example, to add a loading indicator or specify partials.
Parameters:
callback: A function that accepts request data, input node, and button node, and returns the modified request data.
Returns the instance for chaining.
```
```APIDOC
ShopaholicCouponRemove:
__constructor()
Initializes a new instance of the ShopaholicCouponRemove class.
init(): ShopaholicCouponRemove
Method adds 'click' event listener on buttons with classes '_shopaholic-coupon-remove'.
Returns the instance for chaining.
setAjaxRequestCallback(callback: function(obRequestData, inputNode, buttonNode): object): ShopaholicCouponRemove
Sets a callback function that is executed before sending an AJAX request.
This callback can modify the request object, for example, to add a loading indicator or specify partials.
Parameters:
callback: A function that accepts request data, input node, and button node, and returns the modified request data.
Returns the instance for chaining.
```
--------------------------------
### Shopaholic Filter Panel: Initialize with Product List
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Initializes the ShopaholicFilterPanel class, linking it with a ShopaholicProductList instance for AJAX requests. It configures the update target for the catalog.
```javascript
import ShopaholicProductList from "@oc-shopaholic/shopaholic-product-list/shopaholic-product-list";
import ShopaholicFilterPanel from "@oc-shopaholic/shopaholic-filter-panel/shopaholic-filter-panel";
const obListHelper = new ShopaholicProductList();
obListHelper.setAjaxRequestCallback((obRequestData) => {
obRequestData.update = {'catalog/catalog-ajax': `.catalog_wrapper`};
return obRequestData;
});
const obFilterPanel = new ShopaholicFilterPanel(obListHelper);
obFilterPanel.init();
```
--------------------------------
### Basic HTML Structure for Coupon Input
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-coupon/README.md
HTML elements for coupon input and apply/remove buttons.
```html
Apply coupon
Remove coupon
```
--------------------------------
### Shopaholic Filter Price: Initialize with Product List
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Initializes the ShopaholicFilterPrice class, linking it with a ShopaholicProductList instance for AJAX requests. It configures the update target and event type for filtering.
```javascript
import ShopaholicProductList from "@oc-shopaholic/shopaholic-product-list/shopaholic-product-list";
import ShopaholicFilterPrice from "@oc-shopaholic/shopaholic-filter-panel/shopaholic-filter-price";
const obListHelper = new ShopaholicProductList();
obListHelper.setAjaxRequestCallback((obRequestData) => {
obRequestData.update = {'catalog/catalog-ajax': `.catalog_wrapper`};
return obRequestData;
});
const obFilterPrice = new ShopaholicFilterPrice(obListHelper);
obFilterPrice.setEventType('blur').init();
```
--------------------------------
### Shopaholic Clear Wish List Advanced Configuration
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-wish-list/README.md
Demonstrates advanced usage of the Clear Wish List helper, including setting a custom button selector and configuring AJAX request callbacks for loading indicators, partial updates, and completion actions.
```javascript
import ShopaholicClearWishList from "@oc-shopaholic/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();
```
--------------------------------
### Configure Shopaholic Coupon Ajax Callback
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-coupon/README.md
Advanced usage demonstrating how to set a custom AJAX request callback to modify request data before sending, such as adding a preloader element.
```javascript
import ShopaholicCouponAdd from "@oc-shopaholic/shopaholic-coupon/shopaholic-coupon-add";
import ShopaholicCouponRemove from "@oc-shopaholic/shopaholic-coupon/shopaholic-coupon-remove";
const obShopaholicCouponAdd = new ShopaholicCouponAdd();
const obShopaholicCouponRemove = new ShopaholicCouponRemove();
obShopaholicCouponAdd
.setAjaxRequestCallback(function(obRequestData, inputNode, buttonNode) {
obRequestData.loading = '.preloader';
return obRequestData;
})
.init();
obShopaholicCouponRemove
.setAjaxRequestCallback(function(obRequestData, inputNode, buttonNode) {
obRequestData.loading = '.preloader';
return obRequestData;
})
.init();
```
--------------------------------
### Shopaholic Order Creation
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Initializes the Shopaholic Order component and creates an order. It allows setting a callback for AJAX requests before submission and then triggers the order creation process.
```javascript
import ShopaholicOrder from '@oc-shopaholic/shopaholic-cart/shopaholic-order';
const obShopaholicOrder = new ShopaholicOrder();
obShopaholicOrder.setAjaxRequestCallback((obRequestData, obInput) => {
obRequestData.loading = '.preloader';
});
obShopaholicOrder.create();
```
--------------------------------
### Shopaholic Product List send Method
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-product-list/README.md
Details the `send` method of the ShopaholicProductList class. This method is responsible for initiating an AJAX request to fetch and update the product list, optionally accepting custom request data.
```javascript
const obListHelper = new ShopaholicProductList();
// Example of sending a request with default or custom data
obListHelper.send({});
```
--------------------------------
### Set URL Parameter with URL Generation (JavaScript)
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/url-generation/README.md
Adds or updates a field's value in the URL's search string. It supports single values or arrays, which are joined by '|'. Changes are applied to the URL upon calling `update()`.
```javascript
import UrlGeneration from "@oc-shopaholic/url-generation";
//URL http:://site.com?page=1
UrlGeneration.init();
UrlGeneration.set('sorting', 'popularity|desc');
UrlGeneration.update();
//URL http:://site.com?page=1&sorting=popularity|desc
UrlGeneration.set('brand', ['apple', 'samsung']);
UrlGeneration.update();
//URL http:://site.com?page=1&sorting=popularity|desc&brand=apple|samsung
```
--------------------------------
### Clear URL Parameters with URL Generation (JavaScript)
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/url-generation/README.md
Resets the URL's search string to an empty state, effectively removing all previously set parameters. The effect is applied to the URL upon calling `update()`.
```javascript
import UrlGeneration from "@oc-shopaholic/url-generation";
//URL http:://site.com?page=1&sorting=popularity|desc&brand=apple|samsung
UrlGeneration.init();
UrlGeneration.clear();
//URL http:://site.com
```
--------------------------------
### Shopaholic Add to Wish List Class
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-wish-list/README.md
Provides methods to integrate "Add to wish list" functionality into your project. It allows customization of the button selector and AJAX request callbacks for enhanced control over the user experience.
```APIDOC
ShopaholicAddWishList:
__constructor()
Initializes the Add to Wish List helper.
init():
Method adds 'click' event listener on "Add to wish list" button.
Usage Example:
import ShopaholicAddWishList from "@oc-shopaholic/shopaholic-wish-list/shopaholic-add-wish-list";
const obHelper = new ShopaholicAddWishList();
obHelper.init();
setButtonSelector(selector: string):
Redeclare default selector of "Add to wish list" button.
Default value is "._shopaholic-add-wish-list-button".
Parameters:
selector: The CSS selector for the add to wish list button.
Returns: The current instance of ShopaholicAddWishList for chaining.
Usage Example:
import ShopaholicAddWishList from "@oc-shopaholic/shopaholic-wish-list/shopaholic-add-wish-list";
const obHelper = new ShopaholicAddWishList();
obHelper.setButtonSelector('.add-wish-list-button').init();
setAjaxRequestCallback(callback: function):
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.
Parameters:
callback: A function that receives the AJAX request data and the button element, and returns the modified request data.
Returns: The current instance of ShopaholicAddWishList for chaining.
Usage Example:
import ShopaholicAddWishList from "@oc-shopaholic/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();
Basic Usage HTML:
{{ obProduct.name }}
```
--------------------------------
### Shopaholic Filter Price: Basic HTML Structure
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Defines the basic HTML structure for the price filter component. It requires two input fields for minimum and maximum price values.
```html
```
--------------------------------
### Shopaholic Product List setAjaxRequestCallback Method
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-product-list/README.md
Explains the `setAjaxRequestCallback` method for ShopaholicProductList. This allows developers to hook into the AJAX request process, modify request parameters, or add pre-request logic like setting update targets or preloader classes.
```javascript
import ShopaholicProductList from "@oc-shopaholic/shopaholic-product-list/shopaholic-product-list";
const obListHelper = new ShopaholicProductList();
obListHelper.setAjaxRequestCallback((obRequestData) => {
// Modify request data, e.g., specify update targets
obRequestData.update = {'catalog/catalog-ajax': `.catalog_wrapper`};
// Add other configurations like preloader classes, etc.
return obRequestData;
});
```
--------------------------------
### Shopaholic Pagination Custom Button Selector
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-product-list/README.md
Illustrates how to customize the CSS selector used for pagination buttons. This allows flexibility in targeting different HTML structures for pagination controls.
```javascript
const obPaginationHelper = new ShopaholicPagination();
obPaginationHelper.setButtonSelector('pagination_link').init();
```
--------------------------------
### Shopaholic Filter Panel: Basic HTML Structure
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Defines the basic HTML structure for a filter panel item. It uses a wrapper div with data attributes specifying the filter type and property ID, containing a list of filterable options.
```html
```
--------------------------------
### Remove URL Parameter with URL Generation (JavaScript)
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/url-generation/README.md
Removes a specified field and its value from the URL's search string. The changes are applied to the URL upon calling `update()`.
```javascript
import UrlGeneration from "@oc-shopaholic/url-generation";
//URL http:://site.com?page=1&sorting=popularity|desc&brand=apple|samsung
UrlGeneration.init();
UrlGeneration.set('brand'); // Note: This example seems to imply setting to an empty value or removing, but the description says 'remove field value'. Assuming it removes the 'brand' field.
UrlGeneration.update();
//URL http:://site.com?page=1&sorting=popularity|desc
```
--------------------------------
### Shopaholic Shipping Type List Rendering
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Renders a list of shipping types as radio inputs using Twig templating. It fetches and iterates over active shipping types, allowing selection via radio buttons.
```html
{% set obShippingTypeList = ShippingTypeList.make().sort().active() %}
{% for obShippingType in obShippingTypeList %}
{% endfor %}
```
--------------------------------
### Shopaholic Cart Shipping Type Initialization
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Initializes the Shopaholic Cart Shipping Type component. It sets up an AJAX request callback for handling shipping type changes and attaches event listeners.
```javascript
import ShopaholicCartShippingType from '@oc-shopaholic/shopaholic-cart/shopaholic-cart-shipping-type';
const obShopaholicCartShippingType = new ShopaholicCartShippingType();
obShopaholicCartShippingType.setAjaxRequestCallback((obRequestData, obInput) => {
obRequestData.loading = '.preloader';
}).init();
```
--------------------------------
### Shopaholic Order Form Structure
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Defines the HTML structure for a shopaholic order form, using specific classes and data attributes for input fields to facilitate data grouping and field mapping.
```html
```
--------------------------------
### Shopaholic Cart Add to Cart Functionality
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Enables the 'Add to cart' functionality using a dedicated JavaScript class. It requires specific HTML structure for product wrappers and buttons, and allows customization of AJAX requests.
```html
{{ obProduct.name }}
{% set obOfferList = obProduct.offer %}
{% for obOffer in obOfferList %}
{% endfor %}
```
```javascript
import ShopaholicCartAdd from '@oc-shopaholic/shopaholic-cart/shopaholic-cart-add';
const obShopaholicCartAdd = new ShopaholicCartAdd();
obShopaholicCartAdd.setAjaxRequestCallback((obRequestData, obButton) => {
obRequestData.loading = '.preloader';
}).init();
```
--------------------------------
### Shopaholic Remove Wish List Button Selector
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-wish-list/README.md
Redeclare the default selector for the 'Remove from wish list' button. This snippet demonstrates how to initialize the helper and set a custom button selector.
```javascript
import ShopaholicRemoveWishList from "@oc-shopaholic/shopaholic-wish-list/shopaholic-remove-wish-list";
const obHelper = new ShopaholicRemoveWishList();
obHelper.setButtonSelector('.remove-wish-list-button').init();
```
--------------------------------
### Shopaholic Cart Update Quantity Functionality
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Facilitates updating product quantities in the cart with increase/decrease buttons and a quantity input field. This JavaScript class allows for custom AJAX request configurations via callbacks.
```html
```
```javascript
import ShopaholicCartUpdate from '@oc-shopaholic/shopaholic-cart/shopaholic-cart-update';
const obShopaholicCartUpdate = new ShopaholicCartUpdate();
obShopaholicCartUpdate.setAjaxRequestCallback((obRequestData, obInput) => {
obRequestData.loading = '.preloader';
}).init();
```
--------------------------------
### Shopaholic Cart Restore Position Functionality
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Enables restoring a cart position using a dedicated JavaScript class. It relies on an HTML structure with a data attribute for the position ID and supports custom AJAX request callbacks for enhanced control.
```html
```
```javascript
import ShopaholicCartRestore from '@oc-shopaholic/shopaholic-cart/shopaholic-cart-restore';
const obShopaholicCartRestore = new ShopaholicCartRestore();
obShopaholicCartRestore.setAjaxRequestCallback((obRequestData, obButton) => {
obRequestData.loading = '.preloader';
}).init();
```
--------------------------------
### Shopaholic Remove from Wish List Class
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-wish-list/README.md
Provides methods to integrate "Remove from wish list" functionality into your project. It allows customization of the button selector and AJAX request callbacks for enhanced control over the user experience.
```APIDOC
ShopaholicRemoveWishList:
__constructor()
Initializes the Remove from Wish List helper.
init():
Method adds 'click' event listener on "Remove from wish list" button.
Usage Example:
import ShopaholicRemoveWishList from "@oc-shopaholic/shopaholic-wish-list/shopaholic-remove-wish-list";
const obHelper = new ShopaholicRemoveWishList();
obHelper.init();
setButtonSelector(selector: string):
Redeclare default selector of "Remove from wish list" button.
Default value is "._shopaholic-remove-wish-list-button".
Parameters:
selector: The CSS selector for the remove from wish list button.
Returns: The current instance of ShopaholicRemoveWishList for chaining.
Usage Example:
import ShopaholicRemoveWishList from "@oc-shopaholic/shopaholic-wish-list/shopaholic-remove-wish-list";
const obHelper = new ShopaholicRemoveWishList();
obHelper.setButtonSelector('.remove-wish-list-button').init();
setAjaxRequestCallback(callback: function):
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.
Parameters:
callback: A function that receives the AJAX request data and the button element, and returns the modified request data.
Returns: The current instance of ShopaholicRemoveWishList for chaining.
Usage Example:
import ShopaholicRemoveWishList from "@oc-shopaholic/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();
Basic Usage HTML:
{{ obProduct.name }}
```
--------------------------------
### Shopaholic Filter Price: Set Custom Field Name
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Allows overriding the default URL field name used for the price parameter in AJAX requests. The default field name is 'price'.
```javascript
const obFilterPrice = new ShopaholicFilterPrice();
obFilterPrice.setFieldName('price-filter').init();
```
--------------------------------
### Shopaholic Filter Price: Set Custom Event Type
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Allows overriding the default event type that triggers the price filter AJAX request. The default event type is 'change'.
```javascript
const obFilterPrice = new ShopaholicFilterPrice();
obFilterPrice.setEventType('blur').init();
```
--------------------------------
### Shopaholic Filter Panel: Set Custom Wrapper Selector
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Allows overriding the default CSS selector used to find filter panel wrapper elements. The default selector is '_shopaholic-filter-wrapper'.
```javascript
const obFilterPanel = new ShopaholicFilterPanel();
obFilterPanel.setWrapperSelector('price_filter').init();
```
--------------------------------
### Shopaholic Filter Price: Set Custom Input Selector
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Allows overriding the default CSS selector used to find price filter input elements. The default selector is '_shopaholic-price-filter'.
```javascript
const obFilterPrice = new ShopaholicFilterPrice();
obFilterPrice.setInputSelector('price_filter').init();
```
--------------------------------
### Shopaholic Filter Price: Set Custom Min Price Input Name
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Allows overriding the default name attribute for the minimum price input field. The default name is 'filter-min-price'.
```javascript
const obFilterPrice = new ShopaholicFilterPrice();
obFilterPrice.setInputMinPriceName('min-price').init();
```
--------------------------------
### Shopaholic Filter Panel: Set Custom Event Type
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Allows overriding the default event type that triggers the filter panel AJAX request. The default event type is 'change'.
```javascript
const obFilterPanel = new ShopaholicFilterPanel();
obFilterPanel.setEventType('blur').init();
```
--------------------------------
### Shopaholic Filter Panel: Set Custom Field Name
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Allows overriding the default URL field name used for filter parameters in AJAX requests. The default field name is 'property'.
```javascript
const obFilterPanel = new ShopaholicFilterPanel();
obFilterPanel.setFieldName('filter').init();
```
--------------------------------
### Shopaholic Filter Price: Set Custom Max Price Input Name
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-filter-panel/README.md
Allows overriding the default name attribute for the maximum price input field. The default name is 'filter-max-price'.
```javascript
const obFilterPrice = new ShopaholicFilterPrice();
obFilterPrice.setInputMaxPriceName('max-price').init();
```
--------------------------------
### Shopaholic Cart Remove from Cart Functionality
Source: https://github.com/oc-shopaholic/js-heplers/blob/main/shopaholic-cart/README.md
Provides a JavaScript class for removing items from the cart. It uses a specific HTML structure with a data attribute for the cart position ID and allows for custom AJAX request configurations.
```html
```
```javascript
import ShopaholicCartRemove from '@oc-shopaholic/shopaholic-cart/shopaholic-cart-remove';
const obShopaholicCartRemove = new ShopaholicCartRemove();
obShopaholicCartRemove.setAjaxRequestCallback((obRequestData, obButton) => {
obRequestData.loading = '.preloader';
}).init();
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.