In Shopper theme, there's a custom variable in skin\frontend\shopper\default\js\script.js file of the theme, it's not instantiated in this file, however it's called:

if (Shopper.totop) {

I made some modifications in the theme and now i'm getting this error in the console:

Uncaught ReferenceError: Shopper is not defined 

I can see in template/page/html/head.phtml that the variable is instantiated:

<script type="text/javascript">
    var Shopper = {};
    Shopper.price_circle = <?php echo Mage::getStoreConfig('shoppersettings/design/price_circle') ?>;
    Shopper.fixed_header = <?php echo Mage::getStoreConfig('shoppersettings/design/fixed_header') ?>;
    Shopper.totop = <?php echo Mage::getStoreConfig('shoppersettings/ajax/totop') ?>;
    Shopper.responsive = <?php echo Mage::getStoreConfig('shoppersettings/design/responsive') ?>;

Where's the problem then?, can anyone give a hint?. Thanks!


Could it be that after modifications you're loading them in wrong order, including script.js BEFORE you declare Shopper variable?

|improve this answer|||||
  • nope, i'm loading script.js at the end of the head reference in local.xml file: – Guille May 26 '14 at 23:23
  • Any chance I can see the result myself? I'm pretty sure there's something simple, like wrong capitalization, or problem with scope (such as defining Shopper INSIDE another function). – Pronto May 27 '14 at 6:44

Also it will make sense to execute your custom code on page load.

For prototype:

Event.observe(document, 'dom:loaded', function() {

For jQuery:

jQuery(document).ready(function() {
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.