Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Using an Autocard Window with javascript...is it possible?


Guest

Recommended Posts

Hi there,

I'm a newbie with osCommerce. I have to say I like it, but ofcourse need some help from experts. The problem is, I want to use an Autocard Window (information about this autowindow you can get here: http://www.wizards.com/default.asp?x=mtgcom/arcana/172 ).

 

To use this you have to put the following script somewhere in your html-file:

 

<script language="Javascript"> function WizardsAutoCard (cardname) { windowName = "WotCWindow"; params = "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width=450, height=400"; win = window.open("http://www.wizards.com/magic/autocard.asp?name="+cardname, windowName, params); }</script>

 

Then I can use the following javascript to get an AutocardWindow from every card I want:

 

<a href="java script:WizardsAutoCard('Call of the Herd');">Call of the Herd</a>

 

I want to use osCommerce to make a shop for selling cards. So I want to use the above mentioned javascript where you can put your PRODUCTS URL when I create a new product.

 

Is this possible. If yes.....how?

 

Thanks in advance!

Link to comment
Share on other sites

That should be no problem.

 

Edit the default.php and product_info.php pages to contain the javascript function definition in the head block.

 

Then edit the lines that build the product information to the calling code to be an onClick event or as a link, however you wish to do it.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Thanks for the info Daemonj,

 

As I'm very new to oscommerce and PHP, could you please be more specific.

 

I mean I can find the product_info.php and I think you mean the lines between 20 and 30 to edit. There I have to replace already available javascript "popupWindow" with my javascript "Wizardsautocard(cardname)".

Then you tell me to edit the lines that build the product information. I don't know exactly which lines you mean.

 

Further I can't find the file default.php

 

Please help me....thanks in advance!

Link to comment
Share on other sites

Rather than replacing the popup window javascript code, I suggest adding your code either before or after the popup window function definition.

 

From there, just do a search for the popup function and replace that call with a call to your AutoWindow function.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

I put the WizardsAutoCard javascript on top of the popupWindow javascript in het file product_info.php. Then on line 110 I have replaced:

 

document.write('<?php echo '<a href="java script:popupWindow('' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

with:

 

document.write('<?php echo '<a href="java script:WizardsAutoCard('' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

Then when a add a product I use the word Stabilizer (is a name from a card and should work with the javascript WizardsAutoCard....a little new explorer should open) in the field PRODUCT URL...

Instead of opening a new little explorer...explorer opens with a new big window with the url ending on:

/catalog/redirect.php?action=url&goto=stabilizer

I get a blank window .......

 

Did I miss something?

Link to comment
Share on other sites

The products url field on the product entry screen is meant for opening a product description from someone else's site (i.e. the manufacturer).

 

You actually need to edit the product_info.php file and do the edits there.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

I know what you mean...but which lines exactly I have to edit ?

 

The thing is...when I know put in a url in the PRODUCT URL I want to put in a card name so the javascript window will automatically open.

 

I just thought to replace the javascript "popupWindow".....but that doesn't work.

Link to comment
Share on other sites

In that case, remove the call to the tep_href_link function.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

I think that you mean the following line, where I replaced "popupWindow" with "WizardsAutoCard":

 

<script language="javascript"><!--

document.write('<?php echo '<a href="java script:WizardsAutoCard('' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

 

Can you point me out how to edit the line?

Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...