VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: jjk on September 21, 2011, 18:55:29 PM

Title: Hide discount in cart possible?
Post by: jjk on September 21, 2011, 18:55:29 PM
I have a problem with the discount display in the cart.
Case description: I'm using calculation rules named "Shipping Cost" (the shipping cost which my various suppliers are charging me) which is set it to DBtax (Discount before tax - actually not a discount). This way I can convert my actual shipping cost to my local currency and include it into my final price calculation. The price calculation works fine. Only problem is that the calculated amount and the final price minus that amount - the latter as a strikethrough price -  are shown in the cart. It is beeing displayed despite unchecking display 'The discount amount' in BE - Configuration - Pricing tab - Show Following Prices.

Would be nice to have a switch to hide it in the cart, too.

See screenshot below

[attachment cleanup by admin]
Title: Re: Hide discount in cart possible?
Post by: PRO on September 21, 2011, 19:08:43 PM
Do you mean the price with the strike through? IF so, you can change this code

views/cart/default_pricelist.php
<?php if ($prow->basePriceWithTax != $prow->salesPrice ) {
                  echo '<span style="text-decoration:line-through">'.$prow->basePriceWithTax .'</span><br />' ;
               }
               echo $prow->salesPrice ;
               ?>

to this

<?php echo $prow->salesPrice ?>


Title: Re: Hide discount in cart possible?
Post by: jjk on September 21, 2011, 20:43:26 PM
Thanks,
I'll consider that as an intermediate solution. Actually I need to get rid of both, the "Base Price with tax" and the "Discount amount" which actually is a surcharge in my calculation rules and should be hidden for customers in the cart view, too.
Title: Re: Hide discount in cart possible?
Post by: mark001 on September 23, 2011, 11:24:11 AM
Hi,

not sure if this will help you but I turned this off in the Configuration -> Pricing tab. Here are my settings:

Baseprice                                    [ v ] [ v ] [ 2 ]
Baseprice modificator                           [ v ] [ v ] [ 2 ]
The new baseprice modificated by choosen product variant      [ v ] [ v ] [ 2 ]
The baseprice with Tax, but without discounts            [ v ] [ v ] [ 2 ]

I have unselected following settings:
Discounted Price without tax         
This is the salesprice with discount         
The final salesprice         
The salesprice without tax         
The discount amount         
Tax amount
Title: Re: Hide discount in cart possible?
Post by: jjk on September 23, 2011, 12:24:37 PM
@mark001
Thanks, but my problem is that I "misuse" the discount calculation rule for calculating a surcharge. For this special case I need to unselect 'The baseprice with Tax, but without discounts' and the 'Discount amount', which works on the product views. Unfortunately unchecking these prices doesn't prevent them from being displayed in the cart.

I can use this recommendation by Milbo (thanks for the reminder)
Quote from: Milbo on September 22, 2011, 03:06:53 AM
Use template override for this :-)

...but this has the disadvantage that I can't display "real" discounts. However, since I hardly ever use temporary discounts in real life, I can live with that.  ;)
Title: Re: Hide discount in cart possible?
Post by: MoneyMagnets on October 20, 2011, 00:29:48 AM
So how is the discount amount removed from the checkout? I see how the strike through price is removed but I thought the question asks how both can be removed?

My client wants the discount amount removed completely from the cart since she won't be offering any discounts.

And yes I agree with jjk that it would be nice to have a switch to hide or display discounts in the cart.

Thanks,
Karen   

[attachment cleanup by admin]
Title: Re: Hide discount in cart possible?
Post by: MoneyMagnets on October 27, 2011, 21:10:43 PM
Here's how I removed the discount in the cart:

I replaced lines 128, 168, 187, 276 and 317 (all lines that mention discount) in file views/cart/default_pricelist.php with

<td colspan="1">&nbsp;</td>

The attachment shows what this looks like. Please test before using yourself.

Cheers,
Karen 

[attachment cleanup by admin]
Title: Re: Hide discount in cart possible?
Post by: TOAOMatis on November 12, 2011, 12:59:39 PM
I'm suffering the same problem.

