MCousin76 Posted July 8, 2008 Posted July 8, 2008 I added the code below inside one of my product descriptions. When i click on the link on the website the new window opens up just the way it's suppose to but, the product page redirects to the index page. Does anyone know how to stop that from happening? <a href="#" onClick="window.open('images/Die Cut Earth Friendly Adhesive Notes/player.swf','new_win', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable =0,width=600,height=500')"><img src="images/view-gallery.jpg" width="250" height="58" border="0" /></a>
MCousin76 Posted July 8, 2008 Author Posted July 8, 2008 I added the code below inside one of my product descriptions. When i click on the link on the website the new window opens up just the way it's suppose to but, the product page redirects to the index page. Does anyone know how to stop that from happening? <a href="#" onClick="window.open('images/Die Cut Earth Friendly Adhesive Notes/player.swf','new_win', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable =0,width=600,height=500')"><img src="images/view-gallery.jpg" width="250" height="58" border="0" /></a> it looks like it's messing with the session id??
spooks Posted July 8, 2008 Posted July 8, 2008 it looks like it's messing with the session id?? I would suspect its the href="#" , remember you need to use tep_href_link to avoid loosing sessions, although thats a link to content on the same page it still effectivly causes a reload. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
germ Posted July 8, 2008 Posted July 8, 2008 This thread explains the pitfall of the "#" relative link, and how to fix it: Click Me If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
MCousin76 Posted July 9, 2008 Author Posted July 9, 2008 This thread explains the pitfall of the "#" relative link, and how to fix it: Click Me How would i write the code for the link? I tried this but it didn't work... <a href="<?php echo tep_href_link(basename($PHP_SELF),'cPath=' . $cPath . '&products_id= ' . $products_id . '#' , $request_type) . '" onClick="window.open('images/Die Cut Earth Friendly Adhesive Notes/player.swf','new_win', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable =0,width=600,height=500')"><img src="images/view-gallery.jpg" width="250" height="58" border="0" /></a>
germ Posted July 9, 2008 Posted July 9, 2008 Well, the only difference between what you're doing and the post I linked to is that you're doing it inside a product desctiption. You can't use PHP inside a product description. Just write the link out "longhand" in HTML. Actually, you can use PHP inside the product description but you have to use the PHP eval() function and it makes you vulnerable to code injection and possible hacks. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
MCousin76 Posted July 9, 2008 Author Posted July 9, 2008 Well, the only difference between what you're doing and the post I linked to is that you're doing it inside a product desctiption. You can't use PHP inside a product description. Just write the link out "longhand" in HTML. Actually, you can use PHP inside the product description but you have to use the PHP eval() function and it makes you vulnerable to code injection and possible hacks. still no luck... i'm not sure what i'm doing wrong.... this is what the url looks like on the page that i'm trying to add the image link to: product_info.php?pName=die-cut-earth-friendly-adhesive-notes-100-sheets&cName=browse-by-industry-real-estate&osCsid=d225735341a22c3f68564a57aba9b6a2 Do you have any suggestions?
germ Posted July 9, 2008 Posted July 9, 2008 Can you give me a link so I can actually see the page and the HTML source? :unsure: If you don't want to post it, send me a PM. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
MCousin76 Posted July 9, 2008 Author Posted July 9, 2008 Can you give me a link so I can actually see the page and the HTML source?:unsure: If you don't want to post it, send me a PM. I added this code but it still didn't work.. :( <a href="product_info.php?pName=die-cut-earth-friendly-adhesive-notes-100-sheets&cName=browse-by-industry-real-estate" onclick="window.open('images/Die Cut Earth Friendly Adhesive Notes/player.swf','new_win','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable =0,width=600,height=500')"><img src="images/view-gallery.jpg" border="0" height="58" width="250"></a>
germ Posted July 9, 2008 Posted July 9, 2008 It's because you have a linebreak in the code You have a linebreak after the word resizable and it's mucking it up. :blush: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
germ Posted July 9, 2008 Posted July 9, 2008 The code must be on one line line. At least this part: onclick="window.open('images/Die Cut Earth Friendly Adhesive Notes/player.swf','new_win','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable =0,width=600,height=500')" Even the forum splits it where it shouldn't. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
MCousin76 Posted July 9, 2008 Author Posted July 9, 2008 It's because you have a linebreak in the code You have a linebreak after the word resizable and it's mucking it up. :blush: i took out the line break and the popup is working and the page is not redirecting back to the index page. The only other thing that i noticed is that i'm losing my session id. if i have items in the cart and then i click on the link my cart goes away. Do you have any suggestions on how i can keep the session id?
germ Posted July 9, 2008 Posted July 9, 2008 Basically, I think you're screwed. I think what spooks said earlier is true: remember you need to use tep_href_link to avoid loosing sessions You really can't do that in the description. Unless someone else reading this has a better idea. :blush: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
MCousin76 Posted July 9, 2008 Author Posted July 9, 2008 Basically, I think you're screwed. I think what spooks said earlier is true: You really can't do that in the description. Unless someone else reading this has a better idea. :blush: Thanks for the help. At least we got the popup to work :) Maybe i should write "View at your own risk, all items in your shopping cart will be destroyed" lol Thanks again though.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.