Helpcenter +918010117117 https://cdn.storehippo.com/s/573db3149f0d58741f0cc63b/ms.settings/5256837ccc4abf1d39000001/57614ef64256dc6851749879-480x480.png" [email protected] https://www.facebook.com/StoreHippohttps://twitter.com/StoreHippohttps://www.linkedin.com/company/hippoinnovations/https://plus.google.com/+Storehippo/posts
B4,309-10 Spaze iTech Park, Sector 49, Sohna Road, 122001 Gurgaon India
call to replace anchor tags contains '/admin' in href

Product shuffling

Add a startup script for random products to shown on listing pages:

ms.app.addPosthook({entity: 'ms.products', command: 'list'}, function(req, res, next) {
    if(req.query && req.query.sort) return next()
    var products = res.data && res.data.data;
    if(!products) return next()
    var shuffle = function (array) {
        let currentIndex = array.length,  randomIndex;
        while (currentIndex != 0) {
            randomIndex = Math.floor(Math.random() * currentIndex);
            currentIndex--;
            [array[currentIndex], array[randomIndex]] = [
                array[randomIndex], array[currentIndex]];
        }
        return array;
    }
    shuffle(products)
    next();
});
2023-06-01T06:12:30.426Z