News:

Support the VirtueMart project and become a member

Main Menu

Coupon amount displayed in wrong position...[SOLVED]

Started by jpreskitt, August 27, 2012, 19:59:55 PM

Previous topic - Next topic

jpreskitt

...or perhaps the correct position.
I've attached a screenshot of my cart with products in it and a coupon code applied.
The 'dollars off' number appears in the debit column and not the credit:
<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"><strong><?php echo $this->currencyDisplay->createPriceDiv('billTotal',''$this->cart->pricesUnformatted['billTotal'],false); ?></strong></td>
  </tr>

URL: www.teenyscreenies.com

Any help is appreciated!
Thanks,
John

--
joomla 2.5.6
vm 2.0.8e


[attachment cleanup by admin]

ivus

Hi jpreskitt,

Interesting. My default install template looks not like yours...



<?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">&nbsp;</td>
      <td align="right"><?php echo $this->currencyDisplay->createPriceDiv('salesPriceCoupon',''$this->cart->pricesUnformatted['salesPriceCoupon'],false); ?></td>
      <?php } else { ?>
      <td colspan="6" align="left">&nbsp;</td>
      <?php }
    
    
?>

    </tr>
<?php ?>



Are you sure you've copied the correct code snippet?


jpreskitt

Hey ivus,
Thanks for the response. I just copy and pasted your code and same thing. The coupon amount shows up under the far right column, not the discount column. The math is correct but the table isn't. Does yours behave this way?
Screen shot of your code in my 'defaut_pricelist.php' file.
Thanks!
John


[attachment cleanup by admin]

ivus

Hi jpreskitt,

I didn't change anything? I merely pasted my default code into the post to highlight the fact that you were using the wrong code.

Now it's not difficult to figure out that the layout needs to be altered slightly???

<td align="right">&nbsp;</td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv('salesPriceCoupon','', $this->cart->pricesUnformatted['salesPriceCoupon'],false); ?></td>

swap these two lines over

<td align="right"><?php echo $this->currencyDisplay->createPriceDiv('salesPriceCoupon','', $this->cart->pricesUnformatted['salesPriceCoupon'],false); ?></td>
<td align="right">&nbsp;</td>

That should achieve what you want.

jpreskitt

Got it! Actually I think there was an nsbp in a cell i had to move the php over one more.
Actually, I think i had an extra data cell, which i just deleted. My final code is:
    <td align="right"><?php echo $this->currencyDisplay->createPriceDiv('salesPriceCoupon',''$this->cart->pricesUnformatted['salesPriceCoupon'],false); ?></td>
<td align="right">&nbsp;</td>


So thanks a bunch! And BTW, all my coupons were a positive percentage off not a -negative, so we hit two birds with this one.
Thanks for the quick response!
John