Forums / All Other Contributions/Addons / eBook 'Look Inside' feature?

eBook 'Look Inside' feature?

Results 1 to 20 of 24
08 Dec 2009, 19:56
#1
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Posts:
315
Plugin Contributions:
0

eBook 'Look Inside' feature?

We have an eBook store under development. Our default template of course has the 'view larger image' pop up window in the upper left corner of the info display pages... but it's not really enough.

Most other eBook sites have, in it's place, a 'Look Inside' feature, where one could click on either a thumbnail or text link, and a window would pop up that had some kind of display where one could look at the cover, table of contents, and a couple of sample pages.

Does anyone have any ideas of how to make something like this work using Zen Cart? Any contributions or Add-ons that might make a difference?

-KismetDesign :smile:
09 Dec 2009, 00:35
#2
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

I created a pdf file of the ebook pages I want to display. and then used a popup window in the description to show the pdf file. Using a pdf was the easiest for me because it controlled the formatting and images plus the pages.

If you can not find any popup code that you like I can supply the one I use.

Skip
10 Dec 2009, 00:29
#3
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Posts:
315
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

Skip, do you by chance have a link that I could look at? Sounds like this might be the simplest solution.
10 Dec 2009, 02:51
#4
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

KismetDesign:

Skip, do you by chance have a link that I could look at? Sounds like this might be the simplest solution.


I found a place to show you an example. It is only there for the holiday season.
http://www.ccssinc.com/index.php?main_page=product_info&cPath=75&products_id=427


Skip
15 Dec 2009, 21:21
#5
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Posts:
315
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

This would definately be better than what we have now, that's for sure!

Can you send me what you did? I would super appreciate it. :smile:
15 Dec 2009, 22:23
#6
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

I just needed a fast and easy way to add a popup window. Any where that I could place a link.

Just for easy setup I place this file in includes/templates/YOUR_TEMPLATE/common/popup.php
But you can place it anywhere you want you just have to add the path to the include statment.
Just copy the code below and save it as popup.php
[php]

<?php
/**
* popup.php
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
*
* Standards Compliant Popup Script
* Author : Kevin Cannon
* http://www.multiblah.com
* Last Edited: 12.12.2004
* Version 1.0
*
* SkipWater adapted for zen cart 10.15.09
*
* Searches through a document for links with the class popup.
* When clicked, this link will open in a popup window.
* This means you don't have to add javascript to your code,
* and means the links continue to work, for search engines,
* and browsers without javascript.
*
*/
?>

<script type="text/javascript">

function initPopups() {

if (!document.getElementById) return
var aLinks = document.getElementsByTagName('a');
for (var i = 0; i < aLinks.length; i++) {
if (aLinks[i].className == 'popup') {

aLinks[i].onclick = function() {
var url = this.href;
openPopup(url);
return false;
}
}
}
}

// popupWindow function
// This is where you set your specific height & width etc... for your popups.

function openPopup(url) {
window.open(url, 'popupwindow', 'width=640,height=500,scrollbars,resizable');
return false;
}

// Piggy-back fucntion onto onLoad event
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}

addLoadEvent(initPopups);

</script>

[/php]

Add this include link to your includes/templates/YOUR_TEMPLATE/common/html_header.php just before </head> tag.
[php]
<?php include("popup.php"); ?>
[/php]

To call the popup with a link
[php]
<a class="popup" href="path_to_it/pdf_file.pdf">A PDF File or any file you want in the popup window</a>
[/php]

That's it

Skip
17 Dec 2009, 00:00
#7
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Posts:
315
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

Thanks alot!
23 Dec 2009, 20:08
#8
twaddle avatar

twaddle

Banned

Join Date:
Jul 2009
Posts:
478
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

skipwater:

I just needed a fast and easy way to add a popup window. Any where that I could place a link.

That's it

Skip


Hi Skip,

That works perfectly, thanks for that, you came up with that at just the right time I needed it - very clean and simple too :)

Is it possible do you (or anyone else) know to have the window resize automatically to the size of the image? That would make this little mod 100% perfect
23 Dec 2009, 21:59
#9
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

