View Single Post
  #8  
Old 09-06-2006, 06:43 AM
  wjbrewer's Avatar 
wjbrewer wjbrewer is offline
Banned
 

X-Adept
  
Join Date: Feb 2005
Location: Pittsburgh, PA
Posts: 504
 

Default Re: adding free items to cart

The above code will add the free product to every order. If you just want free products with other specific products use this:

PHP Code:
if ($productid == %ID%)
func_header_location($xcart_catalogs['customer']."/cart.php?mode=add&productid=%FREEID%&amount=1"); 

For example: If someone purchases productid 5 (and X-Box), it will automatically add productid=20 (a free game).

The bad thing about this code is that you will have to add these lines for every product that you want to have a freebee with. A better way would be to add a field to the database called free_products and then check for every added product is there is a freebee. But this way will work.
Reply With Quote