Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

How to pop up a window.

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-05-2006, 12:18 PM
 
willirl willirl is offline
 

eXpert
  
Join Date: Mar 2004
Location: OHIO
Posts: 271
 

Default How to pop up a window.

I'm trying to pop up a window from a product page in the store. Here is the <a> I'm using:

<a href="javascript:void(0);" onClick="window.open('/store/files/images/small/-free-ship.html','mywindow','width=600,height=665')">(Cl ick here for Details)</a>

This pops up a window but the window holds the error message:

You don't have permission to access /store/files/images/small/-free-ship.html on this server.
__________________
Richard

x-cart version 4.0.17
http://roguewavemarine.com
Reply With Quote
  #2  
Old 10-05-2006, 12:27 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: How to pop up a window.

Put the file somewhere other than the files directory, or change the .htaccess in there to 'Allow from All' instead of Deny from all. Also make sure your file is really called -free-ship.html...looks like you might have an extra hyphen in there.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 10-06-2006, 07:03 AM
 
willirl willirl is offline
 

eXpert
  
Join Date: Mar 2004
Location: OHIO
Posts: 271
 

Default Re: How to pop up a window.

Well, when I use the full URL like http://roguewavemarine.com/blah/blah... it will show the window but apparently not when I use the file ref as above.

Maybe there is an easier way? What I want to do is to pop up a little help window from the product page. I want to be able to show the contents of one of the $config values in the window. Do you know of any "built-in" way to do this?

Or an easy way?
__________________
Richard

x-cart version 4.0.17
http://roguewavemarine.com
Reply With Quote
  #4  
Old 10-06-2006, 07:05 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: How to pop up a window.

Tough to show the variables in there without making it a php file and calling smarty and all of the associated X-Cart stuff.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 10-09-2006, 09:21 AM
 
willirl willirl is offline
 

eXpert
  
Join Date: Mar 2004
Location: OHIO
Posts: 271
 

Default Re: How to pop up a window.

This describes how to use an existing facility to add popup windows as needed to your store.

In the directory store/skin1/help there are several popups as a standard part of X-Cart. They are named like hlp_XXXX.tpl. You should create a new file in this directory replacing the "XXXX" in the name with something appropriate to your application. For example I created a file hlp_freeship.tpl to explain to the customer the details of our free shipping offer. You should add only letters and numbers - no underscores etc. (except for the underscore after the "hlp").

This tpl file will be processed by Smarty and can contain anything that a normal tpl file can contain.

After adding your code and/or HTML to the file all you have to do is set up a link where you want the customer to be able to invoke the popup. To do this use this as a template:

Code:
<A href="javascript: void(0);" onclick="javascript: window.open('popup_info.php?action=XXXXX','YYYYY','width=600,height=460,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');" >ZZZZZ</A>

You'll need to change the XXXXX to invoke the correct hlp tpl file. For the example above it would be set to "freeship" which will cause the hlp_freeship.tpl file to be invoked.

Change the YYYYY to the popup page title.

Change the ZZZZZ to the text that the customer will see. This a normal <a> link so you can put other things in for the customer to see.

ADDITIONAL INFO:

I've put the following at the top of my hlp_freeship.tpl to get some config and cart values to display in the popup:

Code:
{php} global $config, $cart; $this->assign("cart", $cart); $this->assign("config", $cart); {/php}

All this does is make all of the $cart and $config values available to Smarty. Then in the HTML of the tpl file you can drop in a Smarty reference like

Code:
${config.Shipping.freeshipthreshold}

or any other $config or $cart value. (freeshipthreshold is our value, you won't have one of these). This all depends on what php values are available at the time of your popup. It is context sensitive. I'm not a Smarty expert so there may be a better way to do this, but this works.
__________________
Richard

x-cart version 4.0.17
http://roguewavemarine.com
Reply With Quote
  #6  
Old 01-21-2007, 05:35 AM
 
Jay77 Jay77 is offline
 

Member
  
Join Date: Dec 2006
Posts: 23
 

Default Re: How to pop up a window.

Thanks for your mod to open a pop up window.
I have implemented what you have suggested and can get the popup to open but it tells me " the file does not exist or you do not have permission to access the file " - the file is in the right location - could this be something to do with .htaccess?. Any help would be greatly appreciated.
Thanks.
__________________
Version 4.1.6
Reply With Quote
  #7  
Old 01-31-2007, 01:57 PM
 
Jay77 Jay77 is offline
 

Member
  
Join Date: Dec 2006
Posts: 23
 

Default Re: How to pop up a window.

any clues ??? to this one.. Thanx
__________________
Version 4.1.6
Reply With Quote
  #8  
Old 06-17-2007, 07:38 PM
  BizzyB's Avatar 
BizzyB BizzyB is offline
 

Senior Member
  
Join Date: Sep 2006
Location: Australia
Posts: 102
 

Default Re: How to pop up a window.

Hi,

Did you get this resolved Jay77 ?
__________________
Version = X-Cart 4.1.3 Gold
Status - Closed
Addon: Magnifier
OS = Windows
Western Australia
Reply With Quote
  #9  
Old 06-23-2007, 12:20 AM
  BizzyB's Avatar 
BizzyB BizzyB is offline
 

Senior Member
  
Join Date: Sep 2006
Location: Australia
Posts: 102
 

Default Re: How to pop up a window.

A very useful method - thank you willirl.

It works good for what I want to use it for, that is, to save writing duplicate content.

I would really appreciate some clarification regarding the method you used. For example :-
Where does the page title (YYYYY) come into play?
What is the benefit of the php code you included? I am VERY new to this.

Could I prevail upon you to explain in more detail how this php code would work, a real life example would be truly appreciated.

Is it possible to use different text file content for the hlp_XXXX.tpl or do I have to use different hlp_XXXX.tpl files for each product page. That is, can I use prod01.txt for hlp_prod.tpl then use prod02.txt in hlp_prod.tpl for another product. Hope I made myself clear!

Once again, thank you for a very useful methodology.

Regards
__________________
Version = X-Cart 4.1.3 Gold
Status - Closed
Addon: Magnifier
OS = Windows
Western Australia
Reply With Quote
  #10  
Old 06-23-2007, 06:37 AM
  rogue's Avatar 
rogue rogue is offline
 

X-Adept
  
Join Date: Apr 2007
Location: Loveland, Ohio
Posts: 770
 

Default Re: How to pop up a window.

The page title is the text that is shown in the browser title bar when the page pops up. Also shown in tab if you are using tabbed browsing.

The php just makes the cart and config values available in Smarty on the popped up page so you can show the user something from the cart. (if you want to).

I think that the second assign should be

Code:
$this->assign("config", $config);
__________________
Richard Williams
Rogue Wave Limited

Initial Inventory Imports
Daily Inventory Updates
Daily Inventory Reports
Drop Ship Support
Order Export to Shipper/Supplier
Shopping Feeds That Work
Programming for X-Cart

richard@roguewavelimited.com
http://www.roguewavelimited.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:05 AM.

   

 
X-Cart forums © 2001-2020