VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: bmw2182 on April 06, 2015, 01:28:10 AM

Title: Remove Sales price on select products but leave my price.
Post by: bmw2182 on April 06, 2015, 01:28:10 AM
Running Joomla 3.4.1 & Virtumart 3.0.6  http://www.elceesvintagecloset.com

For most of the products the client wants both Retail Price and My Price to show, but there is one category that she just wants My Price to show. 

I looked at creating artist.php in components/com_virteumart/views/productdetails/tmpl - but it seems to be an all or nothing sort of thing there.  I'm not sure what I can replace the code with to get just the My Price

Also where would I change it for the Product Browse page?

Thanks in advance!
Title: Re: Remove Sales price on select products but leave my price.
Post by: jenkinhill on April 06, 2015, 11:17:22 AM
As a developer you will realise that you can use template overrides for a single category (or even for single products) when required.

In VM3 the sublayout prices.php is used to show the prices, so the method I use to change prices shown is to start with the category, but I work backwards.

Make an override for  components/com_virtuemart/sublayouts/prices.php  - and maybe name it prices2.php - and edit that file just to show the price you wish to display.
Then make an override for  components/com_virtuemart/sublayouts/products.php so that it calls the prices2 sublayout, maybe name this file products2.php
Finally make an override for components/com_virtuemart/views/category/tmpl/default.php to call the products2 sublayout. Name the override file as you wish, eg default2.php

For the product details make an override for components/com_virtuemart/views/productdetails/tmpl/default.php to call the prices2 sublayout instead of the normal prices layout.

http://docs.virtuemart.net/tutorials/templating-layouts/199-sublayouts.html

Title: Re: Remove Sales price on select products but leave my price.
Post by: bmw2182 on April 08, 2015, 15:12:26 PM
Thank you for the information.  I must have something wrong as I lose the information on the product browse page when using the override.  I was successful with the product details page! Thank you!!!

Make an override for  components/com_virtuemart/sublayouts/prices.php
I created artistprices.php and commented out line 36
      //echo $currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);//

Then make an override for components/com_virtuemart/sublayouts/products.php
I created artistproducts.php
on line 102 changed prices to artistprices
<?php //echo $rowsHeight[$row]['price'] ?>
         <div class="vm3pr-<?php echo $rowsHeight[$row]['price'] ?>"> <?php
            echo shopFunctionsF::renderVmSubLayout('artistprices',array('product'=>$product,'currency'=>$currency)); ?>

Finally make an override for components/com_virtuemart/views/category/tmpl/default.php
I created artist.php and changed line 140 from products to artistproducts
   echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('artistproducts'=>$products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));

What am I doing wrong?
Title: Re: Remove Sales price on select products but leave my price.
Post by: GJC Web Design on April 08, 2015, 17:37:45 PM
this can't be right

echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('artistproducts'=>$products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));

try

echo shopFunctionsF::renderVmSubLayout('artistproducts',array('products'=>$products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));

and the single biggest help I find when doing this (esp. if lots of over rides) is adding in the html of each

<!---cat prod - template over ride - artistproducts -->

so simple - ah - but the joy when it appears...
Title: Re: Remove Sales price on select products but leave my price.
Post by: jenkinhill on April 08, 2015, 18:50:12 PM
And the frustration when it doesn't.... ;-)
Title: Re: Remove Sales price on select products but leave my price.
Post by: bmw2182 on April 08, 2015, 21:17:08 PM
Thank you so much!  That did the truck and the COMMENTS are a life safer :)! Some may say I over use them, but they are helpful.
Title: Re: Remove Sales price on select products but leave my price.
Post by: GJC Web Design on April 08, 2015, 21:41:02 PM
you can IMHO NEVER over use comments