CMS code in Virtuemart

frederic11
140 Posts
frederic11 posted this 25 December 2016

Hello,

i have try to follow this : http://answers.themler.com/articles/67028/tips-and-tricks#t_price
for show the base price for product with discount.

I insert the cms code into the product view position, but all i have is "Cms code is empty".

Please help me on this, regards.

Hello, i have try to follow this : http://answers.themler.com/articles/67028/tips-and-tricks#t_price for show the base price for product with discount. I insert the cms code into the product view position, but all i have is "Cms code is empty". Please help me on this, regards.
Vote to pay developers attention to this features or issue.
14 Comments
Order By: Standard | Newest
frederic11
140 Posts
frederic11 posted this 25 December 2016

EDIT : it work in the detail view : https://www.energie-sante.ch/accueil-boutique/harmonisation-de-votre-habitat-purification-de-l-eau-systèmes-de-protection/purification-de-leau/purificateur-deau-a-osmose-inverse-detail.html

You see "Remise -140,00 CHF" but no in the category view : https://www.energie-sante.ch/accueil-boutique/harmonisation-de-votre-habitat-purification-de-l-eau-systèmes-de-protection/purification-de-leau.html

EDIT : it work in the detail view : https://www.energie-sante.ch/accueil-boutique/harmonisation-de-votre-habitat-purification-de-l-eau-systèmes-de-protection/purification-de-leau/purificateur-deau-a-osmose-inverse-detail.html You see "Remise -140,00 CHF" but no in the category view : https://www.energie-sante.ch/accueil-boutique/harmonisation-de-votre-habitat-purification-de-l-eau-systèmes-de-protection/purification-de-leau.html
frederic11
140 Posts
frederic11 posted this 25 December 2016

EDIT 2 : Sorry, i clarify, i want to show the base price only for discounted products. So i have try to put the cms code in details view, but it say "cms code is empty".

So i have try with "Discount amount", and this one work in the detail view but not in the category view.

I dont understand why it show wit discount amount but not with base price...

EDIT 2 : Sorry, i clarify, i want to show the base price only for discounted products. So i have try to put the cms code in details view, but it say "cms code is empty". So i have try with "Discount amount", and this one work in the detail view but not in the category view. I dont understand why it show wit discount amount but not with base price...
frederic11
140 Posts
frederic11 posted this 25 December 2016

EDIT 3 :

OK, i have achieve to put the base price only when discount.

The 2 problem i have now :
1. Still the discount amount in the category view dont display
2. I have put a cms code for the base price only when discount, so i want now to have ONLY the amount barred (with an horizontal bar). but if i custom the cms code, all is barred, title + amount.

EDIT 3 : OK, i have achieve to put the base price only when discount. The 2 problem i have now : 1. Still the discount amount in the category view dont display 2. I have put a cms code for the base price only when discount, so i want now to have ONLY the amount barred (with an horizontal bar). but if i custom the cms code, all is barred, title + amount.
frederic11
140 Posts
frederic11 posted this 25 December 2016

EDIT 4 :

I have achieve the line-through by edit the css code. I have put :

span.PricebasePrice {
color: #333333;
text-decoration: line-through;

}

Now, only the discount amount problem.

EDIT 4 : I have achieve the line-through by edit the css code. I have put : span.PricebasePrice { color: #333333; text-decoration: line-through; } Now, only the discount amount problem.
Support Team
Support Team posted this 25 December 2016

Hi,

i want to show the base price only for discounted products.

Yes, this code works on Product Details only. For Products template you should use a little different code:

<?php
if(!(isset($currency))){
$currency = CurrencyDisplay::getInstance ();
}
if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);
}
?>

and discount amount:

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

Thank you,
Olivia

Hi, > i want to show the base price only for discounted products. Yes, this code works on Product Details only. For Products template you should use a little different code: `<?php if(!(isset($currency))){ $currency = CurrencyDisplay::getInstance (); } if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) { echo $currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices); } ?>` and discount amount: ` echo $currency->createPriceDiv ( 'discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices );` Thank you, Olivia
frederic11
140 Posts
frederic11 posted this 25 December 2016

When i put the discount amount code ==> Fatal error...

When i put the discount amount code ==> Fatal error...
frederic11
140 Posts
frederic11 posted this 25 December 2016

But that is the code i have put in screenshot 1. You see in screenshot 2 the code is empty.
But with your code, fatal error.

energie-1.jpg

energie-2.jpg

But that is the code i have put in screenshot 1. You see in screenshot 2 the code is empty. But with your code, fatal error. !energie-1.jpg! !energie-2.jpg!

Last edited 25 December 2016 by frederic11

Support Team
Support Team posted this 25 December 2016

Hi,

The wrapper of echo is the same for discount amount too:
<?php
if(!(isset($currency))){
$currency = CurrencyDisplay::getInstance ();
}
if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $currency->createPriceDiv ( 'discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices );
}
?>

Please keep us posted about the progress.

Thank you,
Olivia

Hi, The wrapper of echo is the same for discount amount too: `<?php if(!(isset($currency))){ $currency = CurrencyDisplay::getInstance (); } if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) { echo $currency->createPriceDiv ( 'discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices ); } ?>` Please keep us posted about the progress. Thank you, Olivia
frederic11
140 Posts
frederic11 posted this 25 December 2016

Ha OK, i did not understand that....

It is Ok now, thank you :)

Ha OK, i did not understand that.... It is Ok now, thank you :)
frederic11
140 Posts
frederic11 posted this 25 December 2016

Just a thing, for the base price, i have used this code :

<?php if ($product-?>prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices);
} ?>

And it work on category and product detail.
The problem i had was i have no tax. So base price with tax won't appear.

Just a thing, for the base price, i have used this code : &lt;?php if ($product-?&gt;prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) { echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices); } ?> And it work on category and product detail. The problem i had was i have no tax. So base price with tax won't appear.
Support Team
Support Team posted this 25 December 2016

Hi,

Please explain in details what exactly you want to show and what type of price modification you're using (tax, discount). The final solution is different for different situations.
This line compares two prices:

<?php if ($product-?>prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {

in other words if discountedPriceWithoutTax not equal to priceWithoutTax then output something.
You can take any prices from listed here (basePrice,salesPrice`, etc) and compare them by replacing price identifier:
http://answers.themler.com/Support/Doc/Detail/67028

Thank you,
Olivia

Hi, Please explain in details what exactly you want to show and what type of price modification you're using (tax, discount). The final solution is different for different situations. This line compares two prices: `<?php if ($product-?>prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {` in other words if `discountedPriceWithoutTax` not equal to `priceWithoutTax` then output something. You can take any prices from listed here (`basePrice, `salesPrice`, etc) and compare them by replacing price identifier: http://answers.themler.com/Support/Doc/Detail/67028 Thank you, Olivia
Support Team
Support Team posted this 25 December 2016

or you can check if there is any discount rule:

if ($product->prices['product_discount_id'] !="0"){
// show something here
}

or you can check if there is any discount rule: `if ($product->prices['product_discount_id'] !="0"){ // show something here }`
frederic11
140 Posts
frederic11 posted this 25 December 2016

Thank you, it is OK now.
I am not programmer so it is difficult to understand php :)

But all work well for that i want to do.

Thank you.

Thank you, it is OK now. I am not programmer so it is difficult to understand php :) But all work well for that i want to do. Thank you.
Support Team
Support Team posted this 25 December 2016

Great!
Please let us know if you need our further assistance.

Thank you,
Olivia

Great! Please let us know if you need our further assistance. Thank you, Olivia
You must log in or register to leave comments