Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Inserting product, in session or db? please help


jung

Recommended Posts

Hello all.

 

Im developing a payment module for OsCommerce, but im running into a few question, IMHO im a php programmer for years but the code looks like tsunami powered. :-"

 

now that's out of the way i have a question:

 

I'm looking for a way to register a product directly via a link or header refresh. I look and tried to insert a product into the db basket table, and yeah that goed fine. But i have the feeling it is put into a session first? beacuse no matter how many refreshes it does not show up after loggin out/in. very confusing that code.

 

so, simple me needs one thing:

 

a piece of code which puts a product into the cart, without refreshing etc....

 

like:

 

products_id, quantity, pid etc...

 

i tryed something like:

 

$PHP_SELF?action=add_product&products_id=202&cart_quantity=1

 

but no go...

 

anyone?

Link to comment
Share on other sites

Here pieces of code which i tryed to make it function:

 

 

So mainly i want to check a payment remote, and then update the cart with a product with a "direct db insert".

 

 

 

if($news === "Err002") {

 

header("location:$PHP_SELF?action=add_bon&products_id=202&cart_quantity=1");

 

//$cart->add_cart('202', $cart->get_quantity(tep_get_uprid('202', '1'))+1, '1');

 

}

 

 

and:

 

if($news === "Err002") {

$sql = "insert into customers_basket set customers_basket_quantity = '1', customers_basket_date_added = '".date("Ymd")."', customers_id = '".$customer."', products_id = '202'";

$res = mysql_query($sql);

echo $sql;

}

 

 

 

 

i guess i tryed it all, it wont work.

Link to comment
Share on other sites

*solved*

 

:rolleyes:

 

really simple anwser, if anyone cares, this is how you put a product into the session & db:

 

$cart->in_cart($products_id);

 

spend 2 days looking for it, excuse me but this shopping cart system is one of the most ill-designed piece of code i ever seen. I made simillar shops with a thenth (10%) of the code. >_<

and the documentation is worthless, and the code notation/explaination is so little.

 

I'm glad this was a onetime project for me.

Link to comment
Share on other sites

really simple anwser, if anyone cares, this is how you put a product into the session & db:

 

$cart->in_cart($products_id);

If I would consider myself a php programmer, I might want to reconsider that statement.

Treasurer MFC

Link to comment
Share on other sites

If I would consider myself a php programmer, I might want to reconsider that statement.

 

 

Why?

 

if i'm correct, (it does what i want) it calls the cart class in shopping_cart.php which registers it in the current session and puts the item into the db.

 

well it works, and that's what i wanted.

 

<_<

 

anyway i'm off this board and done with "osCommerce".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...