Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / insert php script into item descritption for domain name registration ???

insert php script into item descritption for domain name registration ???

Locked

Views: 5,402

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
22 May 2008, 5:47 PM
#1
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

insert php script into item descritption for domain name registration ???

i wanting to know if it is possible to insert and integrate a php file into the item description
the php is for a who is script for domain name registration
you can see a working version here : http://www.1st-class-webdesigns.co.uk/whois/whois.php

what i want rather taking the customer away from my shop is to just add this script into the description so they can check if the domain they want is avalaible

anyone got any idea's?

i have the following html but when i click the submit button the cart picks it up and adds the product to the cart instead of the htlm script running the whois result

<form name='whois_search' method='POST' action='whois/whois.php'> <input type='hidden' name='page' value='WhoisSearch'> <input name='domain' type='text' value='desired domain name' size="30" maxlength="63"> <select name="ext0"> <option value="ru" selected>.ru</option> <option value="com">.com</option> <option value="net">.net</option> <option value="org">.org</option> <option value="us">.us</option> <option value="biz">.biz</option> <option value="info">.info</option> <option value="tv">.tv</option> <option value="ws">.ws</option> <option value="cc">.cc</option> <option value="name">.name</option> <option value="in">.in</option> <option value="cn">.cn</option> <option value="be">.be</option> <option value="it">.it</option> <option value="net.ru">.net.ru</option> <option value="org.ru">.org.ru</option> <option value="pp.ru">.pp.ru</option> <option value="msk.ru">.msk.ru</option> <option value="spb.ru">.spb.ru</option> <option value="su">.su</option> <option value="ру">.ру</option> <option value="ком">.ком</option> <option value="нет">.нет</option> <option value="орг">.орг</option> </select> <input type='submit' id='Submit' value='submit'> </form>
22 May 2008, 8:22 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: insert php script into item descritption for domain name registration ???

The description area is html only - it will not parse php

23 May 2008, 7:10 PM
#3
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

this goes out to a php script and i have seen it working on another site(wish i still had the url)

but if this wont work any idea's how i can incorporate the php script as part of the product description?

23 May 2008, 7:13 PM
#4
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

kobra:

The description area is html only - it will not parse php

sorry misread your reply

how can in incorporate a whois lookup in a product without taking the customer away from main shopping site?

i don't mind having it in a side box or something if necessary though i would prefer it on the product description

23 May 2008, 7:19 PM
#5
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,844
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

Hard code it into the tpl_product_info_display.php and wrap that code with code to check the product your on to see if it should display

23 May 2008, 7:20 PM
#6
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

wont that add it to all products though?

23 May 2008, 7:22 PM
#7
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,844
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

thats why I said to wrap the form code in conditional code that checks what product is being displayed to determine if it should display the form or skip it and just move on to the description.....

23 May 2008, 7:26 PM
#8
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

ok i understand

except im not good at this sort of thing if a post the main form code could you show me an example

or would it be possible to just add an include for the php script file?

script file name is /whois/whois.php

you can find it working on my site @ http://www.1st-class-webdesigns.co.uk/whois/whois.php

23 May 2008, 8:28 PM
#9
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,844
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

hey another thought wrap your form code in a <iframe>....your code....</iframe> in the description

23 May 2008, 10:52 PM
#10
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

barco57:

hey another thought wrap your form code in a <iframe>....your code....</iframe> in the description

the html code or the php script?

23 May 2008, 11:53 PM
#11
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

tried iframe but it just gives me a blank box on the description page

have a better version of the html to put on the page now but now instead of adding to cart it takes you direct to the whois.php page but still leaves the main shop
infact even trying to click update on the admin product info takes you to the whois page

<iframe><form name='whois_search' method='POST' action="/whois.php" style="margin-bottom: 0px;"> <input type='hidden' name='page' value='WhoisSearch'> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="20" colspan="3" class="darkgray">Check the avilability of your domain </td> </tr> <tr> <td width="25%" height="20"><div align="center" class="darkgray">www.</div></td> <td width="35%" height="20"><input name="domain" type="text" class="grey" size="12"></td> <td width="40%" height="20"><div align="center"> <select name="ext0" class="grey"> <option value="com">.com</option> <option value="net">.net</option> <option value="org">.org</option> <option value="biz">.biz</option> </select> </div></td> </tr> <tr> <td colspan="3"> <div align="right"> <input name="Submit2" id='Submit' type="submit" class="formfield" value="search"> </div></td> </tr> </table></iframe>
24 May 2008, 12:10 AM
#12
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