Is it possible do you (or anyone else) know to have the window resize automatically to the size of the image? That would make this little mod 100% perfect


Have not needed so have not done. You might find the lightbox mod a better solution to deal with images.

Skip
23 Dec 2009, 22:46
#10
twaddle avatar

twaddle

Banned

Join Date:
Jul 2009
Posts:
478
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

skipwater:

Have not needed so have not done. You might find the lightbox mod a better solution to deal with images.

Skip

Okay, thanks for the tip, for future installations I'll bear it in mind, but for this present site I am doing yours is just fine, so thanks again :smile:
07 Feb 2010, 19:12
#11
landysim avatar

landysim

New Zenner

Join Date:
Oct 2009
Posts:
1
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

skipwater:

I just needed a fast and easy way to add a popup window. Any where that I could place a link.

Just for easy setup I place this file in includes/templates/YOUR_TEMPLATE/common/popup.php
But you can place it anywhere you want you just have to add the path to the include statment.
Just copy the code below and save it as popup.php
[php]

<?php
/**
* popup.php
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
*
* Standards Compliant Popup Script
* Author : Kevin Cannon
* http://www.multiblah.com
* Last Edited: 12.12.2004
* Version 1.0
*
* SkipWater adapted for zen cart 10.15.09
*
* Searches through a document for links with the class popup.
* When clicked, this link will open in a popup window.
* This means you don't have to add javascript to your code,
* and means the links continue to work, for search engines,
* and browsers without javascript.
*
*/
?>

<script type="text/javascript">

function initPopups() {

if (!document.getElementById) return
var aLinks = document.getElementsByTagName('a');
for (var i = 0; i < aLinks.length; i++) {
if (aLinks[i].className == 'popup') {

aLinks[i].onclick = function() {
var url = this.href;
openPopup(url);
return false;
}
}
}
}

// popupWindow function
// This is where you set your specific height & width etc... for your popups.

function openPopup(url) {
window.open(url, 'popupwindow', 'width=640,height=500,scrollbars,resizable');
return false;
}

// Piggy-back fucntion onto onLoad event
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}

addLoadEvent(initPopups);

</script>

[/php]

Add this include link to your includes/templates/YOUR_TEMPLATE/common/html_header.php just before </head> tag.
[php]
<?php include("popup.php"); ?>
[/php]

To call the popup with a link
[php]
<a class="popup" href="path_to_it/pdf_file.pdf">A PDF File or any file you want in the popup window</a>
[/php]

That's it

Skip


Skip. I am very new to this coding thing and I am not getting this right somehow. I followed all instructions and I still can't get it right. One thing I noticed my template do not has a html_header.php file inside of commons so I copied it from another template (maybe that is the problem?) But still here is the code I am adding (this is a sample code I am using to try to get it right) ...For a complete review of the Spanish Verbs<a class="popup"href="download/SpanishVerbsforDummies.pdf"> Click here</a>...
I have my pdf file loaded inside of download, I created the popup.php file and I added the code to the html_header.php
I get a popup window saying ...Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

The url I am working on is http://halifaxspanishlessons.com/training/index.php?main_page=page&id=5 but it is password protected. let me know please if you can help me with this. thanks..
08 Feb 2010, 16:56
#12
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?


The url I am working on is http://halifaxspanishlessons.com/tra...page=page&id=5 but it is password protected. let me know please if you can help me with this. thanks..


The include header info looks OK but with the password protected pdf. I can not tell anything else.

You might want to setup a non-protected pdf file for testing and see how that works.

Skip
17 May 2011, 21:23
#13
dontolmanusa avatar

dontolmanusa

New Zenner

Join Date:
May 2011
Posts:
7
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

hi Skipwater,

love your fix for this. exactly what I'm looking for. BUT I'm a newbie! I've created a folder (pdf_files) within my Includes folder, uploaded by abbreviated pdf file to it, created the pop-up.php within my common folder. my template does not have the html_header.php folder but does have tpl_header.php wherein I placed your line of code "<?php include("popup.php"); ?> " just before the </div> command near the end of the file. then I used your code as the link in my product description, substituting the path to it as follows:

