Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding products to cart


xiao

Recommended Posts

Posted

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.

Posted
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.

Posted

I took a look at the code, but I still can't figure it out. I'm still a PHP-rookie.

Posted
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.

Posted

I didn't even really understand your question. What part can't you figure out?

Posted

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);
}

Posted

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...