ianric Posted August 9, 2006 Share Posted August 9, 2006 Hi When a customer goes to the shopping cart I want it to say "the cart for logged_in_user_name or guest contains 0 items" or "the cart for logged_in_user_name or guest contains 3 items" instead of the "what's in my cart". I have got the "the cart contains 0 items" bit but can't get the user_name to appear. Thanks Ian Link to comment Share on other sites More sharing options...
ianric Posted August 9, 2006 Author Share Posted August 9, 2006 Hi Also noticed that the continue shopping button goes back to the main index page. The code for the button is the std osc <td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td> Thanks Ian Link to comment Share on other sites More sharing options...
Gil_e_n Posted August 9, 2006 Share Posted August 9, 2006 Try: if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) { $customer_name = sprintf(tep_output_string_protected($customer_first_name)); } else { $customer_name = sprintf(TEXT_GUEST)); } somewhereat the top of the page, and just echo $customer_name where you want it. I'm guessing it'll work, although I'm not sure. Also, could you post the code you end up using? Sounds like it might be nice to add to my cart. Always BACK UP your files and your database before making any changes. Before asking questions, check out the Knowledge Base. Check out the contributions to see if your problem's solved there. Search the forums. Useful threads: Store Speed Optimization How to make a horrible shop Basics for design change How to search the forums Useful contributions: Easypopulate Fast, Easy Checkout Header Tag Controller Link to comment Share on other sites More sharing options...
ianric Posted August 10, 2006 Author Share Posted August 10, 2006 Hi Gillian Thanks for the reply. It worked but I changed $customer_name = sprintf(TEXT_GUEST)); to $customer_name = sprintf(Guest); I also wrote my first PHP IF statement so that if 1 product it said item and multi it said items. I'll post when I have finished tweaking. Ian Link to comment Share on other sites More sharing options...
ianric Posted August 10, 2006 Author Share Posted August 10, 2006 Try: if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) { $customer_name = sprintf(tep_output_string_protected($customer_first_name)); } else { $customer_name = sprintf(TEXT_GUEST)); } somewhereat the top of the page, and just echo $customer_name where you want it. I'm guessing it'll work, although I'm not sure. Also, could you post the code you end up using? Sounds like it might be nice to add to my cart. Hi Done and working. I have left the text in the HEADING_TITLE so you may want to format it. Can't find the code button so hope it comes out OK and remember to backup incase it doesn't work!! Edit includes/languages/english/shopping_cart.php and add the following 2 IF statements just before the line define('NAVBAR_TITLE', 'Cart Contents'); if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) { $customer_name = sprintf(tep_output_string_protected($customer_first_name) . ' ' . sprintf(tep_output_string_protected($customer_last_name))); $products = $cart->get_products(); $products_count=sizeof($products); } else { $customer_name = sprintf(Guest); $products = $cart->get_products(); $products_count=sizeof($products); } if ($products_count == 1) { define('HEADING_TITLE', 'Shopping Cart for ' . $customer_name . ' contains ' . $products_count . ' item'); } else { define('HEADING_TITLE', 'Shopping Cart for ' . $customer_name . ' contains ' . $products_count . ' items'); } Change define('TEXT_CART_EMPTY', 'Your Shopping Cart is empty!'); To define('TEXT_CART_EMPTY', 'Shopping Cart for ' . $customer_name . ' contains ' . BOX_SHOPPING_CART_EMPTY); - WHY??, don't know, I'm not a programmer, it just seemed right at the time and it works for me... Edit catalog/shopping_cart.php and comment out (HTML so use <!-- -->) the line around 207 on standard install <tr> <td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td> </tr> This stops the standard cart is empty message. Hope this helps other people. Ian Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.