Jeg har fundet et par contribs, men kunne godt tænke mig noget, der er lidt mere simpelt.
Som nævnt kører jeg med fast takst, og ville gerne have dette med i min Shopping_cart infoboks.
Det kunne se således ud:
Ialt xxx DKK (denne har jeg allerede)
Forsendelse xxx DKK
Ordre total xxx DKK
Min Shopping_cart ser således ud:
<?php
/*
$Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
?>
<!-- shopping_cart //-->
<tr>
<td class="infoBoxContainer">
<?php
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="myInfoBoxHeading"><tr><td class="myInfoBoxHeading"><td width="100%"> ' . BOX_HEADING_SHOPPING_CART . '</td><td>
<a href="http://www.tools4work.dk/shopping_cart.php?osCsid=1838g0g740aa9jovdbmisa7ei5"><img src="mediafiles/images/infobox/arrow_right.gif" border="0" alt="Vis detaljer" title=" Vis detaljer " width="14" height="15"></a>
</td></tr></table>';
// ############ Added CCGV Contribution ##########
// CREDIT CLASS script moved by Rigadin in v5.13 for compatibility with STS
$cart_contents_string ="
<script language=\"javascript\">
function couponpopupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')
}
//--></script>";
// $cart_contents_string = '';
// ############ End Added CCGV Contribution ##########
// $cart_contents_string = '';
if ($cart->count_contents() > 0) {
// start of content
// This creates the tabel used to control the display of the cart contents cellpadding changed to 1 to add a little space
// between pictures and added a class to give seperatecontrol over this info
// ############ Added CCGV Contribution ##########
$cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0" class"cartInfoBox">';
$cart_contents_string .= '<table border="0" width="100%" cellspacing="0" cellpadding="0" class"cartInfoBox">'; // Modified in v5.13 by Rigadin for STS compatibility
// ############ End Added CCGV Contribution ##########
//$cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';
$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
//makes the <tr> and starts the fist cell in the row that contains the number of items
// Changed the class name to allow seperate control from the stylesheet of the content and changed the valign from top to middle to center it with respect to the image
$cart_contents_string .= '<tr><td align="right" valign="middle" class="cartInfoBoxContents">';
// This section adds a span with a class to the first cell depending on if it's the latest product or an existing
// changed the name of the classes to consistency in the classes used
if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
$cart_contents_string .= '<span class="cartInfoBoxContentsNew">';
} else {
$cart_contents_string .= '<span class="cartInfoBoxContents">';
}
// First part $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td>
// create the contents of the first cell showing how many of a given item that is in the cart followed by x
// second part <td valign="middle" class="cartInfoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';
// Starts the second cell and starts the link to the product in the catalog
$cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="middle" class="cartInfoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';
// This section adds a span with a class to the second cell depending on if it's the latest product or an existing
// changed the name of the classes to consistency in the classes used
if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
$cart_contents_string .= '<span class="cartInfoBoxContentsNew">';
} else {
$cart_contents_string .= '<span class="cartInfoBoxContents">';
}
// The first part $cart_contents_string .= $products[$i]['name'] . '</span></a></td> ends the link in the secondcell and ends the second cell
// Then this <td>' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], 40) . '</td></tr>'; starts the 3 cell containing the picture
// the number in $products[$i]['name'], 40 defines the width of the image
$cart_contents_string .= $products[$i]['name'] . '</span></a></td><td align="right" class="cartInfoBoxContentsPic">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], 40) . '</td></tr>';
if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
tep_session_unregister('new_products_id_in_cart');
}
}
// This ends the tabel listing the products in the cart or displays the cart emty message if that is the case
$cart_contents_string .= '</table>';
} else {
$cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
}
$info_box_contents = array();
$info_box_contents[] = array('text' => $cart_contents_string);
if ($cart->count_contents() > 0) {
// If there's anything ind the cart this draws a line under the products
$info_box_contents[] = array('text' => tep_draw_separator());
// 1st line aligns the total amount to the right 2nd line shows the total
$info_box_contents[] = array('align' => 'right',
'text' => 'I alt ' . $currencies->format($cart->show_total()) . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . HEADER_TITLE_CHECKOUT . '</a>');
}
// ############ Added CCGV Contribution ##########
if (tep_session_is_registered('customer_id')) {
$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
$gv_result = tep_db_fetch_array($gv_query);
if ($gv_result['amount'] > 0 ) {
$info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_BALANCE . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($gv_result['amount']) . '</td></tr></table>');
$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext"><a href="'. tep_href_link(FILENAME_GV_SEND) . '">' . BOX_SEND_TO_FRIEND . '</a></td></tr></table>');
}
}
if (tep_session_is_registered('gv_id')) {
$gv_query = tep_db_query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'");
$coupon = tep_db_fetch_array($gv_query);
$info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_REDEEMED . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($coupon['coupon_amount']) . '</td></tr></table>');
}
/*if (tep_session_is_registered('cc_id') && $cc_id) {
$info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . CART_COUPON . '</td><td class="smalltext" align="right" valign="bottom">' . '<a href="javascript:couponpopupWindow(\'' . tep_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $cc_id) . '\')">' . CART_COUPON_INFO . '</a>' . '</td></tr></table>');
}*/
/* Serialio.com Edit Begin */
if (tep_session_is_registered('cc_id') && $cc_id) {
$coupon_query = tep_db_query("select * from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'");
$coupon = tep_db_fetch_array($coupon_query);
$coupon_desc_query = tep_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $cc_id . "' and language_id = '" . $languages_id . "'");
$coupon_desc = tep_db_fetch_array($coupon_desc_query);
$text_coupon_help = sprintf("%s",$coupon_desc['coupon_name']);
$info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
$info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="infoBoxContents_1">' . CART_COUPON . $text_coupon_help . '<br>' . '</td></tr></table>');
}
/* Serialio.com Edit End */
// ############ End Added CCGV Contribution ##########
new infoBox($info_box_contents);
?>
</td>
</tr>
<!-- shopping_cart_eof //-->
Jeg tror det er heromkring jeg skal pille:
// 1st line aligns the total amount to the right 2nd line shows the total
$info_box_contents[] = array('align' => 'right',
'text' => 'I alt ' . $currencies->format($cart->show_total()) . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . HEADER_TITLE_CHECKOUT . '</a>');
}
Hvordan klarer jeg lige den?
Guide til de . Vi tester bla. og .