webart Posted March 12, 2010 Posted March 12, 2010 Hi I have one tiny little problem, that should be able to be fixed in an instant. If you go here: http://shop.anb.com.au/index.php you will see that the Shopping Cart displays 0 0 items (this is zero zero items), which obviously has an extra zero displayed. If you add a product it goes to 1 0 items, add another product it goes to 2 0 items. This is 100% a display issue (how it looks), it does not affect the way the maths is done, all pricing is correct etc. How and where can I delete this additional zero from the display please, thanks Regards Ron
Guest Posted March 12, 2010 Posted March 12, 2010 It's either in includes/header.php or includes/languages/english.php. You're using a template so hard to say what the define(); would be but the value would show as 0 Items. Just remove the 0.
webart Posted March 12, 2010 Author Posted March 12, 2010 It's either in includes/header.php or includes/languages/english.php. You're using a template so hard to say what the define(); would be but the value would show as 0 Items. Just remove the 0. Hi Brian, I've locate this code in the includes/header.php file <?php echo BOX_HEADING_SHOPPING_CART?>:</b><br><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo BOX_SHOPPING_CART_EMPTY?></a> Oddly, to me it looks okay, but then again so does a large T-bone steak Does this look right to you? In the includes/languages/english.php I found this, which also looks okay to me: // shopping_cart box text in includes/boxes/shopping_cart.php define('BOX_HEADING_SHOPPING_CART', 'Shopping Cart'); define('BOX_SHOPPING_CART_EMPTY', '0 items'); However as you can see the lead to the includes/boxes/shopping_cart.php file, I took a look and found this code: $cart_contents_string = ''; if ($cart->count_contents() > 0) { $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0" align="center">'; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $cart_contents_string .= '<tr><td align="right" valign="top">'; It sort of looks right to me, but I am very new to PHP so will defer to people who know better through experience, what do you think? Can you spot the reason amongst any of the code I have displyed above, that is inserting the extra zero? Thanks in advance Regards Ron
Guest Posted March 12, 2010 Posted March 12, 2010 Oddly, to me it looks okay, but then again so does a large T-bone steak Change that to a Rib Eye steak. That's what I had tonight and it was sooooo damn goooood. Change this define('BOX_SHOPPING_CART_EMPTY', '0 items'); To define('BOX_SHOPPING_CART_EMPTY', ' items');
webart Posted March 12, 2010 Author Posted March 12, 2010 Change that to a Rib Eye steak. That's what I had tonight and it was sooooo damn goooood. Change this define('BOX_SHOPPING_CART_EMPTY', '0 items'); To define('BOX_SHOPPING_CART_EMPTY', ' items'); Lol it's not the meat that puts on the weight, it's all the damn sauces. Yes that's fixed it, working perfectly now, many thanks Brian, well done Regards Ron
♥mdtaylorlrim Posted March 12, 2010 Posted March 12, 2010 Standing alone this code looks suspicious. <?php echo BOX_HEADING_SHOPPING_CART?>:</b><br><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo BOX_SHOPPING_CART_EMPTY?></a> It would HAVE to be wrapped in an IF statement to render the correct output. So, it should look like this... <?php if $cart->count_contents() == 0 { echo BOX_HEADING_SHOPPING_CART?>:</b><br><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo BOX_SHOPPING_CART_EMPTY?></a> } else { <?php echo BOX_HEADING_SHOPPING_CART?>:</b><br><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo "items." ?></a> } This is the only way I see it working. Is there any IF type code around this in your files? Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
webart Posted March 12, 2010 Author Posted March 12, 2010 Standing alone this code looks suspicious. <?php echo BOX_HEADING_SHOPPING_CART?>:</b><br><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo BOX_SHOPPING_CART_EMPTY?></a> It would HAVE to be wrapped in an IF statement to render the correct output. So, it should look like this... <?php if $cart->count_contents() == 0 { echo BOX_HEADING_SHOPPING_CART?>:</b><br><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo BOX_SHOPPING_CART_EMPTY?></a> } else { <?php echo BOX_HEADING_SHOPPING_CART?>:</b><br><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo "items." ?></a> } This is the only way I see it working. Is there any IF type code around this in your files? Hi, that particular code is inside a table, it is working fine now, but for clarity, here is the code of that block: <table cellpadding="0" cellspacing="0" border="0" style="width:158px"> <tr> <td align="left"><b><?php echo BOX_HEADING_SHOPPING_CART?>:</b><br><a href="<?php echo tep_href_link('shopping_cart.php')?>"><?php echo $cart->count_contents()?> <?php echo BOX_SHOPPING_CART_EMPTY?></a></td> </tr> </table> The <> doesn't seem to be working for me with this code, it keeps repeating the colour and size tags over and over, so sorry, but the code is above. Regards Ron
Guest Posted March 12, 2010 Posted March 12, 2010 The code is fine. $cart->count_contents() is just showing the total number of items in your cart. BOX_SHOPPING_CART_EMPTY is displaying the word "items".
♥mdtaylorlrim Posted March 12, 2010 Posted March 12, 2010 The code is fine. $cart->count_contents() is just showing the total number of items in your cart. BOX_SHOPPING_CART_EMPTY is displaying the word "items". The reason I said what I did is to prevent a missing 0 in the even that other code uses BOX_SHOPPING_CART_EMPTY without it following $cart->count_contents(). Look in other pages where the cart is displayed to be sure what is being displayed when you have an empty cart. Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
Guest Posted March 12, 2010 Posted March 12, 2010 The reason I said what I did is to prevent a missing 0 in the even that other code uses BOX_SHOPPING_CART_EMPTY without it following $cart->count_contents(). Look in other pages where the cart is displayed to be sure what is being displayed when you have an empty cart. Yes you are correct. However the only other place that define is used is in includes/boxes/shopping_cart.php. That box is not used in his template That is not being used so he should be ok. If he does decide to use that box then he will have to change it to what you posted above.
webart Posted March 12, 2010 Author Posted March 12, 2010 Yes you are correct. However the only other place that define is used is in includes/boxes/shopping_cart.php. That box is not used in his template That is not being used so he should be ok. If he does decide to use that box then he will have to change it to what you posted above. Thank you to both you guys, everything is fine and from the other side of the world, I thank you Regards Ron
Guest Posted March 12, 2010 Posted March 12, 2010 Thank you to both you guys, everything is fine and from the other side of the world, I thank you You're welcome. Now go enjoy that T-Bone!!!!! :D
webart Posted March 12, 2010 Author Posted March 12, 2010 You're welcome. Now go enjoy that T-Bone!!!!! LOL, I bummed out, I had fish (yuk) okay, I was wondering if you could help out with another issue that is on a different thread, the link is: http://www.oscommerce.com/forums/topic/228316-new-products-and-whats-new-box-causing-problems/page__p__1491230__hl__webart__fromsearch__1entry1491230 It seems to have stumped just about everyone. I'd appreciate if you could take a quick look. Regards Ron
Recommended Posts
Archived
This topic is now archived and is closed to further replies.