I have been using Custom extension for "Quick View" on every product like this
when hover the image, that link will show. when click that link, it will show with detailed description with big image. Its working well in product list page. But in home page, I got error like "TypeError: d is undefined" in img_height.js line no.7
I have checked that file and give alert for to find what value hold by d.I got an alert like [object object].(Multiple alerts were came).
d=Element.retrieve(a,"prototype_event_registry",$H()));
alert(d); //undefined d
var e=d.get(b);
Object.isUndefined(e)&&(e=[],d.set(b,e));
After closing alert boxes by check the checkbox "prevent this page from creating additional dialogs".
At that time, I got Error like "NS_ERROR_NOT_AVAILABLE: "
But I got alert box only in home page, Not in product list page. After giving alert, Quick Look working well in home page too. But if i remove alert, again i got same error "TypeError: d is undefined"
And also in between, I got most of the errors like "$.browser is undefined","typeerror $(...).live is not a function". I have fixed those issues by adding this script "<script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script>"
But i can't able to whats the real issue. This issue consumed around 3 days of my time. Still i didn't get any idea about why its happend like this.
If anybody have an idea, please save me guys.....
When this kind of thing happens to me it is either:
a) Because the product page is loading some extra scripts that aren't present on the home page. In this case, study the page source of the product page and check all the scripts that are loaded and all the inline scripts. Compare this to the page source for the home page being very careful to distinguish between different versions of jQuery and ensuring that jQuery is always .noConflict() so that Magento's prototype.js can own $. Maybe the home page has some other module that loads a different version of jQuery before or after your Quick Look scripts.
Or
b) Because some HTML element that the script needs is not present on the HTML page. So for example the product page might have a DOM element <div id="my-special-quick-look-box"> that the JavaScript will reference, but on the home page maybe this element is missing or in an unexpected ancestor-child relationship. Or, the div is present but the CSS means it has no height or is missing some property that the JavaScript is trying to reference.
Or
c) If all the JavaScript is combined into one file, it changes the running order and often some DOM element that will be there later is not there when the script is run. So if you have combined JavaScript take care over the running order and use the DOM events to know what has loaded when and then run the JavaScript at the right time.
That is my experience. Maybe it will help you find the bug.
Related
I'm working on a site (reworking is probably a better word as I did not build it originally) and am encountering the following weird scenario:
Users go to a page which shows a list of current events. This is called "whats-on".
I have added a link to this page which takes users to a full event calendar for the month in a typical calendar format. This page is called "event-calendar". Once on the page they can also select which month they want to see and what type of events they are interested in.
Users can click on an event listed in any date to navigate to a page with the event details. (page is event-details with a query that pulls the relevant event.) I have added a back button to the page under the event listing which will return them to the calendar showing the month and search results they just looked at. No issues there - I am using PHP $_SERVER['HTTP_REFERER'] and that works perfectly.
Here is the issue - if I just did a back() or history.go(-1) link on that button, it takes the user all the way back to "whats-on". The same thing happens when you click the browser back button. It just skips over "event-calendar" entirely.
This apparently happens on the site under other scenarios such as business listings and searches.
Obviously I do not want that behavior - I want the back button to go to the previously viewed page like it should!!
I cannot think of anything in the code that would cause this, but the original site developers included a whole bunch of JQuery packages such as jQuery UI, and I'm wondering if something could be interfering with the default back button behavior. Is that even possible??
I guess what I want to know is there is any JQuery code that would change the behavior of the back button so I could hunt it down and kill it!!
Just looking for ideas as to where to start looking.
Apparently the only way I can get it to work is to manipulate the browser history using
history.pushState({}, '', 'event-calendar?<plus whatever query was used to pull the data>');
on the calendar page itself.
This seems to work but what a stupid workaround. Wish I could find the original problem.
So this website basically delivers flowers to people and depending on how far away the shipment is, it's going to cost more for the shipping. There are two prices: 12.95 and 30.00. The owner of the website wants it to automatically say "12.95" before a zip code or anything is typed in because he says its "turning people away" to see 30.00 like that. If they type the zip code in, it isn't a problem. It'll display the correct amount. I need it to say 12.95, or be totally blank until a zip code is typed in, by default instead of 30.00. any suggestions?
EDIT 1
The zip code input and the radio button to select the price are on 2 different pages. Theyre under 1 larger umbrella page, but it doesnt seem to be able to detect the zip code tag OR the radio button/label. Thats why i cant simply make it invisible until a zip code is typed. because i can't bridge javascript across two pages like that.
EDIT 2
well im not sure how all 3 pages come together, but im assuming that the zip code page and the radio button page are "included". they arent part of the actual document, so they cant be accessed via the DOM. when theyre displayed on the page, all the code comes together as a whole. or it appears that way. so i tried to manipulate the variables via the dom but it couldnt find them. then i tried to change things via cookies but that gave me a world of shit too. didnt work
Set the price to 12.95 and set an onChange eventListener to the zip code input that will recalculate the price.
$('#zipCode').change(function() {
updatePrice($(this).val());
});
It's hard to give specifics without actual code, sorry.
The answer was document ready, in jQuery. That's why I couldn't modify the code from the umbrella page; the page wasnt completely loading by the time my scripts were being executed. Here's the code I used:
<script>
$j=jQuery.noConflict();
$j( document ).ready(function() {
if (document.getElementById("shipping:postcode").value != "") {
document.getElementById("labelbutton_super").style.display='block';
} else {
document.getElementById("labelbutton_super").style.display='none';
}
});
</script>
I am having difficulties in the following problem:
I have a screen in PHP which displays a list of some records when I choose any of these
records (by clicking) it gives me a web site to share the data with this record. So far, it works.
I need to click on some of these records, instead of him
open another page, scroll down the screen and the record data to appear in the same screen, ie without opening another window.
Do you have any idea how to do this?
Thanks
You'll need to have a DIV at the bottom of the page, which will be completed by using an Ajax call and some javascript or jquery.
Without going into too much detail, heres what needs to happen:
User clicks a link which fires off an ajax request.
The backend PHP script takes the ajax call and generates either XML or pure HTML and returns the data.
JQuery or JavaScript on the original page takes the return and populates the empty DIV at the bottom of the page.
Regards
It sounds like you'll need to use ajax to pull this off.
I would personally suggest starting with reading up on the jQuery javascript library if you are not familiar with it already. It provides a very good set of ajax tools to work with.
Create a DIV layer on the bottom of the page. Use a simple AJAX library like this
Create a new php page that will only load a new record based on the recordID and call this page on the onclick method of your link that is now opening in the new window
I would try adding some jQuery to your page to handle this effect.
If you do add jQuery here is a function written to do just that:
http://pastebin.com/SeMHwSgg
Call the script like so:
Where a is the record you are having them click on and href="[some anchor]" located at the spot on the screen where you want the scrolling to stop:
<a id="gotop" href="#" onclick="goTop();return false;">click here</a>
So
Indeed, there is no error, it just does not have the effect that (scroll down the screen and show the record data). For now, it only shows the record open in another window.
Further to my question yesterday (here), I am working on a webpage that has a section that shows 'live' order details.
The top half of my webpage has Spry Tabbed Panels. One of the panels contains an include call to a separate php page that I have created (getOpenOrders.php). This contains an SQL query to obtain all open orders and then puts the details into a table.
As a result, the table of open orders is shown in the Spry panel. What steps do I now need to take to have this refresh every 15 seconds?
Do you really want to call the database every 15 seconds for each user? isn't that an overload?
I'm not saying that your database will be overloaded, but, thats how you shouldn't do things!
Edited
you should show an image, or the link to that page in order to gt an appropriate answer, because it all depends in what are you doing in the table.
because I don't know, I will give you an answer on what probably is happening.
Because you said that you're new to the ajax world, let's make things simple, and not to complicate on the you should return a JSON object and use it to re populate your table. :)
So we will start with 2 buttons (Previous and Next) so the user can move the data that is showing (you probably don't want to give him/her 100 lines to see right?)
let's say that you have 2 pages, a showData.php and getTable.php, in the showData.php you will need to load jQuery (wonderful for this) and add a little code, but where the table is to be placed, just add a div tag with an id="myTable" because we will get the data from the getTable.php file.
getTable.php file has to output only the table html code with all the data in, without no html, body, etc... the idea is to add inside the div called myTable all the code generated by getTable.php
Let's imagine that getTable.php gets a page variable in the queryString, that will tell what page you should show (to use LIMIT in your MySQL or PostgreSQL database)
You can use jQuery plugin called datatables witch is one of my choices, check his example and how small code you need to write! just using jQuery and Datatables plugin.
The first description follows the jQuery.Load() to load the getTable.php and add as a child of the div and wold do this for the previous and next buttons, passing a querystring with the page that the user requested. It's to simple and you can see the website for that, if you prefer to use the DataTables plugin, then just follow their examples :)
if you, after all this need help, drop me a line.
<META HTTP-EQUIV=Refresh CONTENT="15; URL=<?php print $PHP_SELF ?>">
This should be in between the head tags.
-or-
header('Refresh: 15');
This should be before the head tag and directly after the html tag.
As said by balexandre, a different method should be used. One that does not require a database hit every 15 seconds for every single user that is connected to the site. But, there is your answer anyways.
Although, balexandre makes a very good point, if you do decide that you need a refresh, you could simply do something like this in your JavaScript:
window.onload = function( )
{
setTimeout( 'window.location.refresh( )', 1500 );
}
(I've not tested the above code, so syntax may need to be tweaked a little, but you get the idea)
I have a page generated by php which includes two drop-down lists (SELECTs) which contain a lot of items (about 2,000 each). The page is fine, but when it loads in Firefox, there's a delay during the load, and then it seems to refresh the entire page. If a user tries to click on anything before the "reload" occurs, it has no effect.
In Explorer, each drop-down just takes a while (a second or two) to appear, which is fine.
Anyone know what this is? And aside from using AJAX to dynamically fill the drop-down list, is there an easy way to avoid it?
EDIT: Additional information. I have got my PHP script to output to a log file whenever it is called, so I can now see that what seems to be happening is this:
A call is made to the PHP script, and the page starts to load. After a few seconds, another identical call is made to the PHP script, at which point the page starts to load again. This time it completes loading. So I guess it seems like the browser refreshes the page automatically for some reason before the page finishes loading.
Wild shot in the dark: Do you have any images or hidden image submit buttons with BLANK src? I needed to 'fake' a 'default enter' effect for a textbox and used a hidden image button before all the fields. Since it was hidden, I left the src attribute blank. Firefox loaded the page twice! Pointing the src attribute at a single-pixel but real image fixed it.
First, you should use a network sniffer like wireshark to confirm that the page really loads twice.
Then, confirm that it happens only with firefox;
Then, you are on the good way ! I experienced a variant of what n8wrl is proposing; it was in some css declarations with some empty background-image property --> Check your CSS for empty file declarations