Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problems Please Help... Amanda maybe?


ariogenki

Recommended Posts

>_< Okay. Three days of no avail I have finally concluded I need help.

 

I am building a gift registry. Anyways.... here is the code that adds it to the cart.

 

case 'add_product_user':

include('registry/display/cart/add.php'); 

$amount2 = count($cart_num);

$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$amount2);	

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

break;

 

Now. Two things happens here. Inside Add.php it adds it to my gift registry correctly, and inside add.php is an array that I created call cart_num to make sure it counts it so it can add the correct quantity to the cart.

 

$Amount2 is the amount that should be added to the shopping cart. It doesnt even matter if the array isnt being populated correctly it should still represent 1 in $cart_num if I were to count it. But the fact is that the array is being populated correctly as it adds the correct number of ppl to my table for the registry. But when it trys to add the quantity to my cart, upon redirect my shopping cart is completly empty and if there were items already in the cart before, they are now gone. Can someone help me? :(

Link to comment
Share on other sites

Not 100% sure what you try to do. somehow it appears to me that you want to sum up the $cart_num array but you use count which returns you the number of elements in the array.

 

BTW, did you have a look at my gift registry contribution (http://www.oscommerce.com/community/contributions,1226/category,all/search,registry)?

 

HTH

 

Gunter

 

 

>_< Okay. Three days of no avail I have finally concluded I need help.

 

I am building a gift registry. Anyways.... here is the code that adds it to the cart.

 

case 'add_product_user':

include('registry/display/cart/add.php'); 

$amount2 = count($cart_num);

$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$amount2);	

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

break;

 

Now. Two things happens here. Inside Add.php it adds it to my gift registry correctly, and inside add.php is an array that I created call cart_num to make sure it counts it so it can add the correct quantity to the cart.

 

$Amount2 is the amount that should be added to the shopping cart. It doesnt even matter if the array isnt being populated correctly it should still represent 1 in $cart_num if I were to count it. But the fact is that the array is being populated correctly as it adds the correct number of ppl to my table for the registry. But when it trys to add the quantity to my cart, upon redirect my shopping cart is completly empty and if there were items already in the cart before, they are now gone. Can someone help me? :(

Link to comment
Share on other sites

>_< Okay. Three days of no avail I have finally concluded I need help.

 

I am building a gift registry. Anyways.... here is the code that adds it to the cart.

 

case 'add_product_user':

include('registry/display/cart/add.php'); 

$amount2 = count($cart_num);

$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$amount2);	

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

break;

 

Now. Two things happens here. Inside Add.php it adds it to my gift registry correctly, and inside add.php is an array that I created call cart_num to make sure it counts it so it can add the correct quantity to the cart.

 

$Amount2 is the amount that should be added to the shopping cart. It doesnt even matter if the array isnt being populated correctly it should still represent 1 in $cart_num if I were to count it. But the fact is that the array is being populated correctly as it adds the correct number of ppl to my table for the registry. But when it trys to add the quantity to my cart, upon redirect my shopping cart is completly empty and if there were items already in the cart before, they are now gone. Can someone help me? :(

 

well, to my shame I have to say that I have no idea what a gift registry is. Some variation to a wish list ?

 

in any event, what does $cart_num stand for and why is it an array?

Treasurer MFC

Link to comment
Share on other sites

Fixed it With The following

 

The Array contains who is getting the gift. So I count it jsut to get the amount/quantity for the cart. The gift registry is like a wish list, except its made to send the product to multiple ppl with gift messages, seperate delivery dates etc.

 

case 'add_product_registry' :

 

$v = calval();

 

if (isset($HTTP_GET_VARS['products_id'])) {

// if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

// tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

// } else {

$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$v);

 

// }

}

 

echo add_to_shipping_list();

 

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

break;

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