jung Posted October 24, 2006 Share Posted October 24, 2006 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? Quote Link to comment Share on other sites More sharing options...
jung Posted October 24, 2006 Author Share Posted October 24, 2006 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. Quote Link to comment Share on other sites More sharing options...
jung Posted October 24, 2006 Author Share Posted October 24, 2006 *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. Quote Link to comment Share on other sites More sharing options...
boxtel Posted October 24, 2006 Share Posted October 24, 2006 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. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
jung Posted October 24, 2006 Author Share Posted October 24, 2006 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". Quote Link to comment Share on other sites More sharing options...
boxtel Posted October 24, 2006 Share Posted October 24, 2006 well it works, and that's what i wanted spoken like a genuine programmer. Quote Treasurer MFC Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.