xiao Posted April 4, 2008 Posted April 4, 2008 Hi, I'm writing a PHP script for a project for school. It's a PC-configurator which will be implemented in a osCommerce shop. I was wondering if there's a osCommerce function I can use to add products to the user's cart. And where I can find the function and how I have to use it. Thanks in advance.
Guest Posted April 5, 2008 Posted April 5, 2008 Hi, I'm writing a PHP script for a project for school. It's a PC-configurator which will be implemented in a osCommerce shop. I was wondering if there's a osCommerce function I can use to add products to the user's cart. And where I can find the function and how I have to use it. Thanks in advance. Check out the contributions area for custom pc creater. It may give you an idea.
xiao Posted April 6, 2008 Author Posted April 6, 2008 I took a look at the code, but I still can't figure it out. I'm still a PHP-rookie.
Guest Posted April 6, 2008 Posted April 6, 2008 I took a look at the code, but I still can't figure it out. I'm still a PHP-rookie. Well, you have to start somewhere.
Guest Posted April 6, 2008 Posted April 6, 2008 I didn't even really understand your question. What part can't you figure out?
xiao Posted April 7, 2008 Author Posted April 7, 2008 I would like to use an osCommerce function in a loop, to add a bunch of products to the cart. I want to use this function on a page outside of osCommerce (I can include pages). I was wondering what function to use and how to use it. (and what variables I need to be able to add products to cart) Edit: I found something. Would this work? require('includes/application_top.php'); $ids = array(21,656,8962); foreach ($ids as $id){ $cart->add_cart($id, $cart->get_quantity((int)$id)+1); }
xiao Posted April 8, 2008 Author Posted April 8, 2008 A little update. If I use this it works: require('includes/application_top.php'); $ids = array(1,4,18,23); foreach ($ids as $id){ $cart->add_cart($id, $cart->get_quantity((int)$id)+1); } tep_redirect(tep_href_link('shopping_cart.php')); But it doesn't work if I don't redirect to the shop. Is there a way to make it work without redirecting the user?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.