Forums / Addon Sideboxes / Need help editing the cart summary sidebox mod

Need help editing the cart summary sidebox mod

Locked

Views: 13,076

Results 1 to 20 of 145
This thread is locked. New replies are disabled.
30 Mar 2009, 8:43 PM
#1
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Need help editing the cart summary sidebox mod

Been talking to kobra a little about this and was recommended to start a new thread.

The site in question is www. bodykits online .co.uk/test Ive added a shopping cart to the header and im stuck on how to make the Items: 0 Amount: £0.00 look like

Items: 0
Amount: £0.00

Ive done a developers tool kit search and found a page that contained these words but when i tried to add the <br> code in, it either didnt change the layout or it made the screen go completely white.

Does anyone know how i can achieve what im wanting to do using this mod.

Thanks

30 Mar 2009, 9:14 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Need help editing the cart summary sidebox mod

Post the code in that area (say 10 lines before & after) so we can see what you have done. Use ```
[php] and [/php]

30 Mar 2009, 9:21 PM
#3
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

so, i havent used that mod.. (prob. what i need to do, actually.. to do what it is i am trying to do) but this should fix your problem...

basically you need to describe the cart in your css, something like this:

#headerCart ul li{
text-align: center;
list-style-type: none; /removes the bullets/

it may already be in your css, but defined as display: inline;... if so, replace with list-style-type: none;

(inline is all in the same row, as you have now. just deleting it will make it stack, but will add bullets or numbers, so defining the style as none will disable that part)

i am going to try the mod u are using, so i will post further results when i have more info, but maybe this will help in the meantime..

"Be the Change you wish to see in the World..." -Gandhi

30 Mar 2009, 9:28 PM
#4
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

Hello

unfortunatly that bit of code didnt change the totals, it did move the whole shopping cart to the centre of the screen.

Thanks for your efforts so far.

30 Mar 2009, 9:35 PM
#5
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

im installing that mod right now,
give me a min to get the css coding correct...

bout 5 min.

"Be the Change you wish to see in the World..." -Gandhi

30 Mar 2009, 10:05 PM
#6
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

Im going to have to go now, so will check to see if you succeded and left any updates tomorow.

Thanks you.

30 Mar 2009, 10:59 PM
#7
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

ok, so i have tried twice to use this mod, and both times after uploading files, when i go to put the code in the header file... i get only a white screen.... the ONLY way to correct is not just to remove that snippet, but to delete the 3 uploaded files as well...

so, something not right there.

im SURE its something im doing, as i am knowledgeable enough to juuust be dangerous... lol

im not sure what you tried, when you say that it just moved to the "center"... did you define it in the CSS as:

#navMainCartSummary {

Basically, you need to somehow seperate the name, weight, and cost into three seperate lines... i would do this by making it a list... or ul id= instead of div id= then change the css to be #navMainCartSummary ul { but im sure there is more to it than that... and im not really sure what to tell you.

i look forward to additional posts by those more knowlegeable than i on how to fix this for both of us!

"Be the Change you wish to see in the World..." -Gandhi

31 Mar 2009, 9:33 AM
#9
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

customk1:

ok, so i have tried twice to use this mod, and both times after uploading files, when i go to put the code in the header file... i get only a white screen.... the ONLY way to correct is not just to remove that snippet, but to delete the 3 uploaded files as well...

so, something not right there.

im SURE its something im doing, as i am knowledgeable enough to juuust be dangerous... lol

im not sure what you tried, when you say that it just moved to the "center"... did you define it in the CSS as:

#navMainCartSummary {

Basically, you need to somehow seperate the name, weight, and cost into three seperate lines... i would do this by making it a list... or ul id= instead of div id= then change the css to be #navMainCartSummary ul { but im sure there is more to it than that... and im not really sure what to tell you.

i look forward to additional posts by those more knowlegeable than i on how to fix this for both of us!

Thank you for trying, im sure its a simple thing to change, but trying to figure it out is beyond what I know.

31 Mar 2009, 9:38 AM
#10
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

gjh42:

We can't advise on what we can't see...

Here is the code from includes/languages/english/extra_definitions/custom/cart_summary_sidebox.php

  • @version $Id: cart_summary_sidebox.php $
    /
    /
    These definitions are similar to those in your shopping_cart.php file.
  • You may want to edit both to keep them in sync.
    */
    define('BOX_HEADING_CART_CONTENTS', 'Your Cart Contents:');
    define('TEXT_TOTAL_ITEMS', ' Items: ');
    define('TEXT_TOTAL_WEIGHT', 'Weight: ');
    define('TEXT_TOTAL_AMOUNT', 'Amount: ');
    ?>

and here is the module code from includes/modules/sideboxes/custom/cart_summary.php

<?php /** * cart_summary ("sidebox") - this sidebox can be used to display a summary of the customer's cart content in header or sidebox * * @package sideboxes * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: cart_summary.php $ */ $item_separator = ($box_id == '') ? '  ' : '<br />'; $totalsDisplay = ''; switch (true) { case (SHOW_TOTALS_IN_CART == '1'): $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . $item_separator .<br> TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT . $item_separator . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); break; case (SHOW_TOTALS_IN_CART == '2'): $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($_SESSION['cart']->show_weight() > 0 ? $item_separator . TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT : '') . $item_separator . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); break; case (SHOW_TOTALS_IN_CART == '3'): $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . $item_separator . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); break; } $content = $totalsDisplay; ///////////////////////// // Determine whether displaying as sidebox should be disabled, based on Admin settings under Admin->Configuration->Stock $show_shopping_cart_box = true; switch (true) { case (SHOW_SHOPPING_CART_BOX_STATUS == '0'): $show_shopping_cart_box = true; break; case (SHOW_SHOPPING_CART_BOX_STATUS == '1'): if ($_SESSION['cart']->count_contents() > 0 || (isset($_SESSION['customer_id']) && zen_user_has_gv_account($_SESSION['customer_id']) > 0)) { $show_shopping_cart_box = true; } else { $show_shopping_cart_box = false; } break; case (SHOW_SHOPPING_CART_BOX_STATUS == '2'): if ( ( ($_SESSION['cart']->count_contents() > 0) || (isset($_SESSION['customer_id']) && zen_user_has_gv_account($_SESSION['customer_id']) > 0) ) && ($_GET['main_page'] != FILENAME_SHOPPING_CART) ) { $show_shopping_cart_box = true; } else { $show_shopping_cart_box = false; } break; } /////////////////////// require($template->get_template_dir('tpl_cart_summary.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_cart_summary.php'); if ($box_id !='' && $show_shopping_cart_box == true) { $title = '<label>' . BOX_HEADING_CART_CONTENTS . '</label>'; $title_link = false; require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); } else { if ($show_shopping_cart_box == true) require($template->get_template_dir('tpl_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_box_header.php'); } ?>
31 Mar 2009, 9:49 AM
#11
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

customk1:

im not sure what you tried, when you say that it just moved to the "center"... did you define it in the CSS as:

#navMainCartSummary {

I had the #navMainCartSummary { then with code that you gave to me underneath.

It made the shopping basket in my header move to the left and also the main links in the centre became a sqashed up above the shopping basket and moved my search box up into the header.

I can work on the basics, but this code writing is very difficult for me to get to grips with, im so grateful for those attempting to help me out.

31 Mar 2009, 2:13 PM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Need help editing the cart summary sidebox mod

This line at the top of the file```php
$item_separator = ($box_id == '') ? '  ' : '<br />';


