discount prices display

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Mon Jan 16, 2017 7:41 pm
Reply with quote
Report this post
Hi,
I want to show some products with discount prices for b2b customers.
If no discount price is set, normal price should be displayed.
Tried different settings but can't figure out why it's not working.
Should look like this:
Discount price: €10,00
normal price: €15,00

I sent both settings (product and config)
My guess it should also be set in category and productdetails default.php in template....
maybe you can explain if and where to start.
Joomla 3.6.5 - VirtueMart 3.0.18

Regards,
Pascal
User avatar
Gold Boarder

teitbite
Sun Jan 22, 2017 11:42 am
Reply with quote
Report this post
Hi

In category layout at /html/com_virtuemart/category/defult.php prices has been commented out, so You just need to edit this file and uncomment it.

Try look into this thread. I've explained how to add this prices there: https://www.gavick.com/forums/quark/cro ... 45#p262245
User avatar
Moderator

GK User
Sun Jan 22, 2017 1:22 pm
Reply with quote
Report this post
Been looking in templates/gk_shop_and_buy/html/com_virtuemart/category/default.php
but only see this at line 194, nothing commented out?:
Code: Select all
            <div>
               <h3 class="catProductTitle"><?php echo JHTML::link($product->link, $product->product_name); ?></h3>
               
               <div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
                  <?php
                  if ($this->show_prices == '1') {
                     if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and  !$product->images[0]->file_is_downloadable) {
                        echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
                     }
                     echo $this->currency->createPriceDiv('salesPrice', '', $product->prices);
                     echo $this->currency->createPriceDiv('taxAmount', JText::_('TPL_GK_LANG_VM_INC_TAX'), $product->prices);
                  } ?>
               </div>


Regards,
Pas
User avatar
Gold Boarder

teitbite
Fri Jan 27, 2017 7:39 pm
Reply with quote
Report this post
Hi

That's strange. I guess programmers has removed it finally.

Find in this file code:

Code: Select all
            <div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
               <?php
               if ($this->show_prices == '1') {
                  if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and  !$product->images[0]->file_is_downloadable) {
                     echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
                  }
                  echo $this->currency->createPriceDiv ('salesPrice', '', $product->prices);
               } ?>
            </div>



and replace with:

Code: Select all
            <div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
               <?php
               if ($this->show_prices == '1') {
                  if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and  !$product->images[0]->file_is_downloadable) {
                     echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
                  }
                  echo $this->currency->createPriceDiv ('salesPrice', '', $product->prices);

                  if( $product->prices['salesPrice'] != $product->prices['basePrice' ):
                     echo '<div class="old_price">'.$this->currency->createPriceDiv ('basePrice', '', $product->prices).'</div>';
                  endif;
               } ?>
            </div>
User avatar
Moderator

GK User
Fri Jan 27, 2017 11:36 pm
Reply with quote
Report this post
Thanks,
Was missing a ']' after 'Baseprice'
How can I make sure this only shows if override price is set, now I shows always.

Regards,
Pas
User avatar
Gold Boarder

teitbite
Fri Feb 03, 2017 7:28 pm
Reply with quote
Report this post
Hi

What prices You got there ? I'm asking because this condition:

Code: Select all
if( $product->prices['salesPrice'] != $product->prices['basePrice'] ):


should determine when to show it and when not. What other modifications to the price are done that sales price and base price are different ?
User avatar
Moderator

GK User
Mon Feb 06, 2017 10:08 am
Reply with quote
Report this post
Hi Teitbite,
This are the settings:
1 price config shop
2 price product normal
3 price product b2b
4 result price normal
5 result price b2b

I want to show regular price (crossed) and override price. Only if this is set.
Hope you can tell me how.
Regards,
Pas
User avatar
Gold Boarder

GK User
Mon Feb 06, 2017 10:09 am
Reply with quote
Report this post
and the result prices for normal and b2b shopper group.
User avatar
Gold Boarder

teitbite
Thu Feb 09, 2017 3:54 pm
Reply with quote
Report this post
Hi

