Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Checkout thwarts Update in cart


Guest

Recommended Posts

In the "Suggestions and Proposals" section, there was a post regarding users changing the quantity of a product in the cart, then checking out without first clicking update.

 

burt shared the url example of a dhtml solution to this problem, and I posted a request for details of how to implement it. I now recognize that the question I am posing may not be best in the "Suggestions and Proposals" section , so I am posting here.

 

burt also suggested that this particular solution may have come from the "Tips & Tricks" section, but I could not locate it there.

 

If anyone has insight into where that solution might be detailed, is willing to share details themselves, or even has a more fundamental solution (like how to update the cart when the user clicks "checkout"), I'd be appreciative.

 

I have also noted the suggestions from Update Cart function is difficult to find for customers

 

Thanks much!

Link to comment
Share on other sites

But how did you do that :o

 

Could you share this code. I think youre solution is nicer because there is no background.

 

you can rip burt's solution right out of his demo website.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

In addition to the reminder, I have also moved the "update" button to a place that makes more sense and can be seen easier by the customer when they are making any changes:

 

screen_checkout.jpg

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

Thanks very much to all!

 

To detail what I applied in matching (and to a very minor degree, tweeking) burts deal:

 

in catalog/shopping_cart.php

 

In between:

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

 

Place:

<style type="text/css">

#reminder { position: relative; visibility: hidden; color: red; font-weight:bold; font-family: verdana, helvetica, sans-serif; font-size:12px; font-variant: small-caps; }

</style>

<script type="text/javascript">



function setVisibility(id, vis) {

   var obj;

   if (document.getElementById) {

       obj = document.getElementById(id);

   }

   else if (document.layers) {

       obj = document.layers[id];

   }

   if (obj != null) {

       if (obj.style) {

           obj = obj.style;

       }

       obj.visibility = vis;

   }

}



</script>

 

Replace:

<td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>

 

With:

<!-- start advise customer hack-->

<td class="main">

<table width="100%" cellpadding="0" cellspacing="0" border="0">

<tr>

<td><p id="reminder">Click "Update" to complete cart changes!</p></td>

<td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>

</tr>

</table>

</td>

<!-- end advise customer hack-->

 

Replace:

<td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>

 

With:

<td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART, 'onclick="setVisibility('reminder', 'hidden')" '); ?></td>

 

* note that the step above doesn't seem to be a critical one to me.

 

 

 

in catalog/includes/modules/order_details.php

 

Replace:

  if (strstr($PHP_SELF, FILENAME_SHOPPING_CART))

   echo '    <td align="center" valign="top"><input type="checkbox" name="cart_delete[]" value="' . $products[$i]['id'] . '"></td>' . "n";



// Quantity box or information as an input box or text

 if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

   echo '    <td align="center" valign="top"><input type="text" name="cart_quantity[]" value="' . $products[$i]['quantity'] . '" size="4"><input type="hidden" name="products_id[]" value="' . $products[$i]['id'] . '"></td>' . "n";

 } else {

   echo '    <td align="center" valign="top" class ="main">' . $products[$i]['quantity'] . '</td>' . "n";

 }

 

With:

 

// Delete box only for shopping cart

   if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

     echo '    <td align="center" valign="top">' . tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'],'', 'onclick="setVisibility('reminder', 'visible')" onblur="setVisibility('reminder', 'hidden')" ') . '</td>' . "n";

   }



// Quantity box or information as an input box or text

   if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

     echo '    <td align="center" valign="top">' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4" onfocus="setVisibility('reminder', 'visible')" onblur="setVisibility('reminder', 'hidden')" ') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . '</td>' . "n";

   } else {

     echo '    <td align="center" valign="top" class ="main">' . $products[$i]['quantity'] . '</td>' . "n";

   }

 

And if and when NN4 stops becoming an issue, I plan to replace this bit from the last block

onfocus="setVisibility('reminder', 'visible')"

with:

onselect="setVisibility('reminder', 'visible')"

as it fires the message when the number of items is selected insted of when the field gets focus. A subtle difference, but a little clearer in my view. The problem is that NN4 doesn't cooperate (there's a shock :wink: )

 

 

I might add that I have been thinking about doing something with

onChange="this.form.submit();"

but believe there may be a problem then with someone not being able to change to double digit products.

 

 

Thanks again for the friendly help!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...