X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Add multiple products to cart (https://forum.x-cart.com/showthread.php?t=7207)

funkydunk 04-19-2004 07:18 AM

Add multiple products to cart
 
As it is my birthday tomorrow :) (cakes appreciated)

Here is a little mod that allows you to run the product listing page as an order form where the visitor can add in amounts for several products at a time and have them all added to the cart simultaeneously.

First of all create a new php script in customer: 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");


#
# $order_secureid (for security reasons)
#

x_session_register("order_secureid");


#
# Loop through products and add to cart
# code taken from cart.php

if ($amount) {
foreach ($amount as $key=>$value) {

$productid = $key;
$amount = $value;


        $added_product = func_select_product($productid, (!empty($user_account['membership'])?$user_account['membership']:""), false, true);
        $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?minimum_amount");
                }

#
# Do addition to cart
# With options
#
                $options=array();

                if(!empty($product_options)) {
               
                        if (is_array($product_options))
                                foreach($product_options as $key=>$product_option)
                                        $product_options[$key] = stripslashes($product_option);

                        if ($active_modules["Product_Options"])
                                func_check_product_options ($productid, $product_options);
               
                        foreach($product_options as $key=>$product_option)
                                $options[]=array("optclass"=>$key,"optionindex"=>$product_option);
                }

                $found = false;
                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"] == $options) && empty($v["hidden"])) {
                                        $found = true;
                                        $distribution = array_pop(func_query_first("select distribution from $sql_tbl[products] where productid='$productid'"));
                                        if (($cart["products"][$k]["amount"] >=1) && ($distribution))               
                                                {$cart["products"][$k]["amount"]=1; $amount=0;}
                                        $cart["products"][$k]["amount"] += $amount;
                                }
                        }
                }
               
                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"]);
                        $cart["products"][]=array("cartid"=>$cartid, "productid"=>$productid,"amount"=>$amount, "options"=>$options, "free_price"=>@price_format(@$free_price));

                        if(!empty($active_modules["Product_Configurator"]))
                                include $xcart_dir."/modules/Product_Configurator/pconf_customer_cart.php";
                }

               
                $intershipper_recalc = "Y";

        }
       

}


} // end of loop to add all products to the cart


#
# Redirect
#
/*
if($mode=="add" and $productid) {
        if($config["General"]["redirect_to_cart"]=="Y")
                func_header_location("cart.php");
        else
                func_header_location("home.php?cat=$cat&page=$page");
}
*/

func_header_location("cart.php");

x_session_save();

$smarty->display("customer/home.tpl");

?>


Then create two language fields:
err_minimum_amount
err_minimum_amount_txt

These will be shown at the top of the error page that is shown if the user does not order enough of something as follows:

Then create a new template in skin1/main/minimum_amount.tpl :
Code:

{* minimum_amount.tpl - funkydunk 2004 *}
{ include file="location.tpl" last_location=$lng.err_minimum_amount}
{$lng.err_minimum_amount_txt}


Then amend skin1/common_templates.tpl by inserting:

Code:

{* new funkydunk *}
{elseif $main eq "minimum_amount"}
{include file="main/minimum_amount.tpl"}
{* end *}


before the final {else}

Then amend the products.tpl and products_t.tpl as follows:
(this is the code for products.tpl without images but you can get the idea from this :)

Code:

{* $Id: products.tpl,v 1.36 2003/11/11 14:02:37 svowl Exp $ amended by funkydunk 2004 *}
{if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")}
{include file="customer/main/products_t.tpl" products=$products}
{else}
{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>
</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">{include file="currency.tpl" value=$products[product].price}</td>
<td valign="top" width="80" class="listrow" align="center"><a href=product.php?productid={$products[product].productid}>[img]{$ImagesDir}/info.gif[/img]</a></td>
<td valign="top" width="100" class="listrow" align="center">
{if ($active_modules.Product_Options ne "" and $products[product].product_options)}
{else}
<input type="text" size="4" maxlength="10" name="amount[{$products[product].productid}]" value="0">
{/if}
</td>
</tr>
{/section}
<tr>
<td valign="top" colspan="4" align="right">
{if $js_enabled}
{include file="buttons/button.tpl" button_title="ADD ALL TO CART" style="button"}
{else}
{include file="submit_wo_js.tpl" value="ADD ALL TO CART"}
{/if}

</td>
</tr>
</table>
</form>


{else}
{$lng.lbl_no_products_found}
{/if}
{/if}



There are a few style sheets references in there that aren't standard but you should be able to get it working.

PLEASE NOTE THAT YOU SHOULD BACKUP BEFORE DOING ANY MODS FROM THE FORUM.


This was built for version 3.5.x gold but should work on Pro and may even work on 3.4 shops.

Have fun :wink:

lyncca 04-19-2004 08:31 AM

Thats really cool :) I wonder if I can find use for this somewhere!

But you know, on your birthday you aren't supposed to work :) or even the day before for that matter!

Have a great birthday \:D/

funkydunk 04-19-2004 08:45 AM

day before is fine - the day after is the problem 8) :-({|=

lyncca 04-19-2004 08:53 AM

:lol:

I think I would have to agree with you there.

B00MER 04-19-2004 09:55 AM

Funkydunk, happy b-day, this code work with product options? :)

funkydunk 04-19-2004 10:50 AM

it wont display the amount box if there are any if that is what you mean

jeeya 04-19-2004 04:08 PM

Good Code! Happy B-Day Funky! What About Cake on B-Day?

shan 04-20-2004 01:56 AM

Happy Birthday Mate,

21 today eh :wink:

Make sure you have a day off :idea:

funkydunk 04-20-2004 03:15 AM

day off :?

moving to new offices today :)

