Open pop-up windows info, after client logout - magento

I'm trying to do something that should be quite easy, but after a while I realize that can be tricky in Magento.
So, my goal is pop-up (or pop-down) an windows that display information for the client that just logout. In my logout Success it just redirect to main page after 5 seconds.
The correct place to do it in the code/file I suppose that will be here (logout.phtml):
<div class="page-title">
<h1><?php echo Mage::helper('customer')->__('You are now logged out') ?></h1>
</div>
<p><?php echo Mage::helper('customer')->__('You have logged out and will be redirected to our homepage in 5 seconds.') ?></p>
<script type="text/javascript">
//<![CDATA[
setTimeout(function(){ location.href = '<?php echo $this->getUrl() ?>'},5000);
//]]>
</script>
Thanks in advance for any help.

You should be able to do what you are trying to do by editing that template. Does your JS code not end up being output? If not, make sure you are editing the right logout.phtml, depending on how your themes are setup there could be several. There's a developer setting to show the full path to blocks when viewing a page, that can be very helpful in making sure you are editing the correct template.
Also, I'm not sure if your JS code is just a test to see if it's being output, but it doesn't look like it would popup a window even if it were correctly output. The code looks like it would just redirect the user back to the main page of your site.
If you're looking for the JS code to create a popunder window, then something basic like this should work:
window.open('http://yoursite.com/popunder.html','Pop Under Window','').blur();
window.focus();
You can set the window attributes as you see fit by using the 3rd parameter of the open function.

Related

How to redirect the visitors to another site in Middleman?

Redirecting to another site was very easy in PHP. If they wanted to redirect visitors from "www.yoursite.com/news" to "www.bbc.com"...all I had to do was make the "news" folder and create an index.php file in it and add this line:
<?php
header("Location: http://www.bbc.com/");
?>
And I was done! But I recently started working on a project written in Ruby, and having trouble to figure out how to achieve this simple task :<
This might be a very silly question, but any help will be greatly appreciated!!
UPDATE:
So found out that this project is using static site generator Middleman to build the site, that's why there is no routes.rb file. It only has config.rb. Can anyone please help me to figure out how to redirect in middleman?
2nd UPDATE:
Looks like because of Middleman, this redirecting isn't possible that simply. So I am asking this (very dumb) question: How to redirect URL in Javascript or jQuery
So finally found an easy solution to my problem :)
In order to redirect www.yoursite.com/news to www.bbc.com, first I created a news.html.erb file under my source folder (where you have your index.html.erb file). And in that file I added the following lines and wallaaahhhh!
<% content_for :body_content do %>
<script type="text/javascript">
// Javascript URL redirection
window.location.replace("http://www.bbc.com/");
</script>
<noscript>
// Using HTML refresh meta tag as a fail back in case the user has javascript disabled
<meta http-equiv="refresh" content="0;URL=http://www.bbc.com/">
</noscript>
<% end %>
One thing I should mention here is that most sites suggested
using window.location.href, because replace() does not put the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button process.
But in my case window.location.href wasn't doing the trick :(
You'll need to setup a custom route in routes.rb:
get "/news" => redirect("http://bbc.com")

Generate Pinterest Share Button That Specifies URL

I am trying to create a "pinterest share" button, but am running into a snag.
Currently, I have the pinterest button (generated from their Widget Builder) appearing in a Lightbox. (For certain reasons, it must appear this way.)
The issue is the Lightbox code has direct linking on it, so the code for the lightbox window is something like: www.domain.com/#/social/4
Pinterest is picking up that URL (which has no images since it's just the lightbox) instead of the URL for the main page (www.domain.com).
Does anyone know how I can specify the exact URL to share via the pinterest button?
I have read some posts that said doing this would work:
<img src="//assets.pinterest.com/images/PinExt.png" alt="Pin it" / > <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
However, specifying the URL does not seem to work at all. It appears to be totally ignored and has no impact.
Any ideas?
Thanks in advance!
You can use a standard link and specify all the data in the parameters:
<a href="http://www.pinterest.com/pin/create/button/
?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fkentbrew%2F6851755809%2F
&media=http%3A%2F%2Ffarm8.staticflickr.com%2F7027%2F6851755809_df5b2051c9_z.jpg
&description=Next%20stop%3A%20Pinterest"
data-pin-do="buttonPin"
data-pin-config="above">
<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />
</a>
Source: http://developers.pinterest.com/pin_it/
You can try using structured meta data and Rich Pins.

Advanced search result is not coming in magento on home page

i added advanced search option on my home page by placing this code in
/app/design/frontend/default/hellowired/template/page/2columns-right.phtml
<div>
<?php echo
$this->getLayout()->createBlock('catalogsearch/advanced_form')->setTemplate('catalogsearch/advanced/form.phtml')->toHtml()
?>
</div>
when press submit button then it giving me nothing. so result are not showing... please help
Check if you are getting the post url of the form as {{base-url}}/catalogsearch/advanced/result/

AJAX Wordpress Site with Difficult URL settings

On this WordPress theme utilizing AJAX, proves to be difficult. The developer of the theme cannot seem to find the issue or solution to it.
This site runs beautifully, if, and only IF, you type is this complete URL "http://www.geigerandwood.com/#!//" if you type in the .com site alone, it will appear but will be disfunctional.
I have made attempts in 301 redirects, even creating a static page with a redirect but still no luck. Is there something that I can add or change in the code to make this work properly?
FYI - it has been tested on the common web browsers on both OSX & Windows.
Here is a video of my presented issue. http://www.screenr.com/D1G8
What theme do you use?
My quick examination of your page source code is that I only can find something related to the #!// is in here
<div id="contentBoxScroll">
<a id="closeButton" href="#!//"></a>
<div class="dragcontainer">
<div id="contentBoxScrollDragger" class="dragger">
<div class="scroll_up"></div>
<div class="scroll_down"></div>
</div>
</div>
</div>
I assume it must be something inside the script from which that HTML is generated. I can say more since I can't see the full source.

How to run my shell script from windows Webpage?

I want to execute some batch jobs from my unix box thro shell scripts.
Scenario:
I have some shell scripts in my unix box, want to run those scripts thro my windows webpage. This is to achieve by click on a button from the webpage.
Thanks in Advance.
The messy way:
Set up a web server on the unix box, use whatever programming language you fancy (say, PHP, Python, Perl) to generate a suitable web page, and make it do a system call to your script when it sees a postback. A very dumbed-down example in PHP:
<?php
if (isset($_POST['do_it'])) {
$result = `my_super_shell_script.sh`;
}
?>
<html>
<head><title>Run a script</title></head>
<body>
<form method="POST" action="">
<button type="submit" name="do_it" value="1">Do It!</button>
</form>
<pre>
<?php echo $result; ?>
</pre>
</body>
</html>
This, however, is full of problems. Most of all security: Anyone who can send a post request to your page can trigger the script, which is not usually what you want. You'll have to take extra measures to make sure nobody can access the page without prior authorization.
The nice solution:
Just use ssh. It doesn't give you a web site, but using PuTTY (or any other ssh client), you can simply log into the Unix box without exposing it to the whole world.

Resources