Aug 26
2013

Scannet Webshop 2 – how to make changes to non-editable pages

In Scannet Webshop 2 you can do a lot of stuff, if you have purchased the module “Avanceret design”. However not all pages are available for editing. For example the customers personal page after login is hidden, and it is not possible to change it.

However, using javascript its possible to do some magic with even static pages, that are not available in the Scannet Webshop 2 design system.

In this example we want to disable the feature, where a customer can cancel an order that he has already made. This is a link on the customers personal page, that he sees right after login.

Below i describe what you can do, to disable this link, and you can ofcourse use this technique for almost any layout problem you might have in Scannet Webshop 2.

1. Identify the the tag you need to modify. Open the page in a browser, show the source, and find it, in our case it looks like this:

<a id=”ctl00_bc_hlCancelOrder” href=”/dk/account/orderlist/?link=cancel&amp;returnpath=%2faccount%2fprofile%2f“>Annuller order</a> 

We find that the id of the link we want to modify is: ctl00_bc_hlCancelOrder

2. Go to “Avanceret design”->”Your active template”->Javascript, and you will see the custom javascript that is included on all pages in your shop.

3. Add this function to the code:

function disableCancelOrderLink() {
    var cancelLink = document.getElementById(‘ctl00_bc_hlCancelOrder’);
    if (cancelLink) {
            cancelLink.href=’javascript:alert(\’Not allowed \’)’;
    }  
}

4. And call the function in the document ready handler. Just add this line:

disableCancelOrderLink();

Somewhere in the readyhandler ($(document).ready…)

Thats it, the link is now disabled.

You can do a lot of other tricks, and even manipulate the dom, so you can remove links entirely or inject new structures etc.

I would rather prefer that all pages were accessible from the “Avanceret design” system, they are unfortunately not, but with the above javascript trick its possible, but a bit cumbersome.

This entry was posted in javascript, scannet, webshop. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *