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



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to