funkydunk 04-20-2004 03:16 AM

Quote:

Originally Posted by raxitpatel
Good Code! Happy B-Day Funky! What About Cake on B-Day?

yeah cakes can be sent to me if you really want :LOL

lyncca 04-20-2004 06:30 AM

HAPPY BIRTHDAY TO YOU! http://www.pixelitas.com/forum/images/smiles/beerchug.gif

Heh... I had to bring in one of the smilies from my forum :)

adpboss 04-20-2004 01:46 PM

Congrats FD. Nice code... :D

jeeya 04-20-2004 06:58 PM

I though birthday boy suppose get us a Cake :oops:

also anyone tried this Code? Like to see in action.

carlisleglass 04-21-2004 06:45 AM

Thanks for the coding ... any one fancy a seek ... click on the link in my signature.

adpboss 04-21-2004 06:50 AM

Carlisle Glass looks great. Super nice site. I love this multi-add to cart feature.

:D

rackit 04-25-2004 03:38 PM

Great mod, funkydunk. With a little bit of modification, it fit a project I was working on perfectly. Thanks.

grimscot 04-26-2004 02:47 PM

popup thumbnail
 
Thanks funkydunk I was about to add this feature to a site I was working on, you saved me a bit of time.

I have taken your code and added a few other bits like adding a stripe to the list to make it easier to read in large product list and I have also added a bit of javascript to popup the thumbnail of the product if you put your mouse over the info image.

I am sure my code can be improved but I thought that I would post my mods here since Funkydunk was kind enough to share the original code.

This was the modification I made to the products.tpl template :- At the top I added the following javascript:

Code:

{* $Id: products.tpl,v 1.36 2003/11/11 14:02:37 svowl Exp $ amended by funkydunk 2004 *}
{literal}
<script>

PositionX = 100;
PositionY = 100;
defaultWidth  = 100;
defaultHeight = 100;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}

function popupThumb(imageURL,imageTitle){

        var posx = 0;
        var posy = 0;
        if (!e) var e = window.event;
        if (e.pageX || e.pageY)
        {
                posx = e.pageX;
                posy = e.pageY;
        }
        else if (e.clientX || e.clientY)
        {
                posx = e.clientX;
                posy = e.clientY;
                if (isIE)
                {
                        posx += document.body.scrollLeft+20;
                        posy += document.body.scrollTop;
                }
        }

var optIE='scrollbars=no,width=100,height=100,left='+posx+',top='+posy;
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+posx+',top='+posy;

if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');     
writeln('window.innerWidth=document.images["plant"].width;');writeln('window.innerHeight=document.images["plant"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');

writeln('[img]+imageURL+[/img]</body></html>');
close();               
}}

</script>
{/literal}



To get the stripe add the code on line three of the following:

Code:

{section name=product loop=$products}

{counter assign="row"}
<tr {if $bg eq ""}{assign var="bg" value="1"} bgcolor="#FFFFFF"{else}{assign var="bg" value=""} bgcolor="#EEEEEE"{/if}>



Then to open the thumbnail image on mouse over change the line

Code:

<td valign="top" width="80" class="listrow" align="center"><a href=product.php?productid={$products[product].productid}>[img]{$ImagesDir}/info.gif[/img]</td>

As you might of noticed from the code above this works with the thumbnail images outside of the database and with the images named after the productcode. Unfortunately I haven't got the time just now to make this more generic as I have other modification I need to make for the site I am working on but hopefully this might come in useful for somebody.

xcell67 05-02-2004 06:41 PM

hi,
i couldn't get this to work on 3.4.14, anyone else have any luck?

Also, instead of have them choose the quanities and clicking on submit, is it possible to include a checkbox and then have them click on submit?

carlisleglass 05-04-2004 02:21 AM

you could have a dropdown box which only has 0 and 1 in it ... so instead of clicking a checkbox, you should change the dropdown box from 0 to 1.

xcell67 05-10-2004 07:14 PM

it looks like the major function behind this mod is:

Code:

