Here is my skin1/modules/Product_Options/product_variants.tpl
Code:
{if $active_modules.Product_Options ne ""}
{capture name=dialog}
<TABLE border="0" {if $productids ne ''}cellspacing="0" cellpadding="4"{else}cellspacing="1" cellpadding="2"{/if} width="100%">
<FORM action="product_modify.php" method="POST" name="productvariantsform">
<INPUT type="hidden" name="section" value="{$section}">
<INPUT type="hidden" name="mode" value="product_variants_modify">
<INPUT type="hidden" name="productid" value="{$product.productid}">
<TR class="TableHead">
<TD colspan="2" align="center">{$lng.lbl_image}</TD>
<TD width="40%">{$lng.lbl_variants}</TD>
<TD>#VARIANT ID</TD>
<TD>{$lng.lbl_price}</TD>
<TD>{$lng.lbl_weight}</TD>
<TD>{$lng.lbl_amount}</TD>
<TD>{$lng.lbl_sku}</TD>
</TR>
{foreach from=$variants item=v}
<TR{cycle name="classes" values=" class=TableSubHead,"}>
<TD>
[img]{$ImagesDir}/delete.gif[/img][img]{$ImagesDir}/change.gif[/img]</TD>
<TD align="center">
[img]{$xcart_web_dir}/image.php?productid={$product.productid}&variantid={$v.variantid}[/img]</TD>
<TD><TABLE>
{foreach from=$v.options item=o}
<TR>
<TD>{$o.class}:</TD>
<TD>{$o.option_name}</TD>
</TR>
{/foreach}
</TABLE></TD>
<TD>{$v.variantid}</TD>
<TD><INPUT type="text" size="8" name="vs[{$v.variantid}][price]" value="{$v.price}"></TD>
<TD><INPUT type="text" size="5" name="vs[{$v.variantid}][weight]" value="{$v.weight}"></TD>
<TD><INPUT type="text" size="5" name="vs[{$v.variantid}][avail]" value="{$v.avail}"></TD>
<TD><INPUT type="text" size="20" name="vs[{$v.variantid}][productcode]" value="{$v.productcode}"></TD>
</TR>
{foreachelse}
<TR>
<TD align="center" colspan="5">{$lng.lbl_variants_list_empty}</TD>
</TR>
{/foreach}
</TABLE>
{if $variants ne ''}
<INPUT type="submit" value="{$lng.lbl_update}">
<INPUT type="button" value="{$lng.lbl_rebuild_variants}" onclick="javascript: self.location='product_modify.php?section={$section}&productid={$product.productid}&mode=product_variants_rebuild';">
{/if}
</FORM>
{if $file_upload_data.imtype eq "T"}
{include file="main/subheader.tpl" title="Preview variant image"}
<TABLE border="0">
<TR>
<TD>
[img]{$xcart_web_dir}/image.php?productid={$product.productid}&variantid={$file_upload_data.variantid}&tmp=y[/img]</TD>
</TR>
<TR>
<TD>
{$lng.txt_save_thumbnail_note}</TD>
</TR>
</TABLE>
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_product_variants content=$smarty.capture.dialog extra="width=100%"}
{/if}
and my modules/Product_Options/product_variants.php
Code:
<?php
#
# $Id: product_variants.php,v 1.1 2004/06/16 09:32:24 max Exp $
#
# Product variants management
#
if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); }
#
# Product variants update
#
if($mode == 'product_variants_modify' && $variants) {
foreach($variants as $k => $v) {
db_query("UPDATE $sql_tbl[variants] SET weight = '$v[weight]', avail = '$v[avail]' WHERE variantid = '$k'");
db_query("UPDATE $sql_tbl[pricing] SET price = '$v[price]' WHERE variantid = '$k' AND productid = '$productid' AND quantity = 1 AND membership = ''");
if(!func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[variants] WHERE variantid = '$k' AND productcode = '$v[productcode]'"))
db_query("UPDATE $sql_tbl[variants] SET productcode = '$v[productcode]' WHERE variantid = '$k'");
}
$top_message["content"] = func_get_langvar_by_name("msg_adm_product_variants_upd");
$top_message["type"] = "I";
# Prepare for thumbnail updating
func_set_product_by_variants($productid);
$image_posted = func_check_image_posted($file_upload_data, "T");
$store_in = ($config["Images"]["thumbnails_location"] == "FS"?"FS":"DB");
if($image_posted)
{
# Get image content
$image_data = func_get_image_content($file_upload_data, $productid);
# Replace image (DB) or full path to image (FS) in the database
if ($store_in == "FS") $image_data["image"] = addslashes($image_data["image"]);
db_query("REPLACE INTO $sql_tbl[thumbnails] (productid, ".($store_in == "FS"?"image_path":"image").", image_type,variantid) VALUES ('$productid', '$image_data[image]', '$image_data[image_type]','".$file_upload_data["variantid"]."')");
}
#
# Rebuild product variants
#
} elseif($mode == 'product_variants_rebuild') {
func_rebuild_variants($productid, true);
$top_message["content"] = func_get_langvar_by_name("msg_adm_product_variants_rebuilded");
$top_message["type"] = "I";
}
if(!empty($mode) && $REQUEST_METHOD=="POST" && $mode != 'return') {
func_header_location("product_modify.php?productid=$productid§ion=$section&mode=return");
}
#
# Assign the Smarty variables
#
$variants = func_get_product_variants($productid);
if(!empty($variants))
$smarty->assign("variants", $variants);
if($variantid && $variants) {
foreach($variants as $v) {
if($v['variantid'] == $variantid) {
$variant = $v;
break;
}
}
if(!empty($variant))
$smarty->assign("variant", $variant);
}
?>
They both should be the exact copy of the Mod. No change. Maybe I miss a > or somthing. But I get no error.
Let me know if you need to see any other of the modified files.
Thank you