News:

Looking for documentation? Take a look on our wiki

Main Menu

Show Discount as %

Started by CMYKreative, August 14, 2012, 12:45:40 PM

Previous topic - Next topic

rzrz

Quote from: CMYKreative on August 20, 2012, 13:09:11 PM
Hide the divs you dont want to show with css . . . easiest way.

I understand, but I cannot achieve the way I wanted as in your Demo.

Original Price is only shown in [Sales Price Without Tax]
So even when without discounts it is also showing.

Product with discounts:
Sales Price Without Tax: $30.00
Sales Price: $24.00

Product without discounts
Sales Price Without Tax: $50.00
Sales Price: $50.00

CMYKreative

Sorry, am not following what you want to do . . . can you clarify . . .

rzrz

#17
Quote from: CMYKreative on August 21, 2012, 07:22:55 AM
Sorry, am not following what you want to do . . . can you clarify . . .

I want to do like what you have done in your site


This is what my site shows currently





[attachment cleanup by admin]

CMYKreative

And you want to show what . . . ?

bytelord

Hello all,

good point from CMYKreative, what you want to show exactly???
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

rzrz

I want to show exactly what CMYKreative has done to the price

Normal Price Item:
Price: $10.00

Discount Price Item:
Price: $10.00
NOW: $5.00
Discount: 50%

--

but now I can't display price before discount
sales price without tax is showing the correct price before discount
but when there is no discount, it is showing double =

sales price without tax: $50
sales price: $50


Is explaining this way clearer?  ??? :-[

CMYKreative

Did you update your code using the sample code we posted right at the beginning of this thread?

You need to update a number of files, product page, cart page etc to make this all work correctly.

rzrz

Quote from: CMYKreative on August 22, 2012, 13:24:29 PM
Did you update your code using the sample code we posted right at the beginning of this thread?

You need to update a number of files, product page, cart page etc to make this all work correctly.

#1 At the backend I checked all options to show all prices
#2 Updated administrator/components/com_virtuemart/helpers/currencydisplay.php
#3 Updated template/html/com_virtuemart/productdetails/default.php

What else am I missing?

bytelord

#23
i think you place that code inside the wrong template, do you use template overrides?
if you have a custom template you should check inside your_joomla_folder\templates\your_joomla_template\html\com_virtuemart\category and your_joomla_folder\templates\your_joomla_template\html\com_virtuemart\productdetails
or cart...
there you should change your files ...
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

rzrz

Quote from: bytelord on August 22, 2012, 13:29:23 PM
i think you place that code inside the wrong template, do you use template overrides?
if you have a custom template you should check inside your_joomla_folder\templates\your_joomla_template\html\com_virtuemart\category and your_joomla_folder\templates\your_joomla_template\html\com_virtuemart\productdetails
or cart...
there you should change your files ...

I am currently trying on the product details page, so I didn't start with category page.

But the path I changed is correct, it is the template overrides folder

I tried a few times for the code but it is still showing the same thing..  :'(

CMYKreative

OK, try this:

com_virtuemart/category/default.php

<div>
<h3 class="catProductTitle"><?php echo JHTML::link($product->link$product->product_name); ?></h3>
<?php // Product Short Description
if(!empty($product->product_s_desc)) { ?>

<p class="product_s_desc">
<?php echo shopFunctionsF::limitStringByWord($product->product_s_desc255'...'?>
</p>
<?php ?>
<?php if (!VmConfig::get('use_as_catalog')){?>
<div class="stockLavel">
<span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"></span>
<span class="stock-level"><?php echo JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP'?></span>
</div>
<?php }?>
<div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
<?php
if ($this->show_prices == '1') {
if( $product->product_unit && VmConfig::get('vm_price_show_packaging_pricelabel')) {
echo "<strong>"JText::_('COM_VIRTUEMART_CART_PRICE_PER_UNIT').' ('.$product->product_unit."):</strong>";
}


echo $this->currency->createPriceDiv('salesPrice','',$product->prices);
// echo $this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices);

if (!empty($product->prices['discountAmount']) ) { 
    echo 
$this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);
if (
$this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices))
{
$discount=$this->currency->formatNumber($product->prices['discountAmount']);
$pricewithtax $this->currency->formatNumber($product->prices['basePriceWithTax']);
$total =($discount 100) / $pricewithtax;
echo "<div class='discountpercent'>Discount: ".$total."%</div>";
}
    }


//if ($this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices))
// echo $this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);
//if ($this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices))
// {
// $discount=$this->currency->formatNumber($product->prices['discountAmount']);
// $pricewithtax = $this->currency->formatNumber($product->prices['basePriceWithTax']);
// $total =($discount * 100) / $pricewithtax;
// echo "<div class='discountpercent'>Discount: ".$total."%</div>";
// }
echo $this->currency->createPriceDiv('taxAmount','COM_VIRTUEMART_PRODUCT_TAX_AMOUNT',$product->prices);
?>

</div>
<div class="product-details button">
<?php // Product Details Button
echo JHTML::link($product->linkJText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'catProductDetails button'));
?>

</div></div>
</div>


com_virtuemart/productdetails/default.php

<?php 
// Product Price
if ($this->show_prices) { ?>

<div class="product-price" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">
<?php
if ($this->product->product_unit && VmConfig::get 'price_show_packaging_pricelabel' )) {
echo "<strong>" JText::'COM_VIRTUEMART_CART_PRICE_PER_UNIT' ) . ' (' $this->product->product_unit "):</strong>";
} else {
echo "<strong>" JText::'COM_VIRTUEMART_CART_PRICE' ) . "</strong>";
}