Unfortunately I do not know what that means :( I'm not Virtuemart expert. Try adding this below the code we have just been working with:

Code: Select all
<?php
print '<pre>';
var_dump( $product->prices );
print '</pre>';
?>


with this You will be able to see all the prices VM component has prepared. When You will know that, copy it for me here and tell me what of those prices should be visible so I'll modify the code.
User avatar
Moderator

GK User
Tue Feb 28, 2017 1:46 pm
Reply with quote
Report this post
Hi Teitbite,
After adding the code, this is what's being published at my product (at b2b user account):
Hope you can tell me how to get this right.
Thanks,
Pas

Code: Select all
array(38) {
  ["virtuemart_product_price_id"]=>
  float(2245)
  ["virtuemart_product_id"]=>
  float(1486)
  ["virtuemart_shoppergroup_id"]=>
  float(4)
  ["product_price"]=>
  float(6.95)
  ["override"]=>
  float(1)
  ["product_override_price"]=>
  float(4.95)
  ["product_tax_id"]=>
  float(1)
  ["product_discount_id"]=>
  string(1) "0"
  ["product_currency"]=>
  float(47)
  ["product_price_publish_up"]=>
  string(19) "0000-00-00 00:00:00"
  ["product_price_publish_down"]=>
  string(19) "0000-00-00 00:00:00"
  ["price_quantity_start"]=>
  string(1) "0"
  ["price_quantity_end"]=>
  string(1) "0"
  ["created_on"]=>
  string(19) "2016-11-16 18:19:01"
  ["created_by"]=>
  float(977)
  ["modified_on"]=>
  string(19) "2017-01-17 08:53:05"
  ["modified_by"]=>
  float(977)
  ["locked_on"]=>
  string(19) "0000-00-00 00:00:00"
  ["locked_by"]=>
  string(1) "0"
  ["costPrice"]=>
  float(6.95)
  ["basePrice"]=>
  float(6.95)
  ["basePriceVariant"]=>
  float(6.95)
  ["basePriceWithTax"]=>
  float(0)
  ["discountedPriceWithoutTax"]=>
  float(4.95)
  ["priceBeforeTax"]=>
  float(6.95)
  ["salesPrice"]=>
  float(4.95)
  ["taxAmount"]=>
  float(0)
  ["salesPriceWithDiscount"]=>
  float(0)
  ["salesPriceTemp"]=>
  float(6.95)
  ["unitPrice"]=>
  float(0)
  ["discountAmount"]=>
  float(-2)
  ["priceWithoutTax"]=>
  float(6.95)
  ["variantModification"]=>
  float(0)
  ["DBTax"]=>
  array(0) {
  }
  ["Tax"]=>
  array(0) {
  }
  ["VatTax"]=>
  array(0) {
  }
  ["DATax"]=>
  array(0) {
  }
  ["Marge"]=>
  array(0) {
  }
}
User avatar
Gold Boarder

teitbite
Thu Mar 02, 2017 1:50 pm
Reply with quote
Report this post
Hi

In the dump shown You have all the prices variants from Virtuemart (below just prices, I've got rid of the extra stuff):

Code: Select all
["product_price"]=>float(6.95)
["product_override_price"]=>float(4.95)
["costPrice"]=>float(6.95)
["basePrice"]=>float(6.95)
["basePriceVariant"]=>float(6.95)
["basePriceWithTax"]=>float(0)
["discountedPriceWithoutTax"]=>float(4.95)
["priceBeforeTax"]=>float(6.95)
["salesPrice"]=>float(4.95)
["taxAmount"]=>float(0)
["salesPriceWithDiscount"]=>float(0)
["priceWithoutTax"]=>float(6.95)


now You just need to decide which price You want to show and in the code we have discussed above change the name.

You can try to do it by Yourself or please contact me on Skype, my login "teitbite". I still have couple of questions about what You are trying to achieve here and this will be a fastest way to resolve it.
User avatar
Moderator

GK User
Thu Mar 02, 2017 3:22 pm
Reply with quote
Report this post
Thanks,
I will try it myself first, guess there is some price variant missing in the code.
Only problem could be to display only for b2b (logged in) users.

Let you know.

Regards,
Pas
User avatar
Gold Boarder

teitbite
Mon Mar 06, 2017 11:51 am
Reply with quote
Report this post
Hi

If some price is not on the list than it has not been provided by Virtuemart. Dump function is showing all price variations VM has picked up from database.

From the code You've pasted above I can see that shopper group is provided, so You may need to use an extra condition:

Code: Select all
<?php
if( $product->prices->virtuemart_shoppergroup_id == 4 ):
// Now display a price for b4b shopper group which has an id 4
endif;
?>
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.