Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Force a second product in the shopping cart


hidihidi

Recommended Posts

Hi,

 

I'm a new member of the forum and I hope this is the right one for this question.

 

In Germany for some spare parts for cars you have to pay a deposit.

I created a "normal" product with the name "deposit" which has a tax etc. (products_id for example = 123456).

 

Furthermore I have added a column to the products table (= products_deposit) and all products with deposit have "123456" in their database field "products_deposit".

 

If someone wants to buy a product with deposit I want to force OSCommerce to put both products in the shopping cart.

 

I'm really not a beginner, but I am totally lost ...

1. which php source respectively function is the right one?

2. I assume that I have to call a "put in cart" function twice (for the product + its deposit product) -- but how to?

 

Is there anybody how can help me PLEASE!!!! I would jump for joy :-) :-) :-)

 

Hidi-Hidi

Link to comment
Share on other sites

Look in includes/applications_top.php for such a thing.

 

I would make it, so that when you submit an order from product_info.php, the action would go into the big switch statement in application_top.php and there you would place the order for the part, along with the product deposit. (not 100% sure, but I'm pretty sure this would be a way to go.)

 

Good luck!

Link to comment
Share on other sites

Hi Kenny,

 

I have assumed as well that it must be application_top and therefore I put some "debugging" statements there -- but none of them are displayed when I click the button "In the Cart" from the product_info page.

I did other echo-statements in various sources (e.g. classes/shopping_cart.php) but nothing shows me the right place -- either no output is produced or the relevant variables are empty.

 

So, I am still lost. Do you have any idea?

 

------------------------------------------------------------------

echo 'Action: ' . $HTTP_GET_VARS['action'] . "End Action";

 

switch ($HTTP_GET_VARS['action']) {

case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {

...

case 'add_product' : echo "I am at add_product";

....

case 'buy_now' : echo "I am at buy_now";

...

case 'cust_order' : echo "I am at cust_order";

...

------------------------------------------------------------------

 

Happy about any hint!

Hidi-Hidi

Link to comment
Share on other sites

Hi Kenny, many thanks that you tried to help me!!! This was my first request here - do you think that it make sense to repost my question again from your experience?

 

that is because after the actions, a redirect is performed which removes you comments basically.

 

to add an extra product into the cart you would code something like :

 

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

 

 

--->

 

 

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

 

//****************************

select the deposit_id from the product table given the products_id = $HTTP_POST_VARS['products_id']

if you have a result { $cart->add_cart(deposit_id) }

//****************************

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

Treasurer MFC

Link to comment
Share on other sites

  • 2 weeks later...

Archived

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

×
×
  • Create New...