<a href="/public_html/pdf_files/AncientEpicuresPreview.pdf" class="popup">CLICK HERE for a look inside</a>

yet when I click on the link, I get a 404 error file not found.

can you tell what I'm doing wrong? is my placement of the include code in the wrong place within the tpl_header file? sure appreciate any assist you can give!:blush:
17 May 2011, 22:22
#14
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

dontolmanusa:

hi Skipwater,

I've created a folder (pdf_files) within my Includes folder, uploaded by abbreviated pdf file to it

<a href="/public_html/pdf_files/AncientEpicuresPreview.pdf" class="popup">CLICK HERE for a look inside</a>

yet when I click on the link, I get a 404 error file not found.



You are requesting the file from /public_html/pdf_files/AncientEpicuresPreview.pdf

But you say your file is here? /public_html/includes/pdf_files/AncientEpicuresPreview.pdf


<a href="/public_html/includes/pdf_files/AncientEpicuresPreview.pdf" class="popup">CLICK HERE for a look inside</a>

Skip
18 May 2011, 22:49
#15
dontolmanusa avatar

dontolmanusa

New Zenner

Join Date:
May 2011
Posts:
7
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

oops! I lied. the pdf_files folder is not within the "includes" folder. it is a folder within public_html
18 May 2011, 23:30
#16
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

dontolmanusa:

oops! I lied. the pdf_files folder is not within the "includes" folder. it is a folder within public_html


You have saved popup.php into this folder
/includes/templates/template_default/common/popup.php

And you added this code
<?php include("popup.php"); ?> 

into /includes/templates/template_default/common/html_header.php

<?php include("popup.php"); ?> 
</head>
<?php // NOTE: Blank line following is intended: ?>


Skip
19 May 2011, 00:13
#17
dontolmanusa avatar

dontolmanusa

New Zenner

Join Date:
May 2011
Posts:
7
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

template has no html_header.php folder but does have tpl_header.php wherein I placed your line of code "<?php include("popup.php"); ?> " just before the </div> command near the end of the file. is this a good place for it?

are you saying that b/c I placed popup.php in the includes folder, the pdf folder needs to be in the includes folder, as well?

sure appreciate your advice! and I sure don't understand why they have not yet included this "look inside" as part of the whole package yet. everyone wants to "look inside"
19 May 2011, 11:55
#18
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

dontolmanusa:

template has no html_header.php folder but does have tpl_header.php wherein I placed your line of code "<?php include("popup.php"); ?> " just before the </div> command near the end of the file. is this a good place for it?

are you saying that b/c I placed popup.php in the includes folder, the pdf folder needs to be in the includes folder, as well?

sure appreciate your advice! and I sure don't understand why they have not yet included this "look inside" as part of the whole package yet. everyone wants to "look inside"


The <?php include("popup.php"); ?> statement must be before the ending </header> tag. Is there a header tag in tpl_header.php? If not you have to fined the file that contains the <header> tags.

After that you must place popup.php in the same folder. That the file you added <?php include("popup.php"); ?> to.

Skip
19 May 2011, 18:08
#19
dontolmanusa avatar

dontolmanusa

New Zenner

Join Date:
May 2011
Posts:
7
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

well, unfortunately, I just can not locate a file with those tags in it. I've driven myself crazy trying to find it. even opening the web page, right-clicking & viewing the page source, there's no <header> tag. am I just blind? http://dontolmanstore.com/
19 May 2011, 21:17
#20
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Posts:
775
Plugin Contributions:
0

Re: eBook 'Look Inside' feature?

dontolmanusa:

well, unfortunately, I just can not locate a file with those tags in it. I've driven myself crazy trying to find it. even opening the web page, right-clicking & viewing the page source, there's no <header> tag. am I just blind? http://dontolmanstore.com/


Under admin->Tools->Developers Tool Kit

At the bottom of page:
Look-up in all files enter: shopping cart program by
All Files Look-ups: select All files - Catalog/Admin
File type: php only

Search

That should give you a list of three files
html_header.php should be in the list.

Skip