For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > December 2004 > HELP ME SHOPPING CART









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HELP ME SHOPPING CART
Daniel Hurtado Brenner

2004-12-01, 3:55 pm

Hi friends:

Excuse me my bad english. Well i have this little problem:

I am trying to modify my shopping cart to add "promotion product", this is
if you buy this product you obtain other (gift).

1. When user click "add the cart", in one "promotion product", appear in his
cart two product: his product and his gift (like was other product more). Is
is ok.
2. My problem is when the buyer want delete o remove of his cart this
promotion product. Normal is that remove automatically same time the gift.
How can i do?
3. I try but when i do remove the product, only remove the product, but no
the gift.

My code to remove product from the cart is:

if ($FORM{'action'} eq "remove_item") {

open(IN,"$customer_file");
($cart)=<IN>;
chomp($cart);
close(IN);

@product=split(/%%/,$cart);
$hit="";
foreach $product (@product) {
@item=split(/~/,$product);

$cantunit=$item[3];
$cantotal=$cantotal+$cantunit;

if ($item[0] ne $FORM{'sku'} || $hit==1) {
$output.="$product%%";
}

else {
$hit=1;
}

}

open(OUT,">$customer_file");
print OUT $output;
close(OUT);

$FORM{'action'}="view_cart";
}

Thanks for your help!!!!!

Daniel, from PERU


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com