Hi,
First of all; to
hide the add to cart button (when the price field is empty)
replace this line:
<?php // Add To Cart Button
if (!VmConfig::get('use_as_catalog',0)) { ?>
with this (for product details page):
<?php // Add To Cart Button
if (!VmConfig::get('use_as_catalog', 0) and (!empty($this->product->prices['salesPrice']))) {
with this (for category browse page):
<?php // Add To Cart Button
if (!VmConfig::get('use_as_catalog', 0) and (!empty($product->prices['salesPrice']))) {
Then, use the below codes to print the CALL FOR PRICE text/link in where ever you want to show it (call for price link will be visible only if the product price is empty for that specific product)
In the product details page:
<?php if ($this->product->prices['salesPrice']<=0) { ?>
Call 800-123-4567 or <a href="/contact">email us</a> for price.
<?php } ?>
in the category browse page:
<?php if ($product->prices['salesPrice']<=0) { ?>
Call 800-123-4567 or <a href="/contact">email us</a> for price.
<?php } ?>
No need to combine lots of conditions such as; VmConfig::get ('askprice', 1) and isset($this->product->images[0]) and !$this->product->images[0]->file_is_downloadable) and !VmConfig::get('use_as_catalog',0) etc.. Those are for very rare situations. I don't think you will even need those extra conditions. Checking the price field would be enough for you.
FYI: When you look at the conditions, they make sense though: For example;
-
VmConfig::get ('askprice', 1): Checks if you enabled the "
Show call for price, when the price is empty" parameter
-
VmConfig::get('use_as_catalog',0) checks if your Virtuemart is in "Catalog" mode or not.
-
$this->product->images[0]->file_is_downloadable checks if that particular product is downloadable content or not.
Regards,
Support