if ($this->showBasePrice) {
echo $this->currency->createPriceDiv 'basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$this->product->prices );
echo $this->currency->createPriceDiv 'basePriceVariant''COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT'$this->product->prices );
}

echo $this->currency->createPriceDiv 'variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$this->product->prices );
// echo $this->currency->createPriceDiv ( 'basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices );
echo $this->currency->createPriceDiv 'discountedPriceWithoutTax''COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE'$this->product->prices );
echo $this->currency->createPriceDiv 'salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$this->product->prices );

echo $this->currency->createPriceDiv 'priceWithoutTax''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX'$this->product->prices );
// echo $this->currency->createPriceDiv ( 'discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $this->product->prices );


if (!empty($this->product->prices['discountAmount']) ) { 
echo 
$this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$this->product->prices);
if (
$this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$this->product->prices))
{
$discount=$this->currency->formatNumber($this->product->prices['discountAmount']);
$pricewithtax $this->currency->formatNumber($this->product->prices['basePriceWithTax']);
$total =($discount 100) / $pricewithtax;
echo "<div class='discountpercent'>Discount: ".$total."%</div>";
}
    }

echo $this->currency->createPriceDiv 'taxAmount''COM_VIRTUEMART_PRODUCT_TAX_AMOUNT'$this->product->prices ); 
echo $this->currency->createPriceDiv 'salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$this->product->prices );
?>


bytelord

#26
Hello,

you should start over and be more careful with what you change on your source. Also there is also some CSS that should applied. Take a look on the original post about that :)
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

CMYKreative

You've done something wrong when editing the code, but it's hard to see what or where from here.

Try reverting back to the ORIGINAL files that came with the template, then start again using the code I posted above and making the changes where indicated in my last post.

CMYKreative

I should also point out that the code works for the template we are using, you might need to tweak it to suit your own page.

admiss

#29
Hello,

Any solution for "original price, discounted price and discount percentage" WITHOUT core hack?
In admin Config - Pricing, I have thicked
Baseprice
Baseprice with Tax, but without discounts
Final salesprice
Discount amount  (- I cannot understand, why is there only amount....instead of %)

On product page
Cost price:2
Base price: 2 (App.no rule - I don't want to show TAXes, VATs)
Final price: 1.6 (Rule: Discount 20% - which is Price modifier before tax, -%)
Overwrite final: YES (and it is not shown)
And instead of %, you can see amount.

I'm not an expert in coding,  I wouldn' t like to touch php files
Everyone writes different solution. Should I really try every suggestion?

I have posted this before http://forum.virtuemart.net/index.php?topic=96175.60
but it seems to be a too hard question