Legosp Forum
Shop-Script "Legosp" => Дизайн и шаблоны => Тема начата: maa1988 от Октября 18, 2014, 11:53:00 am
-
Если сделать доп параметры к товарам, внести разные. Выбирает клиент... нажимает оформить заказ... А приходит заказ уже без доп параметров. Можно как то сделать, чтобы на почту хотя бы доп параметры осылалались и в отображении заказа (после оформления где печать заказа) - были подробности...Спасибо
Лего 5.0.2
Протестировал уже все... ну не приходит :(
И в корзину когда добавляешь изменения не идут :(
Посмотрел тему: http://forum.legosp.net/index.php/topic,1272.0.html - ошибок никаких не возникает.
product_detailed.php
<?php
/*****************************************************************************
* *
* Shop-Script FREE *
* Copyright (c) 2005 WebAsyst LLC. All rights reserved. *
* *
****************************************************************************/
// product detailed information view
if (isset($_POST["vote"]) && isset($productID)) //vote for a product
{
if (!isset($_SESSION["vote_completed"][ $productID ]) && isset($_POST["mark"]) && $_POST["mark"])
{
$q = db_query("UPDATE ".PRODUCTS_TABLE." SET customers_rating=(customers_rating*customer_votes+'".(int)$_POST["mark"]."')/(customer_votes+1), customer_votes=customer_votes+1 WHERE productID='".$productID."'") or die (db_error());
}
$_SESSION["vote_completed"][ $productID ] = 1;
}
if ($_POST['review'] && isset($productID))
{
if ((isset($_SESSION['cust_id']) && !isset($_POST["captcha"])) || ($_POST["captcha"] == $_SESSION["captcha"]))
{
if(isset($_POST["name"]) && isset($_POST["email"]) && isset($_POST["review"]))
{
if (!CONF_REVIEW_LINK && preg_match("#(https?|ftp)://\S+[^\s.,> )\];'\"!?]#", $_POST["review"]))
{
$jstext=PRODUCT_REVIEW_ADD_NOT_LINK;
if (DB_CHARSET!='cp1251') $jstext=win2utf($jstext);
echo "<script language=\"JavaScript\">alert('".$jstext."');</script>";
return FALSE;
}
$new_review = str_replace("\n","<br />\n",$_POST["review"]);
$new_review = preg_replace("'<script[^>]*?>.*?</script>'si","",$new_review);
$areview['productID']=(int)$productID;
$areview['username']=preg_replace("'<script[^>]*?>.*?</script>'si","",$_POST["name"]);
$areview['email']=preg_replace("'<script[^>]*?>.*?</script>'si","",$_POST["email"]);
$areview['review']=$new_review;
add_field(REVIEW_TABLE, $areview);
$smarty->assign("review_saved", "yes");
if (CONF_REVIEW_MODER)
{
$jstext=PRODUCT_REVIEW_ADD_OK_MODER;
if (DB_CHARSET!='cp1251') $jstext=win2utf($jstext);
echo "<script language=\"JavaScript\">alert('".$jstext."');</script>";
}
else
{
$jstext=PRODUCT_REVIEW_ADD_OK;
if (DB_CHARSET!='cp1251') $jstext=win2utf($jstext);
echo "<script language=\"JavaScript\">alert('".$jstext."');</script>";
}
//notification for administrator
$adm .= "\n".CUSTOMER_FIRST_NAME.": ".$_POST["name"]."\n".CUSTOMER_EMAIL.": ".$_POST["email"]."\n".PRODUCT_REVIEW_MESSAGE.":\n".$_POST["review"];
$Subj=PRODUCT_REVIEW_NOTIFICATION_SUBJECT;
if (DB_CHARSET!='cp1251')
{
$adm = win2utf($adm);
$Subj= win2utf($Subj);
}
$from['mail']=CONF_GENERAL_EMAIL;
$from['name']=CONF_SHOP_NAME;
phpmailer(CONF_GENERAL_EMAIL, $from, $Subj, $adm);
unset($_SESSION["captcha"]);
//header("Location: ".$_SERVER['HTTP_REFERER']);
$smarty->assign("main_content_template", "product_detailed.tpl.html");
}
}
}
if (isset($productID) && $productID>0)
{
$smarty->assign("main_content_template", "product_detailed.tpl.html");
$q = db_query("SELECT ".PRODUCTS_TABLE.".categoryID, ".PRODUCTS_TABLE.".name, ".PRODUCTS_TABLE.".description, customers_rating, Price, ".PRODUCTS_TABLE.".picture, in_stock, thumbnail, customer_votes, big_picture, list_price, productID, product_code, brief_description, ".PRODUCTS_TABLE.".hurl, accompanyID, ".PRODUCTS_TABLE.".meta_title, ".PRODUCTS_TABLE.".meta_keywords, ".PRODUCTS_TABLE.".meta_desc, ".PRODUCTS_TABLE.".brandID, ".BRAND_TABLE.".name, ".BRAND_TABLE.".hurl, ".PRODUCTS_TABLE.".canonical, ".CATEGORIES_TABLE.".hurl, ".BRAND_TABLE.".comment, ".PRODUCTS_TABLE.".h1 FROM ".PRODUCTS_TABLE." LEFT JOIN ".BRAND_TABLE." USING (brandID) JOIN ".CATEGORIES_TABLE." ON ".PRODUCTS_TABLE.".categoryID=".CATEGORIES_TABLE.".categoryID WHERE productID='".$productID."' and ".PRODUCTS_TABLE.".enabled='1'") or die (db_error());
$a = db_fetch_row($q);
if ($a) //product found
{
$smarty->assign("meta_title", $a[16]);
$smarty->assign("meta_keywords", $a[17]);
$smarty->assign("meta_desc", $a[18]);
$smarty->assign("rel_canonical", $a[22]);
$variant=array();
$sql2="SELECT po.* FROM ".PRODUCT_OPTIONS_TABLE." as po,".PRODUCT_OPTIONS_V_TABLE." as pov where po.`optionID`=pov.`optionID` and pov.productID=".$productID." group by po.`optionID` order by po.sort_order";
$p2=db_arAll($sql2);
foreach ($p2 as $opions)
{
$sql_v= "select ovv.variantID,ovv.name,pov.* from ".PRODUCT_OPTIONS_VAL_TABLE." as ovv,".PRODUCT_OPTIONS_V_TABLE." as pov where ovv.variantID = pov.`variantID` and ovv.optionID =".$opions['optionID']." AND pov.productID =".$productID." GROUP BY ovv.`variantID` order by ovv.sort_order";
$variant[$opions['optionID']]['var']=db_arAll($sql_v);
$variant[$opions['optionID']]['name']=$opions["name"];
$variant[$opions['optionID']]['productID']=$productID;
}
$sql_p="select picture from ".PRODUCT_OPTIONS_V_TABLE." where `default`=1 and `picture` is not NULL AND `picture` != '' and `productID`=".$productID.' LIMIT 1';
$rezult=db_query($sql_p);
$rezult=mysql_fetch_row($rezult);
$p_default=$rezult[0];
$rez=$variant;
$smarty->assign("p_default", $p_default);
$smarty->assign("options2", $rez);
//update several product fields
if (!file_exists("./products_pictures/".$a[5])) $a[5] = 0;
if (!file_exists("./products_pictures/".$a[7])) $a[7] = 0;
if (!file_exists("./products_pictures/".$a[9])) $a[9] = 0;
$a['date']=$a['26'];
$a[31] = $a[24];
$a[32] = $a[25];
$a[1]=TransformDataBaseStringToText($a[1]);
if ($a[14] == "") {$a[14] = $a[11];}
if ($a[21] != "" && CONF_CHPU) {$a[19] = REDIRECT_BRAND."/".$a[21]."about/";} else {$a[19] = "index.php?about&brands=".$a[19];}
if ($a[23] != "" && CONF_CHPU) {$a[23] = REDIRECT_CATALOG."/".$a[23]."about/";} else {$a[23] = "index.php?about&category=".$a[0];}
$a[real]=$a[4];
$a[4]=round($a[4]/CURRENCY_val,2);
$a[10]=round($a[10]/CURRENCY_val,2);
$a[24] = show_price($a[4]);
$a[25] = show_price($a[10]);
$a[26] = show_price($a[10]-$a[4]); //you save (value)
if ($a[10]) $a[27] = ceil(((($a[10]-$a[4])/$a[10])*100)); //you save (%)
#$a[29]= round($a[4]/CURR_USD); //usd
#$a[30]= round($a[4]/CURR_EUR); //eur
if (($a[6] > 0) && (CONF_SHOW_ADD2CART > 0)) {$a[28]=1;}
else
if ((CONF_SHOW_ADD2CART_INSTOCK > 0) && (CONF_SHOW_ADD2CART > 0))
{$a[28]=1;}
else {$a[28]=0;}
$smarty->assign("product_info", $a);
//calculate a path to the category
$path = array();
$curr = $categoryID;
do
{
$q = db_query("SELECT parent, name, hurl FROM ".CATEGORIES_TABLE." WHERE categoryID='".$curr."'") or die (db_error());
$row = db_fetch_row($q);
$row[1]=TransformDataBaseStringToText($row[1]);
if ($row[2] != "") {$tmp = REDIRECT_CATALOG."/".$row[2];} else {$tmp = "index.php?categoryID=".$curr;}
$curr = $row[0]; //get parent ID
$row[0] = $tmp;
$path[] = $row;
} while ($curr);
//now reverse $path
$path = array_reverse($path);
if ($a[14] !="" && CONF_CHPU) {$row[0] = REDIRECT_PRODUCT."/".$a[14];} else {$row[0] = "index.php?productID=".$a[11];}
$row[1] = $a[1];
$path[] = $row;
$smarty->assign("product_category_path",$path);
//searching reviews
$sql="SELECT * FROM ".REVIEW_TABLE." WHERE productID='".$productID."'";
if (CONF_REVIEW_MODER) $sql .=' and moder=1 ';
$sql .=" ORDER BY date_time DESC";
$q = db_query($sql) or die (db_error());
$i=0;
$reviews=array();
while ($res=mysql_fetch_row($q))
{
$reviews[$i] = $res;
$i++;
}
$smarty->assign("reviews", $reviews);
//searching accompanyID
if ($a[15])
{$ac=str_replace(" ","",$a[15]);
$ac=explode(",",$ac);
$accomp=array();
$i=0;
$s = "";
while ($i<count($ac)-1)
{ $s .= "productID=$ac[$i] OR ";
$i++;
}
$s .= "productID=$ac[$i]";
$qac = db_query("SELECT productID, categoryID, name, thumbnail, brief_description, hurl FROM ".PRODUCTS_TABLE." WHERE enabled='1' AND (".$s.")") or die (db_error());
while ($acc = db_fetch_row($qac))
{
if ($acc[5] != "" && CONF_CHPU) {$acc[5] = REDIRECT_PRODUCT."/".$acc[5];} else {$acc[5] = "index.php?productID=".$acc[0];}
$accomp[]=$acc;
}
$smarty->assign("accompany",$accomp);
}
//searching all products in category
$q = db_query("select productID, categoryID, name, thumbnail, price from ".PRODUCTS_TABLE." where categoryID='".$a[0]."' and enabled='1' ORDER BY productID ASC") or die (db_error());
$out = array();
$i=0;
while ($row = db_fetch_row($q))
{
$out[$i][0] = $row[0]; //productID
$out[$i][1] = $row[2]; //name
$out[$i][2] = $row[3]; //picture
$out[$i][3] = $row[4]/CURRENCY_val; //price
$i++;
}
$smarty->assign("product_all", $out);
$smarty->assign("product_all_count", $i);
//more product photos
$q = db_query("SELECT picture, description FROM ".THUMB_TABLE." WHERE productID='".$a[11]."'") or die (db_error());
$i=0;
while ($qe=mysql_fetch_array($q))
{
$pic[$i] = $qe["picture"];
$desc[$i] = $qe["description"];
$i++;
}
if (isset($pic))
{
$smarty->assign("product_thumb", $pic);
$smarty->assign("product_desc", $desc);
}
}
else
{
//product not found
header("Location: http://".CONF_SHOP_URL."/404/");
exit;
}
}
#$smarty->debugging = true;
?>
-
product_detailed.tpl.html
{* product detailed information view *}
<script type="text/javascript">
function urlcrt()
{literal}
{
{/literal}
return "./add2cart/{$product_info[14]}&opions=1";
{literal}
}
{/literal}
</script>
{literal}
<script language='JavaScript'>
function GetNewPrice(id,sel)
{
{/literal}
priceid='sprice'+id;
vnewprice='vnewprice'+id;
snewpic="{$product_info[5]}";
snewpic_B="{$product_info[9]}";
summ=Math.round(document.getElementById(priceid).value*100)/100;
product_option_Class="product_option_"+id;
product_option_id="product_option["+id+"]";
var array_po=getElementsByClass(product_option_Class);
for (var oi=0; oi<array_po.length; oi++)
{literal}
{
product_option_id_i=product_option_id+"["+(oi+1)+"]";
ps=document.getElementById(product_option_id_i).value.split(':')[1];
if (!ps) ps=0;
summ +=Math.round(ps*100)/100;
}
pct=document.getElementById(product_option_id_i).value.split(':')[2];
if (pct)
{
snewpic=pct+'.jpg';
snewpic_B=pct+'-B.jpg';
}
idsel='./products_pictures/'+snewpic;
idsel_B='./products_pictures/'+snewpic_B;
if (pct)
{
document.getElementById('adp'+id).href=idsel_B;
document.getElementById('dp'+id).src=idsel;
}
{/literal}
cur={$smarty.const.CURRENCY_val};
cur=Math.round(cur*1000)/1000;
summ=Math.round((summ/cur)*100)/100;
summ=currencyFormat(summ,0.01);
document.getElementById(vnewprice).innerHTML=summ;
{literal}
}
</script>
<style>
a.thumb_img {
text-decoration: none;
}
a.thumb_img img {
border: 1px solid #DDDDDD;
margin-bottom: 3px;
height: 70px;
width: 70px;
}
</style>
{/literal}
{if $product_info ne NULL}
<div class="top">
{if $smarty.session.access==3}
<a style="float: right;" id="iframe" href="admin.php?dpt=catalog&sub=products_edit&productID={$product_info[11]}" title="{$smarty.const.ADMIN_EDIT}"><img src="./images/backend/edit.png"></a>
{/if}
</div>
<div class="middle gallery"> <h1>{* $selected_category[1] *}{$product_info[32]}</h1>
<div style="width: 100%; margin-bottom: 30px;">
<table id="products" style="width: 100%; border-collapse: collapse; vertical-align: top;">
<tr>
<td style="text-align: center; width: 250px; vertical-align: top;">
{if $product_info[5] || $p_default}
<a href="./products_pictures/{if $p_default}{$p_default}-B.jpg{else}{$product_info[9]}{/if}" class="thickbox" id="adpdp{$product_info[11]}"><img src="./products_pictures/{if $p_default}{$p_default}.jpg{else}{$product_info[5]}{/if}" style="margin-bottom: 3px; border: 1px solid #DDDDDD;width: 250px;" alt="{$product_info[1]}" id="dp{$product_info[11]}" /></a><br />
<a href="./products_pictures/{if $p_default}{$p_default}-B.jpg{else}{$product_info[9]}{/if}" rel="example_group" class="thickbox"><span style="font-size: 11px;">{$smarty.const.ENLARGE_PICTURE}</span></a>
{else}
<img src="./products_pictures/nophoto.jpg" id="dp{$product_info[11]}" style="margin-bottom: 3px;width: {$smarty.const.RESIZE_NORMAL_X}px; height: {$smarty.const.RESIZE_NORMAL_Y}px" alt="{$product_info[1]}" />
{/if}
{* more image *}
{if $product_thumb[0] ne NULL}
<div style="display: inline-block;">
{section name=i loop=$product_thumb}
<div style="display: inline-block; float: left; text-align: center; margin-left: 5px; margin-right: 5px; margin-bottom: 10px;">
{*<p>{$product_desc[i]}</p>*}
<a href="./products_thumb/{$product_thumb[i]}" rel="example_group" title="{$product_desc[i]}" class="thumb_img">
<img src="./products_thumb/P_{$product_thumb[i]}" alt="{$product_desc[i]}" />
</a><br />
</a>
</div>
{/section}
</div>
{/if}
</td>
<td style="padding-left: 15px; width: 296px; vertical-align: top;">
<table style=" width: 100%; vertical-align: top;">
<tr>
<td style="vertical-align: top"><b>Производитель:</b></td>
<td><a href="./{$product_info[19]}">{$product_info[20]}</a><br /> </td>
</tr>
<tr>
<td style="vertical-align: top"><b>{$smarty.const.STRING_MODEL}:</b></td>
<td>{$product_info[1]}<br /> </td>
</tr>
{* product code *}
{if $product_info[12] ne ""}
<tr>
<td style="vertical-align: top"><b>{$smarty.const.ADMIN_PRODUCT_CODE}: </b></td>
<td>[{$product_info[12]}]<br /> </td>
</tr>
{/if}
{if $product_info[8] > 0} {* rating *}
<tr>
<td style="vertical-align: top"><b>{$smarty.const.ADMIN_PRODUCT_RATING}:</b></td>
<td>{section name=i loop=5}{if $smarty.section.i.index<$product_info[3]}<img src="./images/icon_bes.png" alt="{$smarty.section.i.index}" />{else}<img src="./images/black_star.png" alt="{$smarty.section.i.index}" />{/if}{/section} <br /> </td>
</tr>
{/if}
{assign var="id" value=$product_info[11]}
{assign var="p" value=0}
{foreach from=$options2 item=option key=key name=option}
<tr>
<td style="vertical-align: top">
<b>{$option.name}:</b>
</td>
<td>
{if count($option.var)>1}
{assign var="i" value=$i+1}
{assign var="new_price" value="0"}
<select class="product_option_{$option.productID}" onChange="GetNewPrice({$option.productID},this)" name="product_option_{$option.productID}_{$key}" id="product_option[{$option.productID}][{$i}]">
{*<option rel="0" value="">Не определено</option>*}
{foreach from=$option.var item=var}
<option {if $var.default} {assign var=p value=$p+$var.price_surplus} {assign var="newfoto" value=$var.picture} selected{/if} rel="0" value="{$var.variantID}:{$var.price_surplus}:{$var.picture}">{$var.name}{if $var.price_surplus!=0} {assign var="new_price" value="1"} ({if $var.price_surplus>0}+{/if}{math equation="x/y" x=$var.price_surplus y=$smarty.const.CURRENCY_val format="%.2f"}){/if}</option>
{/foreach}
</select>
{else}
{$option.var.0.name}
{/if}
<br>
</td>
</tr>
{/foreach}
<tr>
<td style="vertical-align: top" colspan="2">
<div {if !$new_price} style="display:none;" {/if}><br />
{$smarty.const.STRING_NEWPRICE}: <font color="red"><h3> {$smarty.const.CONF_CURRENCY_ID_LEFT}<font id="vnewprice{$id}" >{math equation="x+y/z" x=$product_info[4] y=$p z=$smarty.const.CURRENCY_val format="%.2f" assign="newsum"}{$newsum|print_price}</font>{$smarty.const.CONF_CURRENCY_ID_RIGHT} руб. </h3></font>
</div >
</td>
</tr>
<input type="hidden" id="sprice{$id}" value="{$product_info.real}">
<tr>
<td style="vertical-align: top"><b>{$smarty.const.IN_STOCK}:</b></td>
<td>{if $product_info[6] > 0}{$smarty.const.PRODUCT_IN_STOCK}{else}<font style="color: #900">{$product_info[31]}</font>{/if}<br /> </td>
</tr>
{if $product_info[10] > 0 && $product_info[10] > $product_info[4] && $product_info[4] > 0}
<tr>
<td style="vertical-align: top"><b>{$smarty.const.LIST_PRICE}: </b></td>
<td><font class="list_price">{$product_info[25]}</font></td>
</tr>
{/if}
<tr>
<td style="vertical-align: top"><b>{$smarty.const.TABLE_PRODUCT_COST}:</b></td>
<td><font class="pprice" ><span id="sum">{if $product_info[4]>0}{$product_info[24]}{else}Звоните менеджеру, чтобы узнать цену{/if} </span></font><font color="red">руб.</font></td>
</tr>
{if $product_info[10] > 0 && $product_info[10] > $product_info[4] && $product_info[4] > 0}
<tr>
<td style="vertical-align: top"> </td>
<td> </td>
</tr>
<tr>
<td style="vertical-align: top"><font class="you_save">{$smarty.const.YOU_SAVE}:</font> </td>
<td><font class="you_save_price">{$product_info[26]} ({$product_info[27]}%)</font></td>
</tr>
{/if}
</table>
<br />
{if $product_info[28] eq 1}
<div class="prod_div">
<div style="text-align: center;">
<a onclick="$('#product').submit();" id="tocart_{$product_info[11]}" href="./add2cart/{$product_info[14]}&modal=1" class="thickbox button"><img src="http://xn--h1afew7c.xn--p1ai/zakaz.jpg"></a></a>
</div>
</div>
{/if}
<br />
<script type="text/javascript" src="//yandex.st/share/share.js" charset="utf-8"></script>
<div class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir"></div>
</td>
</tr>
</table>
</div>
{if $product_info[2]}
<div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px; text-align: justify;">
{$product_info[2]}
</div>
{/if}
<br />
<table style="width: 100%;">
<tr>
<td style="width: 50%; vertical-align: top;">
{if $accompany}
<div class="page">
<div class="heading">{$smarty.const.STRING_RELATED_ITEMS}</div>
<div style="background: #F7F7F7; border: 1pxsolid #DDDDDD; padding: 5px; margin-bottom: 0px;">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
{section name=i2 loop=$accompany}
<td style="text-align: center;">
{if $accompany[i2][3]}
<a href="./{$accompany[i2][5]}"><img src="./products_pictures/{$accompany[i2][3]}" alt="{$accompany[i2][2]}" /></a>
<br />
{/if}
<a href="./{$accompany[i2][5]}">{$accompany[i2][2]}</a>
</td>
{/section}
</tr>
</table>
</div>
</div>
{/if}
</td>
</tr>
</table>
</div>
{/if}
{include file="product_last_view.html"}
{include file="last_ordered.tpl.html"}
-
Как решить ?
-
При добавлении доп. характеристик, в корзину можно отправить только один параметр из выпадающего списка, а как выбрать и добавить сразу несколько?