if ($amount) {
foreach ($amount as $key=>$value) {

$productid = $key;
$amount = $value;


What would I have have to sub in in order for it to be able to add multiple wishlist items?

Thanks

mattia 06-04-2004 09:56 AM

error on mod
 
hi, forgive me, i'm still kinda new at this:

I tried to follow you guidelines:
created the PHP file,
created the lang files as errors fields,
amended the TPL and created skin1/main/minimum_amount.tpl,
amended customer/main/products.tpl
(coudn't understand how to modity products_t.tpl, so I left it as it was)

and I can see how the product list page now shows a different kind of list with the qty boxes, but once I click on "add all to cart" I get this message:

Quote:

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache2\Apache2\htdocs\farm\xcart\customer\a dd_multiple in C:\Program Files\Apache2\Apache2\htdocs\farm\xcart\customer\r eferer.php on line 55

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache2\Apache2\htdocs\farm\xcart\customer\a dd_multiple in C:\Program Files\Apache2\Apache2\htdocs\farm\xcart\include\fu nc.php on line 197



thanks for this useful mod, it really makes shopping much quicker for those customers who know what they want. If only I could get it to work...

matt

bluecobalt 08-04-2004 11:14 PM

i installed this mod on 3.5.10 gold and am getting the following error:

Parse error: parse error, unexpected T_STRING in add_multiple.php on line 35

any ideas on how to fix this?

thanks,
blue

funkydunk 08-04-2004 11:34 PM

This would normally mean that a ; has been missed from the end of line 35. PHP is pretty good for telling you where the problem is.

manasarova 08-05-2004 12:03 AM

How do you create a php file
 
I'd love to try this.
but how do i begin creating a php file.
I am a newbie, but with a bit of help, i can get started.
Thanks

GM 08-05-2004 06:02 AM

Just copy the code to notepad or whatever text editor you use then save it as: add_multiple.php

Freakmode 08-17-2004 08:55 AM

Hi Funky

I could really do with this working with a 4.02 site. Do you think it would without too much trouble?

stmart 10-20-2004 01:22 AM

I believe I copied the instructions to the letter but when i open up the site it is blank. Any ideas?

cellula 12-08-2004 06:39 AM

?????????
 
"Then amend the products.tpl and products_t.tpl as follows:
(this is the code for products.tpl without images but you can get the idea from this"


I dont get it do we replace it with that code below or just add it into it im so lost please help me.
also i am confused about the language files are they .tpl or what sorry im a noobie :D
[/code]

adpboss 12-08-2004 06:44 AM

Re: ?????????
 
Quote:

Originally Posted by cellula
"Then amend the products.tpl and products_t.tpl as follows:
(this is the code for products.tpl without images but you can get the idea from this"


I dont get it do we replace it with that code below or just add it into it im so lost please help me.
also i am confused about the language files are they .tpl or what sorry im a noobie :D
[/code]


No problem that you are a newbie, but please take the time to read the forum rules and stickies. You should have your version # in your signature. It is a guessing game trying to help you otherwise and many people will ignore your post.

cellula 12-08-2004 11:46 AM

Sorry about that, will you PM me a breakdown of what to do or actually do it for me please i love this mod and it would be very beneficial to me thanks.

eaglemobiles 01-01-2005 07:16 PM

Re: Add multiple products to cart
 
hi,

Do you mean the mini cart can show the number of product and the details of product

thanks

XCART 4.0.9

cellula 01-05-2005 01:17 PM

HELP!
 
Will some please help me set this up i keep getting so many errors and i am getting mad. lol Thanks ahead of time

eaglemobiles 01-05-2005 06:03 PM

Re: Add multiple products to cart
 
Is it working in xcart 4.0.9

Thanks in advance for reply

haopang 01-25-2005 12:24 PM

I tried add the code to my related product tpl.

The only thing found is the submit button does not work.

I changed code from:
Code:

{if $js_enabled}
<a href="javascript: document.orderform.submit()">
{include file="buttons/button.tpl" button_title="ADD ALL TO CART" style="button"}
</a>
{else}
{include file="submit_wo_js.tpl" value="ADD ALL TO CART"}
{/if}


to Code :

Code:

{if $js_enabled}
{include file="buttons/button.tpl" button_title="ADD ALL TO CART" style="button" href="javascript: document.orderform.submit()"}
{else}
{include file="submit_wo_js.tpl" value="ADD ALL TO CART"}
{/if}


Now the submit is working.

Looks like the original submit code can not pass the href to the button.tpl

My X-Cart version is 4.0.9, I did it in "related_products.tpl" and has some other changes to "related_products.tpl ". So the customer can fill the qty for each related product and add them to cart by one click.

mffowler 02-05-2005 04:14 PM

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

instinctual 02-08-2005 02:24 PM

Hi Mike - I would split the cost of doing this with you - who is going to do it?

Need it to be able to allow user to select options and qty on multiple products, and add to cart with one click.

Lemme know - PM if you're interested - let's get it started!



Instinctual
Colorado
X-Cart Versions 3.5.x - 4.0.x

mffowler 02-08-2005 02:42 PM

I just PM'd you ...

- Mike

shiehshieh 05-20-2005 11:54 AM

Hey I'm interested too!

I currently have 4.0.6, but will soon upgrade to 4.0.13. Please let me know how I can get in on this.

Mary Jo Robins 06-20-2005 08:49 AM

I am interested too
 
It would be nice to offer a one click "add to cart" button

mffowler 06-20-2005 12:52 PM

If you PM me, I can show you a link where we have implemented a multiple product orderding page. It offers an "Add all to Cart" from the many options.

- Mike


All times are GMT -8. The time now is 04:09 PM.

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