Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

ShoppingCart Update reminder


boxtel

Recommended Posts

Posted

One possible solution for cart update reminder:

 

This will make the reminder text visible as soon an the input field is changed and at the same time make the checkout button invisible.

 

to install:

 

1) add this javascript to your shoppingcart.php :

 

<script>

function visOn(index) {

var d = document.getElementById(index);

d.className='showMe';

}

 

function visOff(index) {

var d = document.getElementById(index);

d.className='hideMe';

}

</script>

 

 

2) add the reminder text where you would like it (example):

 

<td align="left" class="smallText"><div class="hideMe" id="cu"><font color="red">Please, Update your Basket before CheckOut</font></div></td>

 

3) put an "onChange" condition on the input fields (example of the remove checkbox) :

 

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="top"',

'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'],'',' onChange="visOn(\'cu\');visOff(\'co\');" '));

 

 

4) put the checkout button inside a <DIV> (example) :

 

<td valign="top" align="right" class="main"><div class="showMe" id="co"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_rollover_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT, 'checkout2', 'button_checkout_ro.gif') . '</a>'; ?></div></td>

 

 

5) add the 2 classes to your stylesheet :

 

div.hideMe {display: hidden; display: none; }

div.showMe {display: block;}

 

 

 

You can see it on my site.

Treasurer MFC

Posted

That is what I needed badly. Thanks very much. But where (read on which line) should the coding of '1' and '2' be pasted in shopping_cart.php?

Irfan,

Posted
That is what I needed badly. Thanks very much. But where (read on which line) should the coding of '1' and '2' be pasted in shopping_cart.php?

 

 

well, 1) the javascript, put it in your <head></head> section.

 

2) the message, where you would like it to appear. I have it left of the subtotal:

 

<tr>

<td>

<table width="100%">

<tr>

<td align="left" class="smallText"><div class="hideMe" id="cu"><font color="red">Please, Update your Basket before CheckOut</font></div></td>

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

</tr>

</table>

</td>

</tr>

Treasurer MFC

  • 1 month later...
Posted

Thanks for the great tip Amanda - solved most of my shopping cart problems in no time at all :thumbsup:

 

I made a couple of alterations - using the OnClick condition for the Remove checkbox and OnKeyDown for the quantity box. Using OnChange means you have to click elsewhere on the page before the message appears.

 

i.e.

            $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="middle"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'], '', 'onClick="visOn(\'cu\');visOff(\'co\');"'));

and

      $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="middle"',
                                            'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], onKeyDown="visOn(\'cu\');visOff(\'co\');"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

Made it make the whole Continue Shopping / Checkout box disappear - makes it more obvious to the customer that something needs to be done. I just used SPAN tags around the whole TR

<span class="showMe" id="co"></span>

  • 2 months later...
Posted

 ? ? ?$info_box_contents[$cur_row][] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="productListing-data" valign="middle"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], onKeyDown="visOn(\'cu\');visOff(\'co\');"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

 

When I make the above modification, my shopping cart page disappears. Is there something wrong with the code?

Posted

 ? ? ?$info_box_contents[$cur_row][] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="productListing-data" valign="middle"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], onKeyDown="visOn(\'cu\');visOff(\'co\');"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

 

When I make the above modification, my shopping cart page disappears. Is there something wrong with the code?

 

I think the code is missing a quote:

 

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="middle"',

'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], ' onKeyDown="visOn(\'cu\');visOff(\'co\');" ') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

Treasurer MFC

Archived

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

×
×
  • Create New...