Hi all !!!
I have modified Upselling Products module
- Added: thumbnails in products links
- Added: Add to cart
- Added: if product link has options ...
the new related_products.tpl located in ../skin1/modules/Upselling_Products :
Code:
{* $Id: related_products.tpl,v 1.7 2003/11/26 10:27:05 mAKI Exp $ *}
{if $product_links ne ""}
{capture name=dialog}
<table border=0 cellspacing=5 width="100%">
{section name=cat_num loop=$product_links}
<tr class="ItemsList">
<td align=center valign=center>
{include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=60}
</td>
<td colspan="4" align=top valign=top><hr size=1 noshade align=top>
<table border=0 cellspacing=5 width="100%">
<tr class="ItemsList">
<td colspan="3" align=top valign=top>
{$product_links[cat_num].product|escape}
</td>
</tr>
<tr>
<td colspan="2" valign=top>
{if $product_links[cat_num].price ne 0}
{if $product_links[cat_num].list_price gt 0 and $product_links[cat_num].price lt $product_links[cat_num].list_price}
{math equation="100-(price/lprice)*100" price=$product_links[cat_num].price lprice=$product_links[cat_num].list_price format="%d" assign=discount}
<font class=MarketPrice>{$lng.lbl_market_price}: <s>{include file="currency.tpl" value=$product_links[cat_num].list_price}</s></font>
{/if}
<font class=ProductPrice>{$lng.lbl_our_price}: {include file="currency.tpl" value=$product_links[cat_num].price}</font>
<font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product_links[cat_num].price}</font>
{if $product_links[cat_num].list_price gt 0 and $product_links[cat_num].price lt $product_links[cat_num].list_price}, {$lng.lbl_save} {$discount}%{/if}
{if $config.Taxes.use_vat eq "Y" and $product_links[cat_num].vat gt "0"}, {$lng.lbl_including_vat} {$product_links[cat_num].vat}%{/if}
{else}
<font class=ProductPrice>{$lng.lbl_enter_your_price}</font>
{/if}
</td>
<td colspan="3" align="right" valign=center>
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now.tpl" product=$product_links[cat_num]}
{/if}
</td>
</tr>
</table>
</td>
</tr>
{/section}
</table>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra="width=100%"}
{/if}
-------------------------------------
2003/10/12 ---> edited the code
- Added:
|escape:"html" in the $smarty's variables "add to cart"
- Removed: Showing "product prices by quantity" in list products (it showed the prices of the main article, still adding variable "product=$product_links[cat_num]" in in the call to the file buy_now.tpl ... lol
-------------------------------------
2003/11/26 ---> edited the code
- Removed "add to cart" code if $js_disabled. (this verification is made from buy_now.tpl) thanks Jon
- Removed "add to whishlist" (is added from buy_now.tpl)
- Fixed sintax error (thanks Jon)
- Fixed Link Add to Cart if product as options
-------------------------------------
2004/03/19 ---> edited the code: related_products.php
- Added Multilingual Products
- Added Fix security patch detected by X-Cart Team in all 3.4.x versions
Backup and edit ../xcart/modules/Upselling_Products/
related_products.php
to replace the original code by the following one:
Code:
<?
/*****************************************************************************\
+-----------------------------------------------------------------------------+
| X-Cart |
| Copyright (c) 2001-2003 Ruslan R. Fazliev <rrf@rrf.ru> |
| All rights reserved. |
+-----------------------------------------------------------------------------+
| PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" |
| FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE |
| AT THE FOLLOWING URL: http://www.x-cart.com/license.php |
| |
| THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE |
| THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. |
| FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING |
| AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). |
| PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT |
| CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, |
| COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY |
| (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS |
| LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS |
| AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND |
| OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS |
| AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE |
| THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.|
| THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. |
| |
| The Initial Developer of the Original Code is Ruslan R. Fazliev |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2003 |
| Ruslan R. Fazliev. All Rights Reserved. |
+-----------------------------------------------------------------------------+
\*****************************************************************************/
#
# $Id: related_products.php,v 1.9.4.1 2004/03/19 11:57:50 mAKI Exp $
#
# This Module forms list of upsailing products
#
if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); }
$membership = $user_account['membership'];
$p_cat = (empty ($cat) ? "0" : $cat);
if ($config["General"]["unlimited_products"]=="N")
$avail_condition = "$sql_tbl[products].avail>0 and ";
else
$avail_condition = "";
$product_links = func_query($search_query = "select DISTINCT $sql_tbl[products].*, $sql_tbl[categories].category, $sql_tbl[pricing].price from $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[categories], $sql_tbl[product_links] where ($sql_tbl[pricing].membership='') and ($sql_tbl[pricing].productid=$sql_tbl[products].productid) and ($sql_tbl[pricing].quantity=1) and ($sql_tbl[products].categoryid=$sql_tbl[categories].categoryid) and $sql_tbl[products].forsale='Y' and ($sql_tbl[products].productid=$sql_tbl[product_links].productid2) and ($sql_tbl[product_links].productid1='$productid') ORDER BY $sql_tbl[products].product");
if(is_array($product_links)){
foreach($product_links as $p_v => $p_k){
$int_res = '';
if(is_array($p_k)){
#
# Check if product have product options
#
$product_links[$p_v][product_options] = array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[product_options] WHERE productid='".$p_k["productid"]."'"));
#
# Replace descr and fulldescr on international (if defined)
#
$int_res = func_query_first("SELECT * FROM $sql_tbl[products_lng] WHERE code='$store_language' AND productid='".$p_k['productid']."'");
if ($int_res["product"]){
$product_links[$p_v]["product"] = stripslashes($int_res["product"]);
}
if ($int_res["descr"]){
$product_links[$p_v]["descr"] = str_replace("\n","
", stripslashes($int_res["descr"]));
}
if ($int_res["full_descr"]){
$product_links[$p_v]["fulldescr"] = str_replace("\n","
", stripslashes($int_res["full_descr"]));
}
}
}
};
$smarty->assign("product_links",$product_links);
?>
-------------------------------------
suggestions and corrections well will be received :)
greetings !!!