25 Feb 2013, 3:46 PM
New Zenner
- Join Date:
- Nov 2011
- Posts:
- 38
- Plugin Contributions:
- 0
Customizing Shopping Cart Sidebox, Sub Total, Vat and Layout
Hi all
Been creating a custom template.
Recently been editting the shopping cart sidebox.
Been trying to get the below layout:
I have added divs around the cart items, qty, product name and product price. This works to the extent as pictured however this is with only 2 divs added around qty and product name. If i add 3 divs then the tyle turns out as below:
I have the below code which creates this effect:
Css```
.checkoutButton {
float:left;
width: 60px;
height: 25px;
margin-left: 80px;
}
.emptyCartButton {
float: right;
width: 60px;
height: 25px;
}
.cartBoxQuantity {
float:left;
width: 20px;
}
.cartBoxProductName {
float:left;
width: 150px;
}
.cartBoxProductPrice {
float: right;
width : 20px;
margin-right: 20px;
}
and this code for the cart page:
<?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 4821 2006-10-23 10:54:15Z drbyte $
*/
$content ="";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
if ($_SESSION['cart']->count_contents() > 0) {
$content .= '<div id="cartBoxListWrapper">' . "\n" . '<ul>' . "\n";
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$content .= '<li>';
$content .= '<div class="cartBoxConatiner">';
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 .= '<div class="cartBoxQuantity">'.$products[$i]['quantity'] . BOX_SHOPPING_CART_DIVIDER . '<a href="' . zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']) . '">'.'</div>';
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 .= '<div class="cartBoxProductName">' . $products[$i]['name'] . "\n". '</div>' ;
$content .= '<div class="cartBoxProductPrice">' . $currencies->format($products[$i]['price']) . "\n" . '</div>';
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 id="cartBoxEmpty">' . BOX_SHOPPING_CART_EMPTY . '</div>';
}
if ($_SESSION['cart']->count_contents() > 0) {
$content .= '<div class="cartBoxSubTotal">' .'Subtotal:  '. $currencies->format($_SESSION['cart']->show_total()) . '</div>';
$content .= '<div class="cartBoxVAT">' .'Vat:  '. $currencies->format($_SESSION['cart']->show_total()) . '</div>';
$content .= '<div class="cartBoxTotal">' .'Total:  '. $currencies->format($_SESSION['cart']->show_total()) . '</div>';
$content .= '<br class="clearBoth" />';
$content .= '<div class="checkoutButton">'.'<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'.'</div>' . '<div class="emptyCartButton">'.'<a href="' . zen_href_link("shopping_cart&action=empty_cart") . '">' . zen_image_button(BUTTON_IMAGE_DELETE, BUTTON_DELETE_ALT) . '</a>'.'</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->RecordCount() && $gv_result->fields['amount'] > 0 ) {
$content .= '<div id="cartBoxGVButton"><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 id="cartBoxVoucherBalance">' . VOUCHER_BALANCE . $currencies->format($gv_result->fields['amount']) . '</div>';
}
}
$content .= '</div>';
?>
I also need code to display VAT and grand total (the total on the page above is the actual total without VAT added).
Any help appreciated.