X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   problems with product.tpl (https://forum.x-cart.com/showthread.php?t=1758)

ciava 03-06-2003 03:16 AM

problems with product.tpl
 
Hi All

i just have a few glitches on my product.tpl which i would really like to get sorted out so i hope someone can help, basically when the user now clicks on more info for a product i have opened up the product.tpl in it's own window but i am having proplems firstly with passing info back to the main window and secondly with updating the voting system.

1. The add to cart button on the product.tpl, when clicked needs to load the info into the shopping cart in the main window, i've had it working before but made some alts and now i can't get it to work i believe it's something mising out of the js on the button but can't work out what it is.

2.rating the product in the popup works fine apart from just updating the product rating it now reloads the entire page in the popup (navbars, headers etc) instead of just the product.tpl.

my product.tpl code is below:-

any help would be great

jon


Code:

{* $Id: product.tpl,v 1.57 2002/09/25 12:39:40 zorg Exp $ *}
{literal}
<SCRIPT language=JavaScript1.2>
<!--
function product_option(name_of_option)
{
{/literal}
for(i=0; i<{php}echo count($product_options) {/php}; i++)
  if (document.orderform[i].name.search(name_of_option) != -1)
        return document.orderform[i];
return -1;     
{literal}
}

function FormValidation()

{/literal}
{if $javascript_code}
{$javascript_code}
{else}
return true;
{/if}
{literal}
}
-->
</SCRIPT>
{/literal}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" bgcolor="ff6600">[img]{$ImagesDir}/productbanner.gif[/img]</td>
  </tr>
  <tr>
    <td align="left" height="8"></td>
  </tr>
