Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Add multiple products to cart

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #31  
Old 01-01-2005, 07:16 PM
  eaglemobiles's Avatar 
eaglemobiles eaglemobiles is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 167
 

Default 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
__________________
X-Cart Gold 4.3.2
X-Cart Gold 4.4.1
Unix

High Quality CCTV DVRs & Cameras
http://www.eaglemobiles.co.uk/CCTV
Reply With Quote
  #32  
Old 01-05-2005, 01:17 PM
 
cellula cellula is offline
 

Newbie
  
Join Date: Nov 2004
Location: USA
Posts: 9
 

Default 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
__________________
Yours Truly,
Cellula
X-Cart Version 4.0.x
Reply With Quote
  #33  
Old 01-05-2005, 06:03 PM
  eaglemobiles's Avatar 
eaglemobiles eaglemobiles is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 167
 

Default Re: Add multiple products to cart

Is it working in xcart 4.0.9

Thanks in advance for reply
__________________
X-Cart Gold 4.3.2
X-Cart Gold 4.4.1
Unix

High Quality CCTV DVRs & Cameras
http://www.eaglemobiles.co.uk/CCTV
Reply With Quote
  #34  
Old 01-25-2005, 12:24 PM
 
haopang haopang is offline
 

Newbie
  
Join Date: Jan 2005
Posts: 1
 

Default

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.
__________________
X-CART 4.0.9
X-PConfig
X-AOM
X-RMA
Reply With Quote
  #35  
Old 02-05-2005, 04:14 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

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
__________________
4.1.9
Reply With Quote
  #36  
Old 02-08-2005, 02:24 PM
 
instinctual instinctual is offline
 

eXpert
  
Join Date: Nov 2003
Posts: 247
 

Default

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
Reply With Quote
  #37  
Old 02-08-2005, 02:42 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

I just PM'd you ...

- Mike
__________________
4.1.9
Reply With Quote
  #38  
Old 05-20-2005, 11:54 AM
 
shiehshieh shiehshieh is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 85
 

Default

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.
__________________
Cheers,
Tom
X-Cart v4.1.9 PRO

Boba Tea Direct
"Your source for bubble tea, boba, coffee, tea, chai, and more"
www.bobateadirect.com

Hevla Coffee Co
Freshest roast-to-order low acid coffee
www.hevlacoffeeco.com
Reply With Quote
  #39  
Old 06-20-2005, 08:49 AM
 
Mary Jo Robins Mary Jo Robins is offline
 

Advanced Member
  
Join Date: Aug 2003
Location: Virginia Beach, VA 23462
Posts: 87
 

Default I am interested too

It would be nice to offer a one click "add to cart" button
__________________
X-Cart version 4.0.14
Sales-n-Stats 1.1 build 36
PHP 5.0.5
MySQL server 4.1.22-Standard
Perl 5.008
Reply With Quote
  #40  
Old 06-20-2005, 12:52 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

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
__________________
4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:42 PM.

   

 
X-Cart forums © 2001-2020