apply percentage of discount price

Rate this topic: Evaluations: 2, 3.50 on the average.Evaluations: 2, 3.50 on the average.Evaluations: 2, 3.50 on the average.Evaluations: 2, 3.50 on the average.Evaluations: 2, 3.50 on the average.Evaluations: 2, 3.50 on the average.3.50 out of 6 based on 2 vote(s)
GK User
Mon Jul 14, 2014 11:44 am
Reply with quote
Report this post
hello, i would like to show the percentage of discount price. for example:

if i have an item with sale price 50€ and the discount (override price) is 25€, the percentage of discount price is 50%, how can i appear this percentage at FrontPage, category page and product page.


thank you
User avatar
Senior Boarder

GK User
Mon Jul 14, 2014 2:23 pm
Reply with quote
Report this post
this would be the desired, for the category page, FrontPage and product page, to show different prices with percentage (%).

what should I do to have this result.

your proposal

thank you
User avatar
Senior Boarder

teitbite
Tue Jul 15, 2014 9:41 am
Reply with quote
Report this post
Hi

Ok. This thread is almost like the one I've just answered for You :) Please forget about the other one and lets keep disscussion here. Please send me an access to ftp will try to make it for You.
User avatar
Moderator

GK User
Tue Jul 15, 2014 12:36 pm
Reply with quote
Report this post
iam ok, i follow your instructions to show different prices on frontpage and everything its ok.

the url is http://www.zacheshop.gr

the second thing i want to complete now, is the creation of percentage .

the other thing is when we wil have discount price must appear both prices , the base price, the sale price and the discount ammount.

in the other case when we will not have a discount price must appear only the sale price or the final price.

this is in my best interest !!!!!

best regards
User avatar
Senior Boarder

GK User
Tue Jul 15, 2014 2:56 pm
Reply with quote
Report this post
hello again teitbite, can you give me here a solution, would be better, if I need something should be asking again and again.!!!!

I refer to the percentage and the issue of prices
"the second thing i want to complete now, is the creation of percentage .
the other thing is when we wil have discount price must appear both prices , the base price, the sale price and the discount ammount.
in the other case when we will not have a discount price must appear only the sale price or the final price. "
User avatar
Senior Boarder

teitbite
Wed Jul 16, 2014 11:33 am
Reply with quote
Report this post
Hi

Please send me an access to ftp. It's too hard to figure it out without seeing changes.
User avatar
Moderator

GK User
Wed Jul 16, 2014 3:35 pm
Reply with quote
Report this post
hello teitbite, i send you pm
User avatar
Senior Boarder

teitbite
Thu Jul 17, 2014 11:57 am
Reply with quote
Report this post
Hi

Here is a piece of code used to count the percentage value:

Code: Select all
            if( $discount_perc = round( 100 - ( $this->product->prices['salesPrice'] / $this->product->prices['basePriceWithTax'] * 100 ) ) ):
               print '<div class="priceDiscountPercentage">'.
                  'Discount: <span class="priceDiscountPercentageAmount">'.$discount_perc.' %</span>'.
                  '</div>';
            endif;
User avatar
Moderator

GK User
Thu Jul 17, 2014 3:10 pm
Reply with quote
Report this post
first of all thank you very much!

the same code can use it for category page and for the frontpage ? to show the discount percentage?

i will do it , and i tell you, If there are anything that need your attention.

for the second issue ("the other thing is when we wil have discount price must appear both prices , the base price, the sale price and the discount ammount. in the other case when we will not have a discount price must appear only the sale price or the final price. ").

what proposed to me? there is a possible solution?

best regards!
User avatar
Senior Boarder

teitbite
Fri Jul 18, 2014 2:25 pm
Reply with quote
Report this post
Hi

For category and frontpage the variables names may change. Easiest way to tell what name should it be is by making a dump of $this which will show all variables used on the page.

For the second question I have already used a condition that percentage will not show when it will be 0.
User avatar
Moderator

GK User
Mon Jul 21, 2014 8:07 pm
Reply with quote
Report this post
hello teitbite,
I tried to dump the variables, but I haven't done anything
if you can help me more

i used a array to return the results but nothing.
User avatar
Senior Boarder

teitbite
Tue Jul 22, 2014 7:29 pm
Reply with quote
Report this post
Hi

Ok. I'll make it for You, please just tell me the url of the page where I will be able to see where You want it. My Greek is so bad that I'm having problems navigate on Your site :)
User avatar
Moderator

GK User
Wed Jul 23, 2014 2:45 pm
Reply with quote
Report this post
thank you.
mainly, to the front page then to category pages and subacategory pages, so:
1) http://www.zacheshop.gr/
2) http://www.zacheshop.gr/clothes , (and for the other subcategories) clothes=ΡΟΥΧΑ......
3) http://www.zacheshop.gr/bags , (and for the other subcategories) bags=ΤΣΑΝΤΕΣ....
4) http://www.zacheshop.gr/accessories, (and for the other subcategories) accessories= ΑΞΕΣΟΥΑΡ....

why have to do for all categories if the file is only one????

best regards
User avatar
Senior Boarder

teitbite
Thu Jul 24, 2014 1:43 pm
Reply with quote
Report this post
Hi

It's one file for categories, but I had to see if You do not want it for different layout like frontpage. Already noticed that You need in module as well.

1. For category layout in file: /html/com_virtuemart/category/default.php

Code: Select all
               <?php
               if( $discount_perc = round( 100 - ( $product->prices['salesPrice'] / $product->prices['basePriceWithTax'] * 100 ) ) ):
               print '<div class="priceDiscountPercentage">'.
                  'Discount: <span class="priceDiscountPercentageAmount">'.$discount_perc.' %</span>'.
                  '</div>';
               endif;
               ?>


2. For module in /modules/mod_news_pro_gk5/portal_modes/product_gallery_2/controller.php

Code: Select all
   if( $discount_perc = round( 100 - ( $product->prices['salesPrice'] / $product->prices['basePriceWithTax'] * 100 ) ) ):
       $news_price .= '<div class="priceDiscountPercentage">'.
         'Discount: <span class="priceDiscountPercentageAmount">'.$discount_perc.' %</span>'.
         '</div>';
   endif;
User avatar
Moderator

GK User
Thu Jul 24, 2014 3:03 pm
Reply with quote
Report this post
hi
you did it for me!
thank you
User avatar
Senior Boarder


cron