Try replacing the 
'  ' 
with 
'<br />'
31 Mar 2009, 3:03 PM
#13
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

Thanks for looking over the code, unfortunatly it didnt work for me.

31 Mar 2009, 3:26 PM
#14
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

ok, so still the blind leading the blind here.. lol... (you and me anyways.. glen is "The Man!")

1st... PLEASE backup stuff, i am a try till i get it right b/c i dont know enough kinda person, and i am constantly cutting and pasting back stuff b/c i screwed it up! i dont want to impact your page at all... (with that said, you already pasted the code here, so you have a copy anyways...)

  1. so based on what Glen was saying... if i were to try to read this code in "english", it says to me, if you want to separate items, you can use " &nbsp" (which are just spaces), or you can use <br /> (which is a break).

i looked thru your code, and each time it said ". item separator ." i just replaced it with <br /> if i wanted a break.

maybe this is too easy/TOO logical? but it makes sense to me... let me know if it works?


/**

  • cart_summary ("sidebox") - this sidebox can be used to display a summary of the customer's cart content in header or sidebox
  • @package sideboxes
  • @copyright Copyright 2003-2006 Zen Cart Development Team
  • @copyright Portions Copyright 2003 osCommerce
  • @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  • @version $Id: cart_summary.php $
    */
    $item_separator = ($box_id == '') ? '  ' : '<br />';
    $totalsDisplay = '';
    switch (true) {
    case (SHOW_TOTALS_IN_CART == '1'):
    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . $item_separator . TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT . <br /> . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
    break;
    case (SHOW_TOTALS_IN_CART == '2'):
    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($_SESSION['cart']->show_weight() > 0 ? $item_separator . TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT : '') . <br />. TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
    break;
    case (SHOW_TOTALS_IN_CART == '3'):
    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . <br />. TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
    break;
    }
    $content = $totalsDisplay;

