VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: J3DI13 on March 18, 2014, 10:09:25 AM

Title: Change layout of checkout cart columns
Post by: J3DI13 on March 18, 2014, 10:09:25 AM
Hi everyone

Firstly let me explain that i am no coding master, i have researched and tried a couple ways that i thought would work but no luck for me.
I need to change what prices, Vat/tax show in the cart price table at checkout. I have attached a jpeg which shows clearly what needs to
achieved.

I do have this single issue in another post that has a couple of my other issues but this has become very high on the priority list. link here -  http://forum.virtuemart.net/index.php?topic=122724.msg419079#msg419079 (http://forum.virtuemart.net/index.php?topic=122724.msg419079#msg419079)
Jenkinhill did state in my other post that i must
QuoteIf you want to change the order of the columns then you will need to re-arrange the output in the cart/default_pricelist.php that you are using as a template override.

Many Thanks


[attachment cleanup by admin]
Title: Re: Change layout of checkout cart
Post by: J3DI13 on March 20, 2014, 08:18:27 AM
ever so friendly bump  :)
Title: Re: Change layout of checkout cart
Post by: J3DI13 on March 24, 2014, 12:57:01 PM
aaand 1 more friendly bump
Title: Re: Change layout of checkout cart columns
Post by: K&K media production on March 24, 2014, 14:48:24 PM
1. If you bump your posts a mod can not see that nobody has answerd.

2. The answer is the same like Jenkinhill wrote. http://forum.virtuemart.net/index.php?topic=90935.0

With a little bit HTML you can change the layout. If you're not be able to do that, it is possible to make it for you as commercial job.
Title: Re: Change layout of checkout cart columns
Post by: J3DI13 on March 24, 2014, 15:09:44 PM
Thanks for your reply, Sorry i will refrain from bumping my posts from now on (Thanks for the info).

I understand what needs to be done and have tried but i keep on breaking it.... Why VM does not have this as an option in the admin section i have no idea!
Title: Re: Change layout of checkout cart columns
Post by: K&K media production on March 24, 2014, 17:59:16 PM
There are so many possibilities for the cart layout ... you can't handle this with a config. So the most users work with a override and her own layouts.
Title: Re: Change layout of checkout cart columns
Post by: jenkinhill on March 24, 2014, 18:05:06 PM
An issue with being able to provide a solution here is that you are already using an override file (that is not default VM appearance). So nobody will know what changes the template developer already made to the code.
Title: Re: Change layout of checkout cart columns
Post by: J3DI13 on March 25, 2014, 07:27:31 AM
Hi Jenkinhill

As far as i am aware i am not using any overrides but i will gladly supply any file or code that will help. I would do this myself but i just don't have the know how.

Thanks
Title: Re: Change layout of checkout cart columns
Post by: J3DI13 on March 25, 2014, 12:44:30 PM
Ok does VM have any in depth documentation on how to do this?
Title: Re: Change layout of checkout cart columns
Post by: K&K media production on March 25, 2014, 13:44:52 PM
this is a HTML table ... you need HTML knowledge to reorder it

for the different prices and output of product data with php are many threads in this forum

more documentations:
http://docs.virtuemart.net/
http://dev.virtuemart.net/projects/virtuemart/wiki
Title: Re: Change layout of checkout cart columns
Post by: J3DI13 on March 25, 2014, 14:22:32 PM
Thanks for those links, will check them out now.

I understand the HTML side of it but i dont know what php to place to get the output that my clients desires.
Title: Re: Change layout of checkout cart columns
Post by: J3DI13 on March 26, 2014, 08:45:43 AM
Below is the code from the default_pricelist.php which is located in my override in my templates html folder.
I am guessing that i need to replace this  ('COM_VIRTUEMART_CART_SUBTOTAL_TAX_AMOUNT') with the php code to output what i need 1.cost ex Vat and 2.VAT
Now my question is where do i locate such information from the database?

Please i am really stuck here and not a developer just a designer.

Many Thanks

