If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / [DONE] suggested changes to sideboxes?

[DONE] suggested changes to sideboxes?

Locked

Started by deepmax on 18 May 2006, 1:50 PM · Views: 3,090

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
18 May 2006, 1:50 PM
#1
deepmax avatar

deepmax

New Zenner

Join Date:
May 2006
Posts:
6
Plugin Contributions:
0

[DONE] suggested changes to sideboxes?

Hi, I think I found a small bug in file:

includes/templates/template_default/sideboxes/tpl_shopping_cart.php

around lines 45-49 you find this code:

if ($_SESSION['cart']->count_contents() > 0) {
$content .= '<hr />';
$content .= '<div class="cartBoxTotal">' . $currencies->format($_SESSION['cart']->show_total()) . '</div>';
$content .= '<br class="clearBoth" />';
}

I think you have to add this line at the end of this portion of code

if ($_SESSION['cart']->count_contents() > 0) {
$content .= '<hr />';
$content .= '<div class="cartBoxTotal">' . $currencies->format($_SESSION['cart']->show_total()) . '</div>';
$content .= '<br class="clearBoth" />';
}
$content .= '</div>';

the closure tag </div> it's necessary to close the previously opened at the start of file, otherwise depending of the settings in .css you will find a corrupted graphic and borders of this box.

There's also another adjustment in file tpl_search.php

around lines 17 to 23 you see the code:

if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
$content .= zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px"') . '<br />' . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
$content .= '<br /><a href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';
} else {
$content .= zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px" value="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == '' . HEADER_SEARCH_DEFAULT_TEXT . '') this.value = '';"') . '<br /><input type="submit" value="' . HEADER_SEARCH_BUTTON . '" style="width: 50px" />';
$content .= '<br /><a href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';
}

you have to change the width: parameter like this:

if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
$content .= zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-35) . 'px"') . '<br />' . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
$content .= '<br /><a href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';
} else {
$content .= zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-35) . 'px" value="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == '' . HEADER_SEARCH_DEFAULT_TEXT . '') this.value = '';"') . '<br /><input type="submit" value="' . HEADER_SEARCH_BUTTON . '" style="width: 50px" />';
$content .= '<br /><a href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';
}

This small reduction of width it's necessary to see correct graphics if you change the look of the boxes adding a footer, otherwise you will see it a bit on the right.

Bye,
Max :thumbsup:

18 May 2006, 1:54 PM
#2
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: [DONE] suggested changes to sideboxes?

the only div in question in your first exapmle is already closed
$content .= '<div class="cartBoxTotal">' . $currencies->format($_SESSION['cart']->show_total()) . '</div>';

Zen cart PCI compliant Hosting

22 May 2006, 1:50 PM
#3
deepmax avatar

deepmax

New Zenner

Join Date:
May 2006
Posts:
6
Plugin Contributions:
0

Re: [DONE] suggested changes to sideboxes?

Sorry, maybe I did not explain correctly.
The <div> in question is not in the part of code I posted, but in the complete code of this file.

So I post the complete code section, end I evidence the <div> on which I refer, ok?

