Skip to content

This is an ever-growing collection of helpful Business Catalyst javascript functions.

License

Notifications You must be signed in to change notification settings

w3bninja/bc-javascript-functions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Business Catalyst JavaScript Collection

Introduction

This is a collection of JavaScript functions us Two Blokes want to share with Business Catalyst community. Please feel free to contribute.

Requirements

You need to add jQuery to the head of your document before linking this file. Here's a Google hosted link:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>

Functions

function makeShippingSameAsBilling()

Usage:

Use this function to populate the the shipping address field with the billing address fields on the Business Catalyst checkout form.

To use this function simply add a checkbox to your checkout form and make an onclick call to the function e.g.

<input type="checkbox" onclick="makeShippingSameAsBilling();" />

function changeEmptyCartMessage()

Usage:

changeEmptyCartMessage() function is called when the shopping is empty. In our example the Ajax is used to retrieve a web page called empty_cart_page.htm. This allows you to create a rich empty cart page with catalogues, products, links and anything else you think will improve the shop functionality and increase conversions.

function UpdateProductExtras(c, p, res)

Usage:

Here we are overriding BC's UpdateProductExtras function and calling changeEmptyCartMessage.

$.alertMessageHolder = function(note, messageStyle)

Usage:

alertMessageHolder is a function that embeds the message into body. You must add

to the top of the shoppign cart layout and all the captured alerts will be displayed inside the page body instead of popping up and distracting the customer.

The following is the function which captures alerts and passes them onto alertMessageHolder:

window.alert = function(msg){
    messageStyle = 'success'; // Set style to success. We'll set it to error later on if the message is the Error message. Done so you can apply different styles    
    
    
    if ((msg.indexOf('ERROR:') >= 0) || (msg.indexOf('- ') >= 0))
    {
      messageStyle = 'error';  
    }   
    $.alertMessageHolder(msg, messageStyle);
    return false;
 }

About

This is an ever-growing collection of helpful Business Catalyst javascript functions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%