<table
class="cart-summary"
cellspacing="0"
cellpadding="0"
border="0"
width="100%">
<tr>
<th align="left"><?php echo JText::('COM_VIRTUEMART_CART_NAME'?></th>
<th align="left"><?php echo JText::('COM_VIRTUEMART_CART_SKU'?></th>
<th
align="center"
width="60px"><?php echo JText::('COM_VIRTUEMART_CART_PRICE'?></th>
<th
align="right"
width="140px"><?php echo JText::('COM_VIRTUEMART_CART_QUANTITY'?>
/ <?php echo JText::('COM_VIRTUEMART_CART_ACTION'?></th>


<?php if (VmConfig::get ('show_tax')) { ?>
<th align="right" width="60px"><?php  echo "<span  class='priceColor2'>" JText::('COM_VIRTUEMART_CART_SUBTOTAL_TAX_AMOUNT') . '</span>' ?></th>
<?php ?>
<th align="right" width="60px"><?php echo "<span  class='priceColor2'>" JText::('COM_VIRTUEMART_CART_SUBTOTAL_DISCOUNT_AMOUNT') . '</span>' ?></th>
<th align="right" width="70px"><?php echo JText::('COM_VIRTUEMART_CART_TOTAL'?></th>
</tr>



<?php
$i 
1;
//  vmdebug('$this->cart->products',$this->cart->products);
foreach ($this->cart->products as $pkey => $prow) {
?>

<tr valign="top" class="sectiontableentry<?php echo $i ?>">
<td align="left">
<?php if ($prow->virtuemart_media_id) { ?>
<span class="cart-images">
<?php
if (!empty($prow->image)) {
echo $prow->image->displayMediaThumb (''FALSE);
}
?>

</span>
<?php ?>
<?php echo JHTML::link ($prow->url$prow->product_name) . $prow->customfields?>

</td>
<td align="left"><?php  echo $prow->product_sku ?></td>
<td align="center">
<?php
if (VmConfig::get ('checkout_show_origprice'1) && $this->cart->pricesUnformatted[$pkey]['discountedPriceWithoutTax'] != $this->cart->pricesUnformatted[$pkey]['priceWithoutTax']) {
echo '<span class="line-through">' $this->currencyDisplay->createPriceDiv ('basePriceVariant'''$this->cart->pricesUnformatted[$pkey], TRUEFALSE) . '</span><br />';
}
if ($this->cart->pricesUnformatted[$pkey]['discountedPriceWithoutTax']) {
echo $this->currencyDisplay->createPriceDiv ('discountedPriceWithoutTax'''$this->cart->pricesUnformatted[$pkey], FALSEFALSE);
} else {
echo $this->currencyDisplay->createPriceDiv ('basePriceVariant'''$this->cart->pricesUnformatted[$pkey], FALSEFALSE);
}
//  echo $prow->salesPrice ;
?>

</td>
<td align="right"><?php
// $step=$prow->min_order_level;
if ($prow->step_order_level)
$step=$prow->step_order_level;
else
$step=1;
if($step==0)
$step=1;
$alert=JText::sprintf ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED'$step);
?>

                <script type="text/javascript">
function check<?php echo $step?>(obj) {
// use the modulus operator '%' to see if there is a remainder
remainder=obj.value % <?php echo $step?>;
quantity=obj.value;
if (remainder  != 0) {
alert('<?php echo $alert?>!');
obj.value = quantity-remainder;
return false;
}
return true;
}
</script>
<form action="<?php echo JRoute::('index.php'); ?>" method="post" class="inline">
<input type="hidden" name="option" value="com_virtuemart"/>
<!--<input type="text" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" class="inputbox" size="3" maxlength="4" name="quantity" value="<?php echo $prow->quantity ?>" /> -->
            <input type="text"
   onblur="check<?php echo $step?>(this);"
   onclick="check<?php echo $step?>(this);"
   onchange="check<?php echo $step?>(this);"
   onsubmit="check<?php echo $step?>(this);"
   title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" class="quantity-input js-recalculate" size="3" maxlength="4" name="quantity" value="<?php echo $prow->quantity ?>" />
<input type="hidden" name="view" value="cart"/>
<input type="hidden" name="task" value="update"/>
<input type="hidden" name="cart_virtuemart_product_id" value="<?php echo $prow->cart_item_id  ?>"/>
<input type="submit" class="vmicon vm2-add_quantity_cart" name="update" title="<?php echo  JText::('COM_VIRTUEMART_CART_UPDATE'?>" align="middle" value=" "/>
</form>
<a class="vmicon vm2-remove_from_cart" title="<?php echo JText::('COM_VIRTUEMART_CART_DELETE'?>" align="middle" href="<?php echo JRoute::('index.php?option=com_virtuemart&view=cart&task=delete&cart_virtuemart_product_id=' $prow->cart_item_id?>" rel="nofollow"> </a>
</td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo "<span class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('taxAmount'''$this->cart->pricesUnformatted[$pkey], FALSEFALSE$prow->quantity) . "</span>" ?></td>
<?php ?>
<td align="right"><?php echo "<span class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('discountAmount'''$this->cart->pricesUnformatted[$pkey], FALSEFALSE$prow->quantity) . "</span>" ?></td>
<td colspan="1" align="right">
<?php
if (VmConfig::get ('checkout_show_origprice'1) && !empty($this->cart->pricesUnformatted[$pkey]['basePriceWithTax']) && $this->cart->pricesUnformatted[$pkey]['basePriceWithTax'] != $this->cart->pricesUnformatted[$pkey]['salesPrice']) {
echo '<span class="line-through">' $this->currencyDisplay->createPriceDiv ('basePriceWithTax'''$this->cart->pricesUnformatted[$pkey], TRUEFALSE$prow->quantity) . '</span><br />';
}
elseif (VmConfig::get ('checkout_show_origprice'1) && empty($this->cart->pricesUnformatted[$pkey]['basePriceWithTax']) && $this->cart->pricesUnformatted[$pkey]['basePriceVariant'] != $this->cart->pricesUnformatted[$pkey]['salesPrice']) {
echo '<span class="line-through">' $this->currencyDisplay->createPriceDiv ('basePriceVariant'''$this->cart->pricesUnformatted[$pkey], TRUEFALSE$prow->quantity) . '</span><br />';
}
echo $this->currencyDisplay->createPriceDiv ('salesPrice'''$this->cart->pricesUnformatted[$pkey], FALSEFALSE$prow->quantity?>
</td>
</tr>
<?php
$i = ($i==1) ? 1;
?>

<!--Begin of SubTotal, Tax, Shipment, Coupon Discount and Total listing -->
<?php if (VmConfig::get ('show_tax')) {
$colspan 3;
} else {
$colspan 2;
?>

<tr>
<td colspan="4">&nbsp;</td>

<td colspan="<?php echo $colspan ?>">
<hr/>
</td>
</tr>
<tr class="sectiontableentry1">
<td colspan="4" align="right"><?php echo JText::('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_PRICES_TOTAL'); ?></td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('taxAmount'''$this->cart->pricesUnformattedFALSE) . "</span>" ?></td>
<?php ?>
<td align="right"><?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('discountAmount'''$this->cart->pricesUnformattedFALSE) . "</span>" ?></td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPrice'''$this->cart->pricesUnformattedFALSE?></td>
</tr>

<?php
if (VmConfig::get ('coupons_enable')) {
?>

<tr class="sectiontableentry2">
<td colspan="4" align="left">
<?php if (!empty($this->layoutName) && $this->layoutName == 'default') {
// echo JHTML::_('link', JRoute::_('index.php?view=cart&task=edit_coupon',$this->useXHTML,$this->useSSL), JText::_('COM_VIRTUEMART_CART_EDIT_COUPON'));
echo $this->loadTemplate ('coupon');
}
?>


<?php if (!empty($this->cart->cartData['couponCode'])) { ?>
<?php
echo 
$this->cart->cartData['couponCode'];
echo $this->cart->cartData['couponDescr'] ? (' (' $this->cart->cartData['couponDescr'] . ')') : '';
?>


</td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('couponTax'''$this->cart->pricesUnformatted['couponTax'], FALSE); ?> </td>
<?php ?>
<td align="right"> </td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPriceCoupon'''$this->cart->pricesUnformatted['salesPriceCoupon'], FALSE); ?> </td>
<?php } else { ?>
</td><td colspan="3" align="left">&nbsp;</td>
<?php
}

?>

</tr>
<?php ?>


<?php
foreach ($this->cart->cartData['DBTaxRulesBill'] as $rule) {
?>

<tr class="sectiontableentry<?php echo $i ?>">
<td colspan="4" align="right"><?php echo $rule['calc_name'?> </td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"></td>
<?php ?>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->pricesUnformatted[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?></td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->pricesUnformatted[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?> </td>
</tr>
<?php
if (
$i) {
$i 1;
} else {
$i 0;
}
?>


<?php

foreach ($this->cart->cartData['taxRulesBill'] as $rule) {
?>

<tr class="sectiontableentry<?php echo $i ?>">
<td colspan="4" align="right"><?php echo $rule['calc_name'?> </td>
<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->pricesUnformatted[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?> </td>
<?php ?>
<td align="right"><?php ?> </td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->pricesUnformatted[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?> </td>
</tr>
<?php
if (
$i) {
$i 1;
} else {
$i 0;
}
}

foreach (
$this->cart->cartData['DATaxRulesBill'] as $rule) {
?>

<tr class="sectiontableentry<?php echo $i ?>">
<td colspan="4" align="right"><?php echo   $rule['calc_name'?> </td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"></td>

<?php ?>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->pricesUnformatted[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?>  </td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->pricesUnformatted[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?> </td>
</tr>
<?php
if (
$i) {
$i 1;
} else {
$i 0;
}
?>



<tr class="sectiontableentry1" valign="top">
<?php if (!$this->cart->automaticSelectedShipment) { ?>

<?php /* <td colspan="2" align="right"><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING'); ?> </td> */ ?>
<td colspan="4" align="left">
<?php echo $this->cart->cartData['shipmentName']; ?>
<br/>
<?php
if (!empty(
$this->layoutName) && $this->layoutName == 'default' && !$this->cart->automaticSelectedShipment) {
if (VmConfig::get('oncheckout_opc'0)) {
$previouslayout $this->setLayout('select');
echo $this->loadTemplate('shipment');
$this->setLayout($previouslayout);
} else {
echo JHTML::_('link'JRoute::_('index.php?view=cart&task=edit_shipment'$this->useXHTML$this->useSSL), $this->select_shipment_text'class=""');
}
} else {
echo JText::('COM_VIRTUEMART_CART_SHIPPING');
}?>

</td>
<?php
} else {
?>

<td colspan="4" align="left">
<?php echo $this->cart->cartData['shipmentName']; ?>
</td>
<?php ?>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('shipmentTax'''$this->cart->pricesUnformatted['shipmentTax'], FALSE) . "</span>"?> </td>
<?php ?>
<td align="right"><?php if($this->cart->pricesUnformatted['salesPriceShipment'] < 0) echo $this->currencyDisplay->createPriceDiv ('salesPriceShipment'''$this->cart->pricesUnformatted['salesPriceShipment'], FALSE); ?></td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPriceShipment'''$this->cart->pricesUnformatted['salesPriceShipment'], FALSE); ?> </td>
</tr>
<?php if ($this->cart->pricesUnformatted['salesPrice']>0.0 ) { ?>
<tr class="sectiontableentry1" valign="top">
<?php if (!$this->cart->automaticSelectedPayment) { ?>

<td colspan="4" align="left">
<?php echo $this->cart->cartData['paymentName']; ?>
<br/>
<?php if (!empty($this->layoutName) && $this->layoutName == 'default') {
if (VmConfig::get('oncheckout_opc'0)) {
$previouslayout $this->setLayout('select');
echo $this->loadTemplate('payment');
$this->setLayout($previouslayout);
} else {
echo JHTML::_('link'JRoute::_('index.php?view=cart&task=editpayment'$this->useXHTML$this->useSSL), $this->select_payment_text'class=""');
}
} else {
echo JText::('COM_VIRTUEMART_CART_PAYMENT');
?>
</td>

</td>
<?php } else { ?>
<td colspan="4" align="left"><?php echo $this->cart->cartData['paymentName']; ?> </td>
<?php ?>
<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('paymentTax'''$this->cart->pricesUnformatted['paymentTax'], FALSE) . "</span>"?> </td>
<?php ?>
<td align="right"><?php if($this->cart->pricesUnformatted['salesPricePayment'] < 0) echo $this->currencyDisplay->createPriceDiv ('salesPricePayment'''$this->cart->pricesUnformatted['salesPricePayment'], FALSE); ?></td>
<td align="right"><?php  echo $this->currencyDisplay->createPriceDiv ('salesPricePayment'''$this->cart->pricesUnformatted['salesPricePayment'], FALSE); ?> </td>
</tr>
<?php ?>
<tr>
<td colspan="4">&nbsp;</td>
<td colspan="<?php echo $colspan ?>">
<hr/>
</td>
</tr>
<tr class="sectiontableentry2">
<td colspan="4" align="right"><?php echo JText::('COM_VIRTUEMART_CART_TOTAL'?>:</td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"> <?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('billTaxAmount'''$this->cart->pricesUnformatted['billTaxAmount'], FALSE) . "</span>" ?> </td>
<?php ?>
<td align="right"> <?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('billDiscountAmount'''$this->cart->pricesUnformatted['billDiscountAmount'], FALSE) . "</span>" ?> </td>
<td align="right"><div class="bold"><?php echo $this->currencyDisplay->createPriceDiv ('billTotal'''$this->cart->pricesUnformatted['billTotal'], FALSE); ?></div></td>
</tr>
<?php
if ($this->totalInPaymentCurrency) {
?>


<tr class="sectiontableentry2 totalInPaymentCurrency">
<td colspan="4" align="right"><?php echo JText::('COM_VIRTUEMART_CART_TOTAL_PAYMENT'?>:</td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"></td>
<?php ?>
<td align="right"></td>
<td align="right"><strong><?php echo $this->totalInPaymentCurrency;   ?></strong></td>
</tr>
<?php
}
?>



</table>