| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
adding free items to cart | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() Hello,
I am offering free items in my store and I'd like these free items to be AUTOMATICALLY added to a customers shopping cart when they add ANY item to their shopping cart. i.e if a customer wants to buy a xbox game, i'd like the free xbox game that i'm offering to be added automatically to his/her shopping cart. Does anyone has a code to help me do this? I'd appreciate your help on this matter. Thanks
__________________
Tosin : Using X-Cart Gold, Version 4.0.9 |
|||||||
#2
|
|||||||
|
|||||||
![]() I don't know the exact code to do it, but I would assume that on the detail page of the product, you could put some other hidden inputs so that you were adding the other product to the cart at the same time in the background.
That make sense? Poke around a bit on the detail product tpl - skin1/customer/main/product.tpl - and see if you can get some hidden inputs going in there. Hope that helps!
__________________
Instinctual 8,000 feet up in the Rocky Mountains of Colorado X-Cart Versions 3.5.x - 4.0.x IF you xcart, THEN you prosper, ELSE you fail. ELSEIF xcart fails, THEN you fix it, all the WHILE {loop}\'ing {section}\'s to feed your $smarty mind. |
|||||||
#3
|
|||||||
|
|||||||
![]() Here is a nice mod that I used to solve this problem. Doesn't automatically add the item to the cart, but it still works well:
http://forum.x-cart.com/viewtopic.php?t=18380
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#4
|
|||||||
|
|||||||
![]() I had the same situation you had. I wanted to automatically add free items to each user's shopping cart. I am running version 4.0.12. Here is the reply I got from tech support. Hope it helps.
Please perform following steps : 1. Open '<xcart_root_dir>/cart.php' file. 2. Replace : Code:
Code:
For example : -- if ($productid<>16126) func_header_location($xcart_catalogs['customer']."/cart.php?mode=add&productid= 16126&amount=1"); -- -- |
|||||||
#5
|
|||||||||
|
|||||||||
![]() Thanx for sharing.
__________________
Dongan MercuryMinds Technologies Professional X-Cart Design, X-Cart Development, X-Cart Customization Services www.mercuryminds.com Follow us at Facebook / Twitter |
|||||||||
#6
|
|||||||
|
|||||||
![]() Quote:
Im trying to get this working on 4.0.14 and its not adding the item to the cart and causing the cart to freeze at points, does anyone know what the updated code would be for my version, thanks in advance.
__________________
xcart version 4.1.6 UK - Brighton QVS ELECTRICAL SUPPLIES - http://www.qvsdirect.com We supply a huge range of cables, electrical accessories, heating, ventilation, fire and security products, consumer units & circuit distribution, indoor and outdoor lighting, showers and water heating, tools and fixings, timer switches, sockets, switches, air conditioning, trunking, and much much more. |
|||||||
#7
|
|||||||
|
|||||||
![]() Really appreciate some help on this one as well
Anyone!
__________________
x-cart 4.0.14 (unix) |
|||||||
#8
|
|||||||||
|
|||||||||
![]() 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:
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. |
|||||||||
#9
|
|||||||||
|
|||||||||
![]() Quote:
You need to remove the space before the product number. |
|||||||||
#10
|
|||||||
|
|||||||
![]() Quote:
Quote:
Bill - I cannot thank you enough for solving that one for us! Just 2 questions:- The most important one is how can you limit the free product qty to 1 item only regardless of how many products are put in the cart (the code above adds a free item every time a product is added but our store is giving a free gift per order made not per product. Is there code that could be added that checks that the cart has a product in it (other then the free one). At the moment if someone puts a product in the cart the code above adds the free item (or whatever item specified) to the cart, but if the original item is then deleted from the cart , this free item remains there. Is there a bit of code that can check for this? As it is the item I am specifing is a free item and the cart will not allow a checkout with a subtotal of $0.00 but if this code was straight forward it would be nice. Many thanks Simon
__________________
x-cart 4.0.14 (unix) |
|||||||
|
|||
X-Cart forums © 2001-2020
|