News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Hide the price in featured products feed and category view

Started by beardedhobo, July 24, 2013, 01:52:17 AM

Previous topic - Next topic

beardedhobo

Hi,

I want to hide the price in the category view and featured products as I have a few items that have a price of 0.00 (due to product variants) so I want the price to be hidden on the category view and featured products; I've searched the forum and done a lot of googling and not found an answer.

I have tried un-checking the "Include the Product Price into the description?" box under configuration > template tab for both category feed and featured products feed but it doesn't hide the price.

What's the best way to hide the prices in these views?

Thanks,

Jamie

Maxim Pishnyak

Do you want to show price in other then category/featured places?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

beardedhobo

Yes.

What im looking to do is just hide the price so you can't see the price until you click on the product and then there the price will be. Is there a way to do this?

Maxim Pishnyak

#3
Customizing of such things is the method of using template overrides (read about them in a sticked threads in Template forum section).
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

beardedhobo

I've tried to do an over ride, but what I'm looking to do is hide the price only when it is 0.00 in these views so you have to click the product to see the price (which is generated using child products and custom fields)

How would I hide the price when browsing products only when it = 0.00? So you can see the price for other products when it is above 0.00, but hide it for products with a price = 0.00?

I don't think an override would do it? Perhaps I need an IF statement?

Any help would be greatly appreciated.


Maxim Pishnyak

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

beardedhobo

Ok I'll give it a whirl and report back, where can I find the sticky to the over rides? I checked the templates templates section and couldn't find it?
I take it this would be an over ride for categories or would it be product view or both?
Thanks!


beardedhobo

Well I've been trying this for a few days now and cannot get it to work.

What I'm trying to do is make the price on this page not appear if sales price <= 0:



I've created a copy of webroot / components / com_virtuemart / views / category / tmpl / default.php

The code that writes the price in is here:

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

//todo add config settings
if ($this->showBasePrice) {
echo $this->currency->createPriceDiv ('basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$product->prices);
echo $this->currency->createPriceDiv ('basePriceVariant''COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT'$product->prices);
}
echo $this->currency->createPriceDiv ('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$product->prices);
if (round($product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
echo '<span class="price-crossed" >' $this->currency->createPriceDiv ('basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$product->prices) . "</span>";
}
if (round($product->prices['salesPriceWithDiscount'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
echo $this->currency->createPriceDiv ('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$product->prices);
}
echo $this->currency->createPriceDiv ('salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$product->prices);
echo $this->currency->createPriceDiv ('priceWithoutTax''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX'$product->prices);
echo $this->currency->createPriceDiv ('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$product->prices);
echo $this->currency->createPriceDiv ('taxAmount''COM_VIRTUEMART_PRODUCT_TAX_AMOUNT'$product->prices);
$unitPriceDescription JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE'$product->product_unit);
echo $this->currency->createPriceDiv ('unitPrice'$unitPriceDescription$product->prices);
?>


</div>


I tried adding to it:

    if ($product->prices['basePriceWithTax'] =<1 {
echo "Click for Price";
}


I then placed the amended default.php into mytemplate/html/com_virtuemart folder and selected it as the category view over ride in the virtuemart back end.

However that did not work, and the prices still displayed on the category view.

I think I have some issues with the php. I am really really new to php so I think that's probably where I'm going wrong. Can anyone give me any pointers on what code I should be writing here to make the price only show if it is bigger than 0.00?

I'll keep playing around with it, its difficult when your knowledge of php is really limited!  :-\




Maxim Pishnyak

Quote from: beardedhobo on August 21, 2013, 21:05:46 PM
I've created a copy of webroot / components / com_virtuemart / views / category / tmpl / default.php
...
I then placed the amended default.php into mytemplate/html/com_virtuemart folder and selected it as the category view over ride in the virtuemart back end.
place it into mytemplate/html/com_virtuemart/category folder
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

jjk

Jamie and Maxim - just a hint. If you want to customize the category browse pages, place a copy of
...\components\com_virtuemart\views\category\tmpl\default.php
with a different name, i.e. noprice.php in the same folder.
Then comment out the price (which one(s), depends on your selections in the pricing configuration) in your noprice.php
Thereafter you can select your customized 'noprice.php' from the 'Category Browse Page' dropdown selection in the 'Category Edit view'.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Maxim Pishnyak

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

beardedhobo

Thanks for the info guys. I've been trying for months to get this sorted now with no luck. In the default category view I've narrowed it down to this section of code:

<div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">
<?php
                                                
if ($this->show_prices == '1') {
                                                 
if ($product->prices['salesPrice']<=and VmConfig::get ('askprice'1) and  !$product->images[0]->file_is_downloadable) {
echo JText::('COM_VIRTUEMART_PRODUCT_ASKPRICE');
}
//todo add config settings
if ($this->showBasePrice) {
echo $this->currency->createPriceDiv ('basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$product->prices);
echo $this->currency->createPriceDiv ('basePriceVariant''COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT'$product->prices);
}
echo $this->currency->createPriceDiv ('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$product->prices);
if (round($product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
echo '<span class="price-crossed" >' $this->currency->createPriceDiv ('basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$product->prices) . "</span>";
}
if (round($product->prices['salesPriceWithDiscount'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
echo $this->currency->createPriceDiv ('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$product->prices);
}
echo $this->currency->createPriceDiv ('salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$product->prices);
echo $this->currency->createPriceDiv ('priceWithoutTax''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX'$product->prices);
echo $this->currency->createPriceDiv ('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$product->prices);
echo $this->currency->createPriceDiv ('taxAmount''COM_VIRTUEMART_PRODUCT_TAX_AMOUNT'$product->prices);
$unitPriceDescription JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE'$product->product_unit);
echo $this->currency->createPriceDiv ('unitPrice'$unitPriceDescription$product->prices);
?>


</div>


Can anybody tell me what if statement I should add so if sales price = 0 then it will hide the price and echo "click for price"

I've nearly gone bald pulling my hair out for 4 months over this!

Any help would be massively appreciated!

Thanks,

Jamie