Currently I'm configuring a webshop that (as of this moment) doesn't have discounts and no need for tax display, whilst there are only private customers.

I prefer not to "hack" (edit) the views, while with every update it is overwritten. Therefore I would prefer some intelligence, that (when there are no discounts in the shopping cart ) discount isn't desplayed at al (dynamic), or through static config in the BE.
Title: Re: Hide discount in cart possible?
Post by: Patrick on November 20, 2011, 20:02:34 PM
Also did this hack now the cart looks better :D
But the email confirmation does show the discount prices.
Any one know how to fix the email confirmation layout?

Thanks Patrick
Title: Re: Hide discount in cart possible?
Post by: trevorsm on December 23, 2011, 12:48:35 PM
My customer also does not offer discounts and I have deselected 'Discount amount' on the Pricing configuration page but the column still appears on the emails and the struck out £0.00 is displayed on the emails. This means there is a lot of hacking to do to get rid of it when it would be much better for it to conform to the settings.

Is this on the to-do list?
Title: Re: Hide discount in cart possible?
Post by: becq on March 20, 2012, 15:03:45 PM
I'd like to up this as I am also having difficulties adjusting the appearance of the cart. I dont want the sku nor the VAT be shown in the product line but only at the end. I did set my VAT to VAT on bill, it is actually doing so, but it is also showing in the product line VAT 0,00 EURO which then is obviously wrong.

Not entirely related to this topic but still somehow related is my question relating custom fields for product options. I am offering an addition to my product for $ 100 but even though the only VAT rule I have is 19 % VAT on bill it still shows the option with 19% included, therefore it being $ 119 in the product view.
Title: Re: Hide discount in cart possible?
Post by: Leonard Michael on May 22, 2012, 10:40:35 AM
Me to! I'd like to remove "Discount" from the cart page. It's useless to me.

Anybody?

Respectfully,
LMW1
Title: Re: Hide discount in cart possible?
Post by: tutyi on July 02, 2012, 21:26:41 PM
Hi,

you must change line 210 in /components/com_virtuemart/assets/css/vmsite-ltr.css:

.priceColor2{color:gray;}

to

.priceColor2{color:gray;display:none;}

Tested on VM2.0.8a

Problem with this: TAX will also disappear in cart even if it's not turned off.
Title: Re: Hide discount in cart possible?
Post by: plunk on June 06, 2015, 10:59:31 AM
This worked for me in Joomla 3, Virtuemart 3, default_pricelist.php

<fieldset class="vm-fieldset-pricelist">
<table
   class="cart-summary"
   cellspacing="0"
   cellpadding="0"
   border="0"
   width="100%">
<tr>
   <th align="left"><?php echo vmText::_ ('COM_VIRTUEMART_CART_NAME') ?></th>
   <th align="left"><?php echo vmText::_ ('COM_VIRTUEMART_CART_SKU') ?></th>
   <th
      style="min-width:70px;width:5%;align:right;text-align:center"><?php echo vmText::_ ('COM_VIRTUEMART_CART_PRICE') ?></th>
   <th
      style="min-width:120px;width:10%;align:right;text-align:center"><?php echo vmText::_ ('COM_VIRTUEMART_CART_QUANTITY') ?>
      / <?php echo vmText::_ ('COM_VIRTUEMART_CART_ACTION') ?></th>


   <?php if (VmConfig::get ('show_tax')) {
      $tax = vmText::_ ('COM_VIRTUEMART_CART_SUBTOTAL_TAX_AMOUNT');
      if(!empty($this->cart->cartData['VatTax'])){
         reset($this->cart->cartData['VatTax']);
         $taxd = current($this->cart->cartData['VatTax']);
         $tax = $taxd['calc_name'] .' '. rtrim(trim($taxd['calc_value'],'0'),'.').'%';
      }
      ?>
   <th style="min-width:76px;width:5%;align:right;text-align:center" ><?php echo "<span  class='priceColor2'>" . $tax . '</span>' ?></th>
   <?php } ?>
   <th style="min-width:80px;width:5%;align:right;text-align:center" ><?php echo vmText::_ ('COM_VIRTUEMART_CART_TOTAL') ?></th>