</table>
<table border=0 width=100%>
<form name=orderform method=post action="product.php" target="mainwin">
<INPUT type=hidden name=actions value=''>
<tr>
      <td valign=top align=left rowspan=2 width=51> </td>
      <td valign=top width="695">
        <table border=0 width=100% cellpadding=0 cellspacing=0>
          <tr>
            <td colspan=2>
              <div align="center"><font class=gry_bld_txt_big>{$product.product}</font></div>
            </td>
          </tr>
          <tr align="left">
            <td colspan=2></td>
          </tr>
          <tr align="center">
            <td colspan=2 height="14"></td>
          </tr>
          <tr align="center">
            <td colspan=2 height="5">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td valign="top">{include file="product_thumbnail.tpl" productid=$product.productid
                    image_x=$product.image_x image_y=$product.image_y product=$product.product}

                    <font size="1">Image for illustrative purposes only.</font>
                  </td>
                  <td>
                    <table width="250" border="0" cellspacing="0" cellpadding="0">
                      <tr valign="bottom">
                        <td colspan="2">[img]{$ImagesDir}/product_top.gif[/img]</td>
                      </tr>
                      <tr>
                        <td colspan="2">
                          <table width="250" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td background="{$ImagesDir}/prod_table_bg.gif">
                                <table width="250" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td width="80"><font class=red_bld_txt_sml>Quantity:</font></td>
                                    <td width="170">{if $product.avail gt 0}{$product.avail}{else}{$lng.txt_no}{/if}
                                      {$lng.txt_items_available}</td>
                                  </tr>
                                  <tr>
                                    <td width="80" bgcolor="cccccc"><font class=red_bld_txt_sml>Efind:</font></td>
                                    <td width="170" bgcolor="cccccc">{$product.productcode}</td>
                                  </tr>
                                  <tr>
                                    <td width="80"><font class=red_bld_txt_sml>Mfr
                                      Sku:</font></td>
                                    <td width="170">{$product.param01}</td>
                                  </tr>
                                  <tr bgcolor="#cccccc">
                                    <td width="80">Mfr</td>
                                    <td width="170">{$product.param00}</td>
                                  </tr>
                                  <tr>
                                    <td width="80"></td>
                                    <td width="170"></td>
                                  </tr>
                                </table>
                              </td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                      <tr valign="top">
                        <td colspan="2">[img]{$ImagesDir}/product_bot.gif[/img]</td>
                      </tr>
                      <tr valign="top">
                        <td width="250" colspan="2"></td>
                      </tr>
                      <tr valign="top">
                        <td align="right" width="80"></td>
                        <td align="right" width="170"><span align="left">Price:</span><font class=red_bld_txt_big>{if
                          $product.price ne 0} {include file="currency.tpl" value=$product.price}
                          {include file="customer/main/alter_currency_value.tpl"
                          alter_currency_value=$product.price} ex VAT{if $config.General.use_vat
                          eq "Y"}, including VAT {$product.vat}%{/if} {else}
                          <input type=text size=7 name=price2>
                          {/if}

                          ({math equation="price*amount" price=$product.price
                          amount=1.175 format="%.2f" assign=unformatted}{include
                          file="currency.tpl" value=$unformatted} inc VAT)</font></td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr> </tr>
          {if $active_modules.Product_Options ne ""} { include file="modules/Product_Options/customer_options.tpl"}
          {/if}
          <tr>
            <td height=25 width=30%>{$lng.lbl_quantity}{if $product.min_amount
              gt 1}

              <FONT class=TableCenterProductTitleOrange>{$lng.txt_need_min_amount}
              {$product.min_amount} {$lng.lbl_items}</FONT>{/if}</td>
            <td> {if $config.General.show_in_stock eq "Y" and ($product.avail
              le 0 or $product.avail lt $product.min_amount)} {$lng.txt_out_of_stock}
              {else} {if $config.General.show_in_stock ne "Y"} {assign var="mq"
              value=$config.General.max_select_quantity} {else} {math equation="min(maxquantity+minamount,
              productquantity)+1" assign="mq" maxquantity=$config.General.max_select_quantity
              minamount=$product.min_amount productquantity=$product.avail} {/if}
              {if $product.distribution eq ""}
              <select name=amount>
{if $product.min_amount le 1}
{assign var="start_quantity" value=1}
{else}
{assign var="start_quantity" value=$product.min_amount}
{/if}
{section name=quantity loop=$mq start=$start_quantity}
                <option value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</option>
{/section}
              </select>
              {else} <font class=TableCenterProductTitleOrange>1</font>
              <input type=hidden name=amount value=1>
              {$lng.txt_product_downloadable} {/if} {/if} </td>
          </tr>
          <tr>
            <td colspan=2><span class=TableCenterSubCategoryListTitleBlue">
              <input type=hidden name=mode value=add>
              {if $config.General.show_in_stock ne "Y" or ($product.avail gt 0
              and $product.avail ge $product.min_amount)} {include file="customer/main/product_prices.tpl"}
              <a href="javascript:if (FormValidation()) document.orderform.submit()">{include
              file="buttons/add_to_cart.tpl"}</a> 
              {if $login ne "" and $active_modules.Wishlist ne ""} {include file="customer/add2wl.tpl"}
              {/if} {/if} </span></td>
          </tr>
          <tr>
            <td colspan=2 height="5"></td>
          </tr>
          <td height="1" colspan=2 background="{$ImagesDir}/blue_dot.gif"></td>
          </tr>
          <tr>
            <td height="9" colspan=2></td>
          </tr>
          <tr>
            <td colspan=2><span class=TableCenterSubCategoryListTitleBlue"> {if
              $product.fulldescr ne ""}{$product.fulldescr}{else}{$product.descr}{/if}
              </span></td>
          </tr>
          <tr align="center">
            <td height="9" colspan=2></td>
          </tr>
          <tr>
            <td height="1" colspan=2 background="{$ImagesDir}/blue_dot.gif"></td>
          </tr>
                  <tr>
            <td height="12" colspan=2></td>
          </tr>
          <tr>
            <td colspan=2>{if $active_modules.Detailed_Product_Images
              ne ""}
             

 {/if} {if $active_modules.Upselling_Products ne ""}
             

 {include file="modules/Upselling_Products/related_products.tpl"
                } {/if} {if $active_modules.Recommended_Products ne ""}
             

 {include file="modules/Recommended_Products/recommends.tpl"
                } {/if} {if $active_modules.Customer_Reviews ne ""}
             

 {include file="modules/Customer_Reviews/vote_reviews.tpl" }
                {/if}
            </td>
          <tr>
            <td height="10" colspan=2 ></td>
         
        </table>
</td>
      <td align=right valign=top width=127> {if $product.discount ne 0}
<table border=0><tr><td width=55 height=56 background="{$ImagesDir}/save_money.gif" align=center valign=middle>


<font color=#FFFFFF>{ $product.discount }%</font>
</td></tr></table>{/if}
</td>
</tr>
<input type=hidden name=productid value="{$product.productid}">
<input type=hidden name=cat value="{$smarty.get.cat}">
<input type=hidden name=page value="{$smarty.get.page}">
</form>
</table>


funkydunk 03-06-2003 05:38 AM

You will need to put in some simple javascript into the head of the home.tpl document to make this work but that would be:

Code:

{literal}
<script language="JavaScript" type="text/JavaScript">
function NameWindow() {
  self.name = "mainwin";
}
</script>
{/literal}


And change the <body> statement to include onLoad="NameWindow()"

hth

ciava 03-09-2003 08:38 AM

Thanks, that worked a treat!!

funkydunk 03-09-2003 11:18 PM

:D


All times are GMT -8. The time now is 10:07 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.