"Be the Change you wish to see in the World..." -Gandhi

31 Mar 2009, 4:26 PM
#15
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

Sorry to say that made no difference either. Ive had issues with the header displaying in Firefox incorrectly and have been advised that my coding is very poor.

This is the code that i have been using so maybe if someone could advise me on how to clean it up it will enable the problem in this thread to be cleared.

<ul class="forward"><div id="cart"><div class="cart_all"><div class="cart_header"></div><div><img src=[\[COLOR=#006699\]http://www.bodykitsonline.co.uk/test...s/cart\_top.jpg\[/COLOR\]](http://www.bodykitsonline.co.uk/test/includes/templates/custom/images/cart_top.jpg) border="0" /> <div id="navMainCartSummary"><?php require(DIR_WS_MODULES . 'sideboxes/cart_summary.php'); ?></div><br><a href="http://www.bodykitsonline.co.uk/test/index.php?main_page=shopping_cart"><img src=http://www.bodykitsonline.co.uk/test/includes/templates/custom/images/button_view.jpg border="0" /></a> <a href="http://www.bodykitsonline.co.uk/test/index.php?main_page=checkout_shipping"><img src=http://www.bodykitsonline.co.uk/test/includes/templates/custom/images/button_checkout.jpg border="0" /></a></div><br class="clearBoth" /></div></div><div></div><div></div> </ul>
31 Mar 2009, 4:56 PM
#16
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

where did you get this coding? is it from a zencart template?
if its not from a template, or if it is code from a template that you have modified, what did you change, and why (ie what are you trying to accomplish)?

"Be the Change you wish to see in the World..." -Gandhi

31 Mar 2009, 5:03 PM
#17
ben_harry avatar

ben_harry

Zen Follower

Join Date:
Mar 2007
Location:
Cornwall - uk
Posts:
462
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

Its a bit of a mix and match.

I copied the intial code from http://www.**tapes**-direct.co.uk then changed it a bit to work with my site,

I couldnt get the amount, weight and price to change when parts were added, so i downlaoded the cart summary box and started to work around that.

31 Mar 2009, 5:07 PM
#18
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

are you working within the zencart structure/admin etc?

"Be the Change you wish to see in the World..." -Gandhi

31 Mar 2009, 5:08 PM
#19
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

guess you are lol b/c you have it loaded on your test site.

is the header the first thing you have really worked on modifying with your zencart page?

"Be the Change you wish to see in the World..." -Gandhi

31 Mar 2009, 5:16 PM
#20
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Need help editing the cart summary sidebox mod

bah! that whole page is hacked up! :) no wonder ur frustrated (this is soooo the pot calling the kettle "black") HAHAHA

just one thing i noticed right away is you are calling a list here:

<ul class="forward"><div id="cart"><div class="cart_all"><div class="cart_header"><div<img src="http://www.bodykitsonline.co.uk/test/includes/templates/custom/images/cart_top.jpg" border="0" /> <div id="navMainCartSummary"> Items: 0  Amount: £0.00</div><br><a href="http://www.bodykitsonline.co.uk/test/index.php?main_page=shopping_cart"><img src="http://www.bodykitsonline.co.uk/test/includes/templates/custom/images/button_view.jpg" border="0" /></a> <a href="http://www.bodykitsonline.co.uk/test/index.php?main_page=checkout_shipping"><img src="http://www.bodykitsonline.co.uk/test/includes/templates/custom/images/button_checkout.jpg" border="0" /></a></div><br class="clearBoth" /></div></div><div></div><div></div> </ul>

but then dont list anything with list tags..

you have the <ul> but no <li>

sooooo, long and short, here is what I would do (because this is exactly what i had to do a few days ago). 1st, IF the header is the only thing you have messed with so far... i would dump everything and re-install zencart. (i say this because, you prob. did exactly like i did.. jumped in with both feet, and started messing around with files, and basically started working on the "originals" instead of the templates... and it became a MESS)....

after you re-install zencart... find a template you like, this is a good site: http://(sorry, site offline)/
they are all free, and you can scroll thru and find the one that is "closest" to what you are trying to accomplish... right out of the box.

then, we can knock out some of the "default" stuff, like changing header image etc. then go back and put these links/mods in their correct places.

if you decide to tackle it this way, let me know, we can correspond by email or IM so as to not hijack the forum...

"Be the Change you wish to see in the World..." -Gandhi