the annoying thing is all i need to do is somehow isolate the submittal button (check availability) so that its not submitting the whole thing to zencart but just submits the table to the script

24 May 2008, 1:54 AM
#13
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: insert php script into item descritption for domain name registration ???

run the whois in a popup

24 May 2008, 2:35 AM
#14
modchipfitters_co_uk avatar

modchipfitters_co_uk

Zen Follower

Join Date:
Sep 2006
Location:
United Kingdom
Posts:
190
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

got it to work
iframe did the job
id forgotten to set the initial start page lol

thanks for everyones help

24 Aug 2008, 5:28 PM
#15
west_one avatar

west_one

New Zenner

Join Date:
Nov 2006
Posts:
34
Plugin Contributions:
0

Re: insert php script into item descritption for domain name registration ???

Hi

I need help?

I use a domain lookup on my osC and I need to move to a Zen cart.

This is the code I use to add it to the cart but I now need it to work with Zen what / how do I change the code to get it to work?

<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
  <tr>
    <td>
<table width="100%" border="0" cellpadding="4" cellspacing="4" class="infoBoxContents">
<tr>
  <td class="boxtext" valign="top">
<?php
if (strcmp ($HTTP_GET_VARS['action'], 'err') != 0)
{
    $domain_query = tep_db_query("SELECT * from domains where domid = " . $tdid);
    $domain = tep_db_fetch_array($domain_query);
    $dom_id = $domain['domid'];
    $domname = $domain['domain'];
    $available = $domain['avail'];
    $ext = strstr($domname,".");
    $domain_query_price = tep_db_query("SELECT * from domain_price where tld='" . $ext . "'");
    $dom_price = tep_db_fetch_array($domain_query_price);
    $price = $dom_price['price'];
    $cart_quantity = 2;
}
switch ($HTTP_GET_VARS['action'])
  {
      case 'add_to_cart': 
        echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
         tep_db_query("insert into  " . TABLE_PRODUCTS . "(products_id, products_quantity, products_model, products_image, products_price, products_date_added, products_last_modified, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_ordered) values ('', '2', '" . $ext . "', 'domainsY.jpg', '" . $price ."', '', '', '', '1', '1', '1', '', '')");
          $pid= tep_db_insert_id();
           tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . "(products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . $pid . "', '1', '". $domname ."', '" . $ext . "', '', '')");
        $products_id = $pid;
        echo '<table  width="100%"  cellspacing="0" cellpadding="0" >' .
        '<tr><td>Domain Name</td><td>Price per Year</td></tr>' . 
        '<tr><td>' . $domname . '</td><td>' . $price . '</td></tr>';
        echo '<tr><td>' . tep_draw_hidden_field('cart_quantity', $cart_quantity) . '</td>';
          echo '<td>' .tep_draw_hidden_field('products_id', $products_id) . '</td></tr>';
        echo '<tr><td colspan=2 align=right>' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</td></tr></table>';
    break;
    case 'newcount':
        if ($available == 1)
        {
            echo tep_draw_form('cart_quantity', tep_href_link('register_names.php', tep_get_all_get_params(array('action')) . 'action=add_to_cart'));
            echo '<font class=boxTextDomains>' . TEXT_INFORMATION_AVAILABLE . '</font>';
               echo 'Click on <font color=blue>\'Register\'</font><BR><BR>';
            echo $domname;
            echo '         <input type="submit" value="Register">';
        }
        if ($available == 0)
        {
            echo '<font class=boxTextDomains>' . TEXT_INFORMATION_UNAVAILABLE . '</font>';
            echo '<br><BR>';
            echo '   ' . $domname . '   ';
            echo '<a target=_blank href=.\whois\checkwhois.php?domname=' . $domname;
            echo '>Whois</a> ';
        }    
    break;
    case 'err':    
        echo '<table  width="100%"  cellspacing="0" cellpadding="0" >' .
        '<tr><td>' . HEADER_DOM_TLD_ERROR . '</td></tr>' . 
        '<tr><td>' . TEXT_INFORMATION_ERROR . '</td></tr></table>';
        break; 
 }
 ?>
</td>
</tr>
</table>
</td>
</tr>
</table>