Please check again, I think I'm in right.

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cartt Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_shopping_cart.php 3056 2006-02-21 06:41:36Z birdbrain $ */ $content =""; if ($_SESSION['cart']->count_contents() > 0) { $content .= '**<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">**'; $content .= '**<div id="cartBoxListWrapper">**' . "\n" . '<ul>' . "\n"; $products = $_SESSION['cart']->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $content .= '<li>'; if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) { $content .= '<span class="cartNewItem">'; } else { $content .= '<span class="cartOldItem">'; } $content .= $products[$i]['quantity'] . BOX_SHOPPING_CART_DIVIDER . '</span><a href="' . zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']) . '">'; if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) { $content .= '<span class="cartNewItem">'; } else { $content .= '<span class="cartOldItem">'; } $content .= $products[$i]['name'] . '</span></a></li>' . "\n"; if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) { $_SESSION['new_products_id_in_cart'] = ''; } } $content .= '</ul>' . "\n" . '</div>'; } else { $content = '<div class="sideBoxContent center bold">' . BOX_SHOPPING_CART_EMPTY . '</div>'; } if ($_SESSION['cart']->count_contents() > 0) { $content .= '<hr />'; $content .= '<div class="cartBoxTotal">' . $currencies->format($_SESSION['cart']->show_total()) . '</div>'; $content .= '<br class="clearBoth" />'; } if (isset($_SESSION['customer_id'])) { $gv_query = "select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $_SESSION['customer_id'] . "'"; $gv_result = $db->Execute($gv_query); if ($gv_result->fields['amount'] > 0 ) { $content .= '<div id="cartBoxGVButton" class="sideBoxContent"><a href="' . zen_href_link(FILENAME_GV_SEND, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_SEND_A_GIFT_CERT , BUTTON_SEND_A_GIFT_CERT_ALT) . '</a></div>'; $content .= '<div class="sideBoxContent center bold">' . VOUCHER_BALANCE . $currencies->format($gv_result->fields['amount']) . '</div>'; } $content .= '**</div>**'; } ?>

as you can see there are 2 (two) <div> tag opened, and just one closed in the ending portion of code.
All the others in the code are correctly opened and closed, section by section, except this. By this way, the <div> tag refers to <div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent"> will not be closed correctly, causing the viewing problem.

So I think the right code is this:

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cartt Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_shopping_cart.php 3056 2006-02-21 06:41:36Z birdbrain $ */ $content =""; if ($_SESSION['cart']->count_contents() > 0) { $content .= '**<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">**'; $content .= '**<div id="cartBoxListWrapper">**' . "\n" . '<ul>' . "\n"; $products = $_SESSION['cart']->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $content .= '<li>'; if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) { $content .= '<span class="cartNewItem">'; } else { $content .= '<span class="cartOldItem">'; } $content .= $products[$i]['quantity'] . BOX_SHOPPING_CART_DIVIDER . '</span><a href="' . zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']) . '">'; if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) { $content .= '<span class="cartNewItem">'; } else { $content .= '<span class="cartOldItem">'; } $content .= $products[$i]['name'] . '</span></a></li>' . "\n"; if (($_SESSION['new_products_id_in_cart']) && ($_SESSION['new_products_id_in_cart'] == $products[$i]['id'])) { $_SESSION['new_products_id_in_cart'] = ''; } } $content .= '</ul>' . "\n" . '</div>'; } else { $content = '<div class="sideBoxContent center bold">' . BOX_SHOPPING_CART_EMPTY . '</div>'; } if ($_SESSION['cart']->count_contents() > 0) { $content .= '<hr />'; $content .= '<div class="cartBoxTotal">' . $currencies->format($_SESSION['cart']->show_total()) . '</div>'; $content .= '<br class="clearBoth" />'; } $content .= '**</div>**'; if (isset($_SESSION['customer_id'])) { $gv_query = "select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $_SESSION['customer_id'] . "'"; $gv_result = $db->Execute($gv_query); if ($gv_result->fields['amount'] > 0 ) { $content .= '<div id="cartBoxGVButton" class="sideBoxContent"><a href="' . zen_href_link(FILENAME_GV_SEND, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_SEND_A_GIFT_CERT , BUTTON_SEND_A_GIFT_CERT_ALT) . '</a></div>'; $content .= '<div class="sideBoxContent center bold">' . VOUCHER_BALANCE . $currencies->format($gv_result->fields['amount']) . '</div>'; } $content .= '**</div>**'; } ?>

Hoping this time it's more clarificatory,
bye
Max.

22 May 2006, 6:38 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: [DONE] suggested changes to sideboxes?

Based on the originally-distributed version of the file, here's the fix:
http://www.zen-cart.com/forum/showthread.php?p=205028#post205028

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 May 2006, 7:26 PM
#5
deepmax avatar

deepmax

New Zenner

Join Date:
May 2006
Posts:
6
Plugin Contributions:
0

Re: [DONE] suggested changes to sideboxes?

Thanks to DrByte for the right solution!

:thumbsup: