X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Theme design problem core.loadable.js H1 tag (https://forum.x-cart.com/showthread.php?t=69930)

totaltec 09-03-2014 01:29 PM

Theme design problem core.loadable.js H1 tag
 
Hi all, I have run into a problem with skins/common/js/core.loadable.js

Inside this file you will find this function:
Code:

// Place new page title
ALoadable.prototype.placeNewPageTitle = function(title)
{
  if (this.updatePageTitle) {
    jQuery(this.titlePattern).eq(0).html(title);
  }

  if (this.updateBreadcrumb) {
    jQuery('#breadcrumb .last').find('a,span').html(title);
  }
};


This function replaces the page title on the Cart page once cart is emptied. If in my markup I have an H1 tag located above the page title, say in the header of the page, this function will replace that H1 tag instead of the standard one. This should probably be addressed by more specifically targeting the page title H1.

In the meantime I need to replace core.loadable.js with my own code, or override it somehow. What would be your preference for overriding this code in my custom module? I am not building a skin module, but there are instances where my module will create an H1 tag in the header due to the admin's settings and theme choices. How can I get around this obstacle in the most elegant and maintainable way?

qualiteam 09-03-2014 09:36 PM

Re: Theme design problem core.loadable.js H1 tag
 
You need to make the following code loaded (the getJSFiles() method) on pages where you want to change the behavior:
Code:

ALoadable.prototype.titlePattern = '[jquery_selector_to_the_h1_tag_to_be_updated]';

I believe this should work.


All times are GMT -8. The time now is 03:13 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.