I have created a static block with sizes and would like to add a link to all product pages "size chart", and once you click it a pop up window with the chart = content of sttic block will show up.
Is there a possibility to do this at all?
I have found this: addin the following to page.xml:
<action method="addJs"><script>prototype/window.js</script></action>
<action method="addCss">
<stylesheet>prototype/windows/themes/default.css</stylesheet>
</action>
and then there are two snipets of code:
<script type="text/javascript">
function showForm(id){
win = new Window({ title: "Privacy Policies", zIndex:3000, destroyOnClose: true, recenterAuto:false, resizable: false, width:450, height:473, minimizable: false, maximizable: false, draggable: false});
win.setContent(id, false, false);
win.showCenter();
}
</script>
and
<a onclick="return showForm('popup_form_policy')" href="#">Privacy Policy</a>
and
<div id="popup_form_policy">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('privacy-policy')->toHtml()?>
</div>
I am stuck, where do I need to put these codes, do I need to put them in the view.phtml or soemwhere completely different? Or am I missing something, I added it but then it moved my whole view all over the place...
Sure it is possible, there are many ways of doing this.
You can preload the block in product tempalte, make it center in the screen, and hide it
#divElement{ position: absolute; top: 50%; left: 50%; margin-top: -50px; margin-left: -50px; width: 100px; height: 100px; display: none; }
and when the link, toogle the visibility of this block. Of course you will also need to create a close button.
or you can use a js lib like jquery ui dialog,
you can also create a new controller load this block only and use jquery ui dialog to pop it up with ajax.
or you can simply link to this new controller with target="_blank"
Thank you KuafuSoft!
To be honest I am very new to this and very confused
Your option sound pretty easy, but I don't understand it.... sorry.
hope this 2 links would help you understand
Thank you, this helps a little, altough, my problem is not the static block with content, I do have that. I would like to access the block via a link/button, when clicked on it the page should come up in a new window, like a pop up. Or at least link to a page within the menu...so if I put
echo $this->getChildHtml('sizes');
into my view.phtml, I get this error: var lifetime = 3600; var expireAt = Mage.Cookies.expires; if (lifetime > 0) { expireAt = new Date();...
And the page is not the way I want it.... Basically I need a link, and then the static block to come up in a new page.
Here is an easy way to do this by using the following popup extension. It will allow you to display different static blocks as popup on different pages.
For more details - http://www.magentocommerce.com/magento-connect/popup-extension-show-popup-window-on-any-page.html
Create your.php on root directory and paste below code:
<?php require_once('app/Mage.php'); umask(0); $layout = Mage::app()->getLayout(); $layout->getUpdate()->addHandle('default')->load(); $layout->generateXml()->generateBlocks(); echo '<p>before</p>'; echo $layout->createBlock('cms/block')->setBlockId('static_block_Identifier')->toHtml(); echo '<p>after</p>'; ?>
Goto Your Phtml file which you want to add popup window button in your website.
<div class="actions"> <button type="button" title="<?php echo $this->__('Size Chart') ?>" class="button" onclick="popWin('<?php echo Mage::getBaseUrl().'custom_popup.php';?>','compare','top:0,left:0,width=820,height=600,resizable=yes,scrollbars=yes')"><span><span><?php echo $this->__('Size Chart') ?></span></span></button> </div>
Call your php file in onclick popWin function
<?php echo Mage::getBaseUrl().'custom_popup.php';?>
Replace your php file name with custom_popup.php.
Let me know if you face any query/concern regarding this.
I tried your solution, the problem is that it opens a 404 error since my site has a identifier.
Also - I would just want text and not a button.
Any ideas?
Thanks,
SR
Solution is working fine at our end.
404 error normally comes if the problem is in path or URL
Kindly check the same at your end.