How can I show a "grand total" dollar amount below the following prices.
Product Total: $164.80
Coupon (-10%): -$10.00
Shipping & Handling (USA Only): $19.95
GRAND TOTAL:
Currently it dosen't show the grand total just the seperate totals.
Product Total: $164.80
Coupon (-10%): -$10.00
Shipping & Handling (USA Only): $19.95
GRAND TOTAL:
Currently it dosen't show the grand total just the seperate totals.
I still can't see the user group page, but somehow moving forward in installing your mods
. I have installed OC twice and both stores don't have the user group page found. It is really weird, it is only that one page like that.
Moving on to the grand totals, it would be nice to have the coupon at the very end of all calculations, but also on another note we have no sales tax to deal or worry about here in Oregon.
This is what I am getting:
Subtotal: $164.80
Shipping & Handling UPS Ground (USA Only): $29.95
Coupon (-10%): -$19.48
No Grand Total.
What php code controls the Grand total is it (total.php) I just would like the final amount to appear on the Checkout Confirmation page before the buyer click "I agree to the terms..."

Moving on to the grand totals, it would be nice to have the coupon at the very end of all calculations, but also on another note we have no sales tax to deal or worry about here in Oregon.
This is what I am getting:
Subtotal: $164.80
Shipping & Handling UPS Ground (USA Only): $29.95
Coupon (-10%): -$19.48
No Grand Total.
What php code controls the Grand total is it (total.php) I just would like the final amount to appear on the Checkout Confirmation page before the buyer click "I agree to the terms..."
Try this...
In your store admin, from the menu Extensions->Calculate
Check that each one has a unique sort order with the Total having the highest value. Duplicate sort order causes the second and subsequent totals with the same sort order to disappear.
In your store admin, from the menu Extensions->Calculate
Check that each one has a unique sort order with the Total having the highest value. Duplicate sort order causes the second and subsequent totals with the same sort order to disappear.
This fixes the problem if you want to use it.
So far, I am just putting a copy of the msort() function in each class where it is needed. Obviously I want it in a single location at some stage.
The following is a working replacement for library\cart\calculate.php and contains the replaced code in the comments.
Please backup your original before replacing... just in case.
So far, I am just putting a copy of the msort() function in each class where it is needed. Obviously I want it in a single location at some stage.
The following is a working replacement for library\cart\calculate.php and contains the replaced code in the comments.
Please backup your original before replacing... just in case.
Code: Select all
<?php
class Calculate
{
var $data = array();
function __construct(&$locator)
{
$this->database =& $locator->get('database');
$results = $this->database->getRows("select * from extension where type = 'calculate'");
foreach ($results as $result)
{
$file = DIR_EXTENSION . $result['directory'] . '/' . $result['filename'];
$class = 'Calculate' . str_replace('_', '', $result['code']);
if (file_exists($file))
{
require_once($file);
$this->data[$result['code']] = new $class($locator);
}
}
}
function getTotals()
{
$sort_data = array();
foreach (array_keys($this->data) as $key)
{
$order = $this->data[$key]->getSortOrder();
$sort_data[] = array('order' => $order, 'key' => $key);
}
$sorted = $this->msort($sort_data, "order");
$total_data = array();
$i = 0;
foreach ($sorted as $key =>$calculator)
{
$results = $this->data[$calculator['key']]->calculate();
foreach ($results as $result)
{
$total_data[] = array(
'title' => $result['title'],
'text' => $result['text'],
'value' => $result['value'],
'sort_order' => $i
);
$i++;
}
}
return $total_data;
}
function msort($array, $id="id", $sort_ascending=true)
{
$temp_array = array();
while(count($array)>0)
{
$lowest_id = 0;
$index=0;
foreach ($array as $item)
{
if (isset($item[$id]))
{
if ($array[$lowest_id][$id])
{
if ($item[$id]<$array[$lowest_id][$id])
{
$lowest_id = $index;
}
}
}
$index++;
}
$temp_array[] = $array[$lowest_id];
$array = array_merge(array_slice($array, 0,$lowest_id), array_slice($array, $lowest_id+1));
}
if ($sort_ascending)
{
return $temp_array;
}
else
{
return array_reverse($temp_array);
}
}
/*
The following original code is flawed in that a duplicate value for sort_order over
any of the calculate extensions will cause the first instance(s) to simply disappear.
function getTotals()
{
$sort_order = array();
foreach (array_keys($this->data) as $key)
{
//$sort_order[$this->data[$key]->getSortOrder()] = $key;
$order = $this->data[$key]->getSortOrder();
$sort_order[] = array('order' => $order, 'name' => $key);
}
ksort($sort_order);
$total_data = array();
$i = 0;
foreach ($sort_order as $key)
{
$results = $this->data[$key]->calculate();
foreach ($results as $result)
{
$total_data[] = array(
'title' => $result['title'],
'text' => $result['text'],
'value' => $result['value'],
'sort_order' => $i
);
$i++;
}
}
return $total_data;
}
*/
}
?>
Ah yes... this is harder. As you can see in this extract from checkout_confirm.tpl, all the calculated totals have the same style.nextgenxx wrote: Thanks Bruce, It worked! Also, how can I make the grand total Bold.
Code: Select all
<?php foreach ($totals as $total) { ?>
<tr>
<td class="right" colspan="4"><?php echo $total['title']; ?></td>
<td class="right"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
Code: Select all
if ($this->config->get('total_status')) {
$total_data[] = array(
'title' => $this->language->get('text_total_title'),
'text' => $this->currency->format($this->cart->getTotal()),
'value' => $this->cart->getTotal()
);
}
=======
1) Modify catalog\extension\calculate\total.php to replace the above snippet with the following to add a language independant tag to the grand total array...
Code: Select all
if ($this->config->get('total_status')) {
$total_data[] = array(
'title' => $this->language->get('text_total_title'),
'text' => $this->currency->format($this->cart->getTotal()),
'tag ' => 'grand_total',
'value' => $this->cart->getTotal()
);
}
Code: Select all
foreach ($results as $result)
{
$total_data[] = array(
'title' => $result['title'],
'text' => $result['text'],
'value' => $result['value'],
'tag' => isset($result['tag']) ? $result['tag'] : '',
'sort_order' => $i
);
$i++;
}
Code: Select all
<div class="f">
<table>
<?php foreach ($totals as $total)
{
if ($total['tag'] == 'grand_total')
{
?>
<tr>
<td class="right" style="font-weight: bold;" colspan="4"><?php htmlEcho($total['title']); ?></td>
<td class="right" style="font-weight: bold;" ><?php htmlEcho($total['text']); ?></td>
</tr>
<?php
}
else
{
?>
<tr>
<td class="right" colspan="4"><?php htmlEcho($total['title']); ?></td>
<td class="right"><?php htmlEcho($total['text']); ?></td>
</tr>
<?php
}
}
?>
</table>
</div>
Cheers
Bruce
hmmn...I have tried doing this three times now and each time I get through all the steps I get a blank screen at the end. Step one works, step two gets a blank screen and then step three. I have looked closley and don't know what is going wrong.
I was able to change catalog\language\english\extension\calculate\total.php with the following to get the text bold, bot the ammount.
Total:';
?>
I know this probably isn't the correct way to go about, but works now.
Brent
I was able to change catalog\language\english\extension\calculate\total.php with the following to get the text bold, bot the ammount.
Total:';
?>
I know this probably isn't the correct way to go about, but works now.
Brent
Who is online
Users browsing this forum: No registered users and 1 guest