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

Remove add-to-cart from category page only when there is no prices

Started by lalila, April 19, 2016, 13:03:48 PM

Previous topic - Next topic

lalila

Hello

I'm trying to remove the price of categories pages that have no price but keep it for categories with prices.
Does anyone have an idea how to get this working ?

Thank you

It should be this file, i duplicate it and affect to categories with no prices:
/html/com_virtuemart/category/default.php

Trying to remove this clas :
<div class="vm3pr-4"> <div>
<div class="vm3pr-0"> <div>

Joomla 3.4.8
Virtuemart 3.0.12
PHP 5.4.45

jenkinhill

div class="vm3pr-  is in components/com_virtuemart/sublayouts/products.php
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

lalila

Thanks, but if i remove the following code in components/com_virtuemart/sublayouts/products.php the price is removed for ALL categories pages.


<?php //echo $rowsHeight[$row]['price'] ?>
<div class="vm3pr-<?php echo $rowsHeight[$row]['price'?>"> <?php
echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$product,'currency'=>$currency)); ?>

<div class="clear"></div>
</div>
<?php //echo $rowsHeight[$row]['customs'] ?>
<div class="vm3pr-<?php echo $rowsHeight[$row]['customfields'?>"> <?php
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop''addtocart'))); ?>

</div>


I'd like to create differents category page. Somes categories are for products with prices, others are on quotation :
1/ www/templates/mytemplate/html/com_virtuemart/category/default.php
2/ www/templates/mytemplate/html/com_virtuemart/category/quotation.php

Is it possible ?

Jörgen

Hello

Yes of course. Make a copy of the file You want to start with. and name it like you have done. Then You can choose this template under the setup for the product category You want to assign the new quotation.php to.

regards

Jörgen @ Kreativ Fotografi


Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.


Jörgen

Hello

@ghost
Good suggetsion, but this is not a work for sublayouts only. This could very well be combined with sublayouts. But You can not assign sublayouts to product category directly.

@lalila You may also have to create a new sublayout and use this in Your new template view, quotation.php. Then You can assign the quotation.php to the categories You like.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Ghost

You can but only in category menu item. Sounds like a missing feature.

Depending on what exactly are you trying to accomplish, a simpler option could be to check if product has a price and add the addtocart sublayout if it does:

<?php if($product->prices['salesPrice']){?>
<div class="vm3pr-<?php echo $rowsHeight[$row]['customfields'?>"> <?php
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop''addtocart'))); ?>

</div>
<?php }?>


Just to be sure. If you want "ask for price" to be shown on products without price, just check "Show call for price, when the price is empty" option in VM Config.

Jörgen

Hello again

I read Your question badly.
QuoteQuote from Ghost
just check "Show call for price, when the price is empty" option in VM Config.

Just look into sublayout prices, there You can see how the note Call for price is displayed instead when prices are missing. Either modify or copy prices.php and modify as new sublayout.

regards

Jörgen @ Kreativ Fotografi

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.