Problems with custom footer on ebay store

404 views Asked by At

I am trying to add a custom footer on my store using a JavaScript code on my store's header. Here is code:

<script language="javascript" type="text/javascript"> 
document.Echo=document["standard"+"Write"]==null?document["write"]:document["standard"+"Write"]; 
var include=function(path){path="https://cdn.shopify.com/s/files/1/0958/3090/files/"+path;
document.Echo('<' + 'script src="' + path + '"' +' type="text\/javascript"><' + '\/script>');
}; 
</script> 

<script language="javascript" type="text/javascript">include("jquery.min.1.8.2js.js");</script> 
<script language="javascript" type="text/javascript">include("store.js");</script> 

I store my JavaScript files in Shopify file system and here is link to the folder: https://cdn.shopify.com/s/files/1/0958/3090/files/.

File that contains JavaScript is called store.js

Here is my JavaScript for adding a footer:

jQuery(document).ready(function(){
    //Right Click Protection
    //$(document).bind("contextmenu",function(e){ return false;});

    //Content Area Mods
    if(pageName == "PageAboutMeViewStore") {
        $(".pagecontainer > table:eq(1) tr:first td:first").addClass("os-background");
        $(".pagecontainer > table:eq(1)").addClass("os-table");
    }else {

        $(".pagecontainer > table:eq(1)").addClass("os-table");

        $(".pagecontainer > table:eq(1)").before("<div class='warp-w'>");

        $(".pagecontainer > table:eq(1) tr:first td:first").addClass("os-background");
        $(".os-background table:eq(1)").addClass("os-content");
        $(".os-content").find("br[clear = none]").remove();

    }   

    //Footer
    var footer = "\n\r <div id=\"os-footer\"> 
    <div class=\"os-inner\"> <div id=\"ftop\"> 
    <div id=\"pos2\"> </div><div  id=\"pos3\">Direct Wholesaler <br>
    <div id=\"pos1\" class=\"footer_text\">
    <div id=\"bottom_menu\"> <ul> 
    <li class=\"last\"><a href=\"http://contact.ebay.co.uk/ws/eBayISAPI.dll?ContactUserNextGen&recipient=wholesalers_direct">Contact Us</a></li> 
    <li><a href=\"http://stores.ebay.co.uk/directwholesaleshop/pages/shipping-information/_i.html?_mode=preview\">Shipping Information</a></li> 
    <li><a href=\"http://stores.ebay.co.uk/directwholesaleshop/pages/terms-and-conditions/_i.html?_mode=preview\">Terms &amp; Conditions</a></li> 
    </li> </ul> </div><div class=\"os-clear\">
    </div> 
    </div>
    <div id=pos4>
    <img src=\"http://pack.baseuber.com/partikle/images/secure-payments.png\" align=\"right\"></div> </div> 
    <div class=\"os-clear\"></div> </div><div id=\"fbottom\">Copyright &copy;Direct Wholesaler&nbsp;|&nbsp; All Rights Reserved &nbsp;|&nbsp; 
    <a href=\"http://uberebayshopdesign.com\" target=\"_blank\">eBay Shop Design</a></div> </div> </div> ";
    if(pageName != "PageAboutMeViewStore") {
        if($(".os-content").length > 0) {
            $(".os-content").after(footer);         
        }
    }

    $('.buy_now_related span').text('View Item');

    $('#selectedV').on('change', function() {
      var made =  this.value ; 
      if(made==0) return false;
     else window.location.href ='http://stores.ebay.co.uk/Partikle-Parts-and-Accessories/_i.html?_nkw='+made+'&submit=Search&_sid=1086666865' ;
  // or $(this).val()
    }); 
});

The problem is that I cannot see the footer on the page even though I can see it accesses the files in that folder.

Here is image proving that

So what is the problem?

1

There are 1 answers

2
zombiecode On

You cannot put much JavaScript directly into eBay, if you want to you have to document.write it in so that it's added after the initial load - works a treat..

eg:

<script type="text/javascript">
    document.write('<scr'+'ipt type="text/javascript" src="http://myebaystuff.com/jquery.js"></scr'+'ipt><scr'+'ipt type="text/javascript" src="http://myebaystuff.com/myjsfile.js"></scr'+'ipt>');
</script>

I've edited this as requested, and added a link to jQuery, and then an external script file.. You can add as many as you like, though with eBay I like to put everything into a single file to make it easier.