</tr>

<?php
$i = 1;

foreach ($this->cart->products as $pkey => $prow) { ?>

<tr valign="top" class="sectiontableentry<?php echo $i ?>">
   <input type="hidden" name="cartpos[]" value="<?php echo $pkey ?>">
   <td align="left">
      <?php if ($prow->virtuemart_media_id) { ?>
      <span class="cart-images">
                   <?php
         if (!empty($prow->images[0])) {
            echo $prow->images[0]->displayMediaThumb ('', FALSE);
         }
         ?>
                  </span>
      <?php } ?>
      <?php echo JHtml::link ($prow->url, $prow->product_name);
         echo $this->customfieldsModel->CustomsFieldCartDisplay ($prow);
       ?>

   </td>
   <td align="left"><?php  echo $prow->product_sku ?></td>
   <td align="right">
      <?php
      if (VmConfig::get ('checkout_show_origprice', 1) && $prow->prices['discountedPriceWithoutTax'] != $prow->prices['priceWithoutTax']) {
         echo '<span class="line-through">' . $this->currencyDisplay->createPriceDiv ('basePriceVariant', '', $prow->prices, TRUE, FALSE) . '</span><br />';
      }

      if ($prow->prices['discountedPriceWithoutTax']) {
         echo $this->currencyDisplay->createPriceDiv ('discountedPriceWithoutTax', '', $prow->prices, FALSE, FALSE);
      } else {
         echo $this->currencyDisplay->createPriceDiv ('basePriceVariant', '', $prow->prices, FALSE, FALSE);
      }
      ?>
   </td>
   <td align="right"><?php

            if ($prow->step_order_level)
               $step=$prow->step_order_level;
            else
               $step=1;
            if($step==0)
               $step=1;
            ?>
         <input type="text"
               onblur="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED')?>');"
               onclick="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED')?>');"
               onchange="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED')?>');"
               onsubmit="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED')?>');"
               title="<?php echo  vmText::_('COM_VIRTUEMART_CART_UPDATE') ?>" class="quantity-input js-recalculate" size="3" maxlength="4" name="quantity[<?php echo $pkey; ?>]" value="<?php echo $prow->quantity ?>" />

         <button type="submit" class="vmicon vm2-add_quantity_cart" name="updatecart.<?php echo $pkey ?>" title="<?php echo  vmText::_ ('COM_VIRTUEMART_CART_UPDATE') ?>" />

         <button type="submit" class="vmicon vm2-remove_from_cart" name="delete.<?php echo $pkey ?>" title="<?php echo vmText::_ ('COM_VIRTUEMART_CART_DELETE') ?>" />
   </td>

   <?php if (VmConfig::get ('show_tax')) { ?>
   <td align="right"><?php echo "<span class='priceColor2'>" . $this->currencyDisplay->createPriceDiv ('taxAmount', '', $prow->prices, FALSE, FALSE, $prow->quantity) . "</span>" ?></td>
   <?php } ?>
   <td colspan="1" align="right">
      <?php
      if (VmConfig::get ('checkout_show_origprice', 1) && !empty($prow->prices['basePriceWithTax']) && $prow->prices['basePriceWithTax'] != $prow->prices['salesPrice']) {
         echo '<span class="line-through">' . $this->currencyDisplay->createPriceDiv ('basePriceWithTax', '', $prow->prices, TRUE, FALSE, $prow->quantity) . '</span><br />';
      }
      elseif (VmConfig::get ('checkout_show_origprice', 1) && empty($prow->prices['basePriceWithTax']) && $prow->prices['basePriceVariant'] != $prow->prices['salesPrice']) {
         echo '<span class="line-through">' . $this->currencyDisplay->createPriceDiv ('basePriceVariant', '', $prow->prices, TRUE, FALSE, $prow->quantity) . '</span><br />';
      }
      echo $this->currencyDisplay->createPriceDiv ('salesPrice', '', $prow->prices, FALSE, FALSE, $prow->quantity) ?></td>
</tr>
   <?php
   $i = ($i==1) ? 2 : 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="3" align="right"><?php echo vmText::_ ('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->cartPrices, FALSE) . "</span>" ?></td>
   <?php } ?>
   <td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPrice', '', $this->cart->cartPrices, FALSE) ?></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 $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->cartPrices['couponTax'], FALSE); ?> </td>
      <?php } ?>
   <td align="right"> </td>
   <td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPriceCoupon', '', $this->cart->cartPrices['salesPriceCoupon'], FALSE); ?> </td>
   <?php } else { ?>
   <td colspan="6" 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->cartPrices[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?></td>
   <td align="right"><?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff', '', $this->cart->cartPrices[$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->cartPrices[$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->cartPrices[$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->cartPrices[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?>  </td>
   <td align="right"><?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff', '', $this->cart->cartPrices[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?> </td>
</tr>
   <?php
   if ($i) {
      $i = 1;
   } else {
      $i = 0;
   }
} ?>

<?php if (    VmConfig::get('oncheckout_opc',true) or
   !VmConfig::get('oncheckout_show_steps',false) or
   (!VmConfig::get('oncheckout_opc',true) and VmConfig::get('oncheckout_show_steps',false) and
      !empty($this->cart->virtuemart_shipmentmethod_id) )
) { ?>
<tr class="sectiontableentry1" style="vertical-align:top;">
   <?php if (!$this->cart->automaticSelectedShipment) { ?>
      <td colspan="4" style="align:left;vertical-align:top;">
         <?php
            echo '<h3>'.vmText::_ ('COM_VIRTUEMART_CART_SELECTED_SHIPMENT').'</h3>';
            echo $this->cart->cartData['shipmentName'].'<br/>';

      if (!empty($this->layoutName) and $this->layoutName == 'default') {
         if (VmConfig::get('oncheckout_opc', 0)) {
            $previouslayout = $this->setLayout('select');
            echo $this->loadTemplate('shipment');
            $this->setLayout($previouslayout);
         } else {
            echo JHtml::_('link', JRoute::_('index.php?option=com_virtuemart&view=cart&task=edit_shipment', $this->useXHTML, $this->useSSL), $this->select_shipment_text, 'class=""');
         }
      } else {
         echo vmText::_ ('COM_VIRTUEMART_CART_SHIPPING');
      }
      echo '</td>';
   } else {
   ?>
   <td colspan="3" style="align:left;vertical-align:top;">
      <?php echo '<h4>'.vmText::_ ('COM_VIRTUEMART_CART_SELECTED_SHIPMENT').'</h4>'; ?>
      <?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->cartPrices['shipmentTax'], FALSE) . "</span>"; ?> </td>
   <?php } ?>
   <td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPriceShipment', '', $this->cart->cartPrices['salesPriceShipment'], FALSE); ?> </td>
</tr>
<?php } ?>
<?php if ($this->cart->pricesUnformatted['salesPrice']>0.0 and
   (    VmConfig::get('oncheckout_opc',true) or
      !VmConfig::get('oncheckout_show_steps',false) or
      ( (!VmConfig::get('oncheckout_opc',true) and VmConfig::get('oncheckout_show_steps',false) ) and !empty($this->cart->virtuemart_paymentmethod_id))
   )
) { ?>
<?php  } ?>

<!-- payment method verwijderd -->

<tr>
   <td colspan="4">&nbsp;</td>
   <td colspan="<?php echo $colspan ?>">
      <hr/>
   </td>
</tr>
<tr class="sectiontableentry2">
   <td colspan="3" align="right"><?php echo vmText::_ ('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->cartPrices['billTaxAmount'], FALSE) . "</span>" ?> </td>
   <?php } ?>
   <td align="right"><strong><?php echo $this->currencyDisplay->createPriceDiv ('billTotal', '', $this->cart->cartPrices['billTotal'], FALSE); ?></strong></td>
</tr>
<?php
if ($this->totalInPaymentCurrency) {
?>

<tr class="sectiontableentry2">
   <td colspan="3" align="right"><?php echo vmText::_ ('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>
</fieldset>