Has anyone been able to get this mod to work in 4.x and has an example? I can get it to show up in the products_t.tpl, but my price and product options don't show up.
If anyone can see what needs to be changed or configured to get this to work for 4.0.11, I would be grateful! Also, if anyone needs this mod done, we could always split the $150 wanted to have it coded???
- Mike
Here's my amended add_multiple.php:
Code:
<?php
// add_multiple.php funkydunk 2004
require "./auth.php";
include $xcart_dir."/shipping/shipping.php";
//include "./nocookie_warning.php";
x_session_register("cart");
x_session_register("intershipper_rates");
x_session_register("intershipper_recalc");
x_session_unregister("secure_oid");
x_session_register("extended_userinfo");
x_session_register("anonymous_checkout");
x_session_register("payment_cc_fields");
x_session_register("current_carrier","UPS");
$intershipper_recalc = "Y";
x_session_register("arb_account_used");
x_session_register("airborne_account");
function check_payment_methods($membership) {
global $sql_tbl, $config, $cart;
$gc_condition = ((@empty($cart["products"]) && @!empty($cart["giftcerts"]))?" AND pm.paymentid != 14 ":"");
$payment_methods=func_query("select pm.*,cc.module_name,cc.processor,cc.type from $sql_tbl[payment_methods] as pm left join $sql_tbl[ccprocessors] as cc on pm.paymentid=cc.paymentid where pm.active='Y' AND (pm.membership='' OR pm.membership='$membership') $gc_condition order by pm.orderby");
$payment_methods = test_payment_methods($payment_methods,($config["General"]["hide_disfunctional_payments"]=="Y"));
return $payment_methods;
}
#
# $order_secureid (for security reasons)
#
x_session_register("order_secureid");
if ($mode == "clear_cart") {
if(!empty($active_modules['SnS_connector']) && !empty($cart['products'])) {
foreach($cart['products'] as $p) {
func_generate_sns_action("DeleteFromCart", $p['productid']);
}
}
$cart = "";
func_header_location("cart.php");
}
#
# Add to cart
#
if($mode=="add" && $productid!="") {
$added_product = func_select_product($productid, (!empty($user_account['membership'])?$user_account['membership']:""), false, true);
if ($added_product["forsale"] == "B") {
$top_message["content"] = func_get_langvar_by_name("txt_pconf_product_is_bundled");
$top_message["type"] = "W";
func_header_location($HTTP_REFERER);
}
if(!empty($active_modules['Egoods']) && !empty($added_product['distribution'])) {
$amount = 1;
}
$amount = abs(intval($amount));
#
# Add to cart amount of items that is not much than in stock
#
if ($config["General"]["unlimited_products"]=="N" && $added_product["product_type"]!="C")
if ($amount > $added_product["avail"])
$amount = $added_product["avail"];
if ($productid && $amount) {
if ($amount < $added_product["min_amount"]) {
func_header_location ("error_message.php?access_denied&id=31");
}
$found = false;
$product_distribution = func_query_first_cell("SELECT distribution FROM $sql_tbl[products] WHERE productid='$productid'");
if (!empty($cart) and @$cart["products"] and $added_product["product_type"]!="C") {
foreach ($cart["products"] as $k=>$v) {
if (($v["productid"] == $productid) && (!$found) && ($v["options"] == $product_options) && empty($v["hidden"])) {
if ((float)$v["free_price"] != $price)
continue;
$found = true;
if (($cart["products"][$k]["amount"] >=1) && !empty($product_distribution)) {
$cart["products"][$k]["amount"]=1;
$amount=0;
}
$cart["products"][$k]["amount"] += $amount;
if(!empty($active_modules['SnS_connector']))
func_generate_sns_action("AddToCart");
}
}
}
if (!$found) {
#
# Add product to the cart
#
if (!empty($price))
# price value is defined by customer if admin set it to '0.00'
$free_price = abs(doubleval($price));
$cartid = func_generate_cartid($cart["products"]);
if(empty($cart["products"]))
$add_to_cart_time = time();
$cart["products"][]=array("cartid"=>$cartid, "productid"=>$productid,"amount"=>$amount, "options"=>$product_options, "free_price"=>@price_format(@$free_price),"distribution"=>$product_distribution);
if(!empty($active_modules['SnS_connector']))
func_generate_sns_action("AddToCart");
if(!empty($active_modules["Product_Configurator"]))
include $xcart_dir."/modules/Product_Configurator/pconf_customer_cart.php";
}
$intershipper_recalc = "Y";
} elseif($from == 'partner' && $productid) {
func_header_location($xcart_catalogs['customer']."/product.php?productid=".$productid);
}
}
#
# Do addition to cart with options
#
if($active_modules["Product_Options"]) {
if (!empty($product_options)) {
if(!func_check_product_options ($productid, $product_options)) {
if (!empty($active_modules["Product_Configurator"]) and $added_product["product_type"] == "C")
func_header_location("pconf.php?productid=$productid&err=options");
else
func_header_location("product.php?productid=$productid&err=options");
}
} else {
$product_options = func_get_default_options($productid, $amount, @$user_account['membership']);
if($product_options === false) {
func_header_location ("error_message.php?access_denied&id=30");
} elseif($product_options === true) {
$product_options = "";
unset($product_options);
}
}
$variantid = func_get_variantid($product_options);
if(!empty($cart['products']) && !empty($variantid)) {
$added_product["avail"] = func_get_options_amount($product_options, $productid);
foreach($cart['products'] as $k => $v) {
if($v['productid'] == $productid) {
if($variantid == func_get_variantid($v['options'])) {
$added_product["avail"] -= $v['amount'];
}
}
}
}
}
#
# Redirect
#
if($mode=="add" and $productid) {
if($config["General"]["redirect_to_cart"]=="Y") {
func_header_location("cart.php");
} else{
if(!empty($HTTP_REFERER)) {
func_header_location($HTTP_REFERER);
} else {
func_header_location("home.php?cat=$cat&page=$page");
}
}
}
func_header_location("cart.php");
x_session_save();
$smarty->display("customer/home.tpl");
?>
And my products_t.tpl which so far shows the product name and qty. without the price and product options:
Code:
{if $products}
<form action="add_multiple.php" method ="post" name="orderform">
<table border="0" width="100%" cellpadding="2" cellspacing="0" align="center">
<tr>
<td valign="top" class="headerrow">Product</td>
<td valign="top" width="80" class="headerrow" align="right">Price</td>
<td valign="top" width="80" class="headerrow" align="center">Info</td>
<td valign="top" width="100" class="headerrow" align="center">Quantity</td>
<td valign="top" width="100" class="headerrow" align="center">Options</td>
</tr>
{section name=product loop=$products}
{counter assign="row"}
<tr>
<td valign="top" class="listrow"><a href=product.php?productid={$products[product].productid}>{$products[product].product}</a>
{if $products[product].min_amount gt 1}
<FONT class=small>({$lng.txt_need_min_amount} {$products[product].min_amount} {$lng.lbl_items})</FONT>{/if}
</td>
<td valign="top" width="80" class="listrow" nowrap align="right">
{if $product.taxed_price ne 0 || $variants ne ''}
<FONT class="ProductDetailsTitle"><SPAN id="product_price">{include file="currency.tpl" value=$product.taxed_price}</SPAN></FONT><FONT class="MarketPrice"> <SPAN id="product_alt_price">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.taxed_price}</SPAN></FONT>
{if $product.taxes}
{include file="customer/main/taxed_price.tpl" taxes=$product.taxes}{/if}
{/if}
</td>
<td valign="top" width="80" class="listrow" align="center">
<a href=product.php?productid={$products[product].productid}>More Info</a></td>
<td valign="top" width="100" class="listrow" align="center">
{if $product.min_amount gt 1}
<FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>{/if}
{if $config.General.unlimited_products eq "N" and ($product.avail le 0 or $product.avail lt $product.min_amount) and $variants eq ''}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
var min_avail = 1;
var avail = 0;
var product_avail = 0;
</SCRIPT>
{$lng.txt_out_of_stock}
{else}
{if $config.General.unlimited_products eq "Y"}
{math equation="x+1" assign="mq" x=$config.Appearance.max_select_quantity}
{else}
{math equation="x/y" x=$config.Appearance.max_select_quantity y=$product.min_amount assign="tmp"}
{if $tmp<2}
{assign var="minamount" value=$product.min_amount}
{else}
{assign var="minamount" value=0}
{/if}
{math equation="min(maxquantity+minamount, productquantity)+1" assign="mq" maxquantity=$config.Appearance.max_select_quantity minamount=$minamount productquantity=$product.avail}
{/if}
{if $product.distribution eq ""}
{if $product.min_amount le 1}
{assign var="start_quantity" value=1}
{else}
{assign var="start_quantity" value=$product.min_amount}
{/if}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
var min_avail = {$start_quantity|default:1};
var avail = {$mq|default:1}-1;
var product_avail = {$product.avail|default:"0"};
</SCRIPT>
<SELECT id="product_avail" name="amount"{if $active_modules.Product_Options ne ''} onchange="check_wholesale(this.value);"{/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="ProductDetailsTitle">1</FONT><INPUT type="hidden" name="amount" value="1"> {$lng.txt_product_downloadable}
{/if}
{/if}
</td>
<td valign="top" width="100" class="listrow" align="center">
{if $active_modules.Product_Options ne ""}
{ include file="modules/Product_Options/customer_options.tpl"}
{/if}
</td>
</tr>
{/section}
<tr>
<td valign="top" colspan="5" align="right">
<INPUT type="hidden" name="mode" value="add">
{if $variants eq ''}
{include file="customer/main/product_prices.tpl"}
{/if}
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}
{if $js_enabled}
{if $smarty.get.pconf ne ""}
<INPUT type="hidden" name="slot" value="{$smarty.get.slot}">
<INPUT type="hidden" name="addproductid" value="{$product.productid}">
{include file="buttons/button.tpl" button_title=$lng.lbl_pconf_add_to_configuration style="button" href="javascript:if (FormValidation()) `$ldelim`document.orderform.productid.value='`$smarty.get.pconf`';document.orderform.action='pconf.php';document.orderform.submit()`$rdelim`"}
{/if}
{if $product.forsale ne "B"}
{include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"}
{/if}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart}
{/if}
{/if}
</td>
</tr>
</table>
</form>
{else}
{$lng.lbl_no_products_found}
{/if}
{if $active_modules.Product_Options ne '' && $product_options ne ''}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
check_options();
</SCRIPT>
{/if}
Thanks,
- Mike