The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.
 
 
Thread Tools Display Modes
  #1  
Old 03-04-2011, 02:23 PM
nokiko's Avatar
nokiko is offline
Junior Member
 
Join Date: Mar 2011
Posts: 10
Question

Issues with dynmically loading why is this happening


Hi

In our portal system we use JavaScript based widget to add features to pages. Al tho I can use your code by adding it to a page I cannot get it to dynamically load i have the following:

Code:
            // Check if plugin is allready loaded
            if (typeof xAddWidget != 'undefined') {
                
                // Plugin allready loaded no need to load script just call the plugin
                xProductBrowser("categoriesPerRow=3", "views=grid(3,3) list(10) table(20)", "categoryView=grid", "searchView=list", "style=");
                alert("armand");
            } else {
                 
                // Plugin not loaded so first load the plugin and then call it
                jQuery.getScript("http://app.ecwid.com/script.js?257312", function() {
                     
                    xProductBrowser("categoriesPerRow=3", "views=grid(3,3) list(10) table(20)", "categoryView=grid", "searchView=list", "style=");
                    
                });
            }
If I use the above code I get the an error box that script annot be loade and the following message

__gwt_scriptsLoaded is not defined

How do I load your script dynamically instead of calling it from page?
  #2  
Old 03-05-2011, 04:17 PM
nokiko's Avatar
nokiko nokiko is offline
Junior Member
 
Join Date: Mar 2011
Posts: 10
Default

bump: any help I want to use this and get the pro version but need to have it working like this
  #3  
Old 03-05-2011, 06:43 PM
Eugene Rimmer's Avatar
Eugene Rimmer Eugene Rimmer is offline
Senior Member
 
Join Date: Jan 2011
Location: Ecwid headquarters
Posts: 7,765
Default

I'm investigating this now. Generally I have an idea how to run that dynamically, but I just need some tesing
  #4  
Old 03-06-2011, 12:09 PM
nokiko's Avatar
nokiko nokiko is offline
Junior Member
 
Join Date: Mar 2011
Posts: 10
Default

great thanks
  #5  
Old 03-07-2011, 02:32 PM
Eugene Rimmer's Avatar
Eugene Rimmer Eugene Rimmer is offline
Senior Member
 
Join Date: Jan 2011
Location: Ecwid headquarters
Posts: 7,765
Default

To load Ecwid dynamically, you should modify your code a bit. Before the jQuery.getScript with your Ecwid script URL you should add this line:
Code:
window.ecwid_script_defer = true;
This way Ecwid script will know that you are intently loading its main script from your custom script, and will change the way it connects to your page.

I've tested your code with this added line on my page, it works perfectly in all major browsers.
  #6  
Old 03-07-2011, 04:09 PM
nokiko's Avatar
nokiko nokiko is offline
Junior Member
 
Join Date: Mar 2011
Posts: 10
Default

thanks that works , one thing tho

Is it possible to tell the script to load in a specified element example : <div class="store"></div>

one other question

How is the loading of the files handles I am using a script called livequery that responds when new item are added to page and then does somethign with it to move certain items even after ajax calls

however this does not work with your store. I wanted to see if I could move certain items to different places in the layout but that does not seem to be working

I set up a jsfiddle here.
http://jsfiddle.net/nokiko/Sjc8k/25/

As you ca see the images added by json call get moved accrodingly but not the iamges of the store.

so my questions are

1. can i tell the dynamic script to load the store in a specific element
2. can my livequery setup work with ecwid or is the way you load content just not make it possible
  #7  
Old 03-07-2011, 05:48 PM
Eugene Rimmer's Avatar
Eugene Rimmer Eugene Rimmer is offline
Senior Member
 
Join Date: Jan 2011
Location: Ecwid headquarters
Posts: 7,765
Default

When deferred, the Ecwid script will always append its widget markup inside a div to the end of the body element. Here is the code from the shop script:
Code:
if (window.ecwid_script_defer) {
    var element = document.createElement("div");
    element.innerHTML = html;
    document.body.appendChild(element);
} else document.write(html);
In plain english this part means that if shop loading is deferred, then create a div, put the shop markup (html variable) into it and append to body, and if shop loading was not deferred, insert it right in place immediately (document.write() method call). Hence no option yet to defer loading and at the same time load the shop into some element.

Livequery hooks to the jQuery's own DOM manipulation methods to get notified of DOM changes. Since Ecwid does not rely on jQuery for DOM manipulation, the DOM change events are not fired for Livequery and hence it does not catch anything (also Livequery was considered obsolete since jQuery 1.4 or so, but nevertheless, it's not the matter).

There I've set up another version of your fiddle: http://jsfiddle.net/Sjc8k/33/ where I don't rely on jQuery for manipulating the images, and they do not get added to the div (by the way, your original fiddle was tangled a bit, it added the images from JSON right into the place, where you were trying to move them on livequery, so it didn't actually illustrate that livequery works; here is jQuery based equivalent of my example, that illustrates that livequery works when I manipulate DOM with jQuery: http://jsfiddle.net/Sjc8k/34/ ). There is the setup that makes your example totally work as you intended: http://jsfiddle.net/Sjc8k/36/ .

So, livequery is possible as soon as you somehow (say, by the means of setInterval or using onhashchange event) call any of jQuery's DOM manipulation methods.
  #8  
Old 03-07-2011, 06:08 PM
nokiko's Avatar
nokiko nokiko is offline
Junior Member
 
Join Date: Mar 2011
Posts: 10
Default

Hi

thanks for the support it is all working now I use the change of (.ecwid) to move it to the selected wrapper

fyi - I am only using livequery for this specific case. Livequery was replaced by jquery's own live() however thsi is only for handling event like click mouseover etc.

there is no equivalent to:

$('.ecwid').livequery(function(){
$(this).appendTo("#store");
});
  #9  
Old 03-08-2011, 11:51 PM
nokiko's Avatar
nokiko nokiko is offline
Junior Member
 
Join Date: Mar 2011
Posts: 10
Default

Hi

I have a DotNetNuke implementation working here

http://www.schwingsoft.com/skinconve...7/Default.aspx

however only in IE the click dont seem to work with this method, I even get stackoverflow error after leaving it open for a while. If I double click it does work.

I was hoping to get it working the widget way, if not I will have to revert to another method

Can you see if im doing somethign wrong here. if I have this 100% working as a widget in #DotNetNuke it will be released for free on codeplex
  #10  
Old 03-09-2011, 01:32 PM
nokiko's Avatar
nokiko nokiko is offline
Junior Member
 
Join Date: Mar 2011
Posts: 10
Default

ok I traced back that issue to the way the widgets are initialized in the system and have to find a workaround for that. just Another round of testing and first version should be done and I can move up to the custom displays with the api and the other widgets like cart etc
 
The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.

Tags
dyanmic, getscript, jquery

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:46 AM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.