You are here:  » if price is zero


if price is zero

Submitted by henk on Fri, 2006-09-08 20:04 in

Is it possible to when the price is zero dont show the price, but show the product.
Then i have filt in my other Q.

Cheers

HEnk

Submitted by support on Fri, 2006-09-08 21:06

Hello Henk,

You can certainly remove the price from the search results if it is zero. In html/searchresults.php, find the following code (line 24):

          <?php if ($product["numMerchants"] > 1): ?>
            <em><?php print translate("from"); ?></em>&nbsp;<strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("Compare Prices"); ?></a></span>
          <?php else: ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
          <?php endif; ?>

..and change it to:

        <?php if (floatval($product["price"]) > 0): ?>
          <?php if ($product["numMerchants"] > 1): ?>
            <em><?php print translate("from"); ?></em>&nbsp;<strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("Compare Prices"); ?></a></span>
          <?php else: ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
          <?php endif; ?>
        <?php endif; ?>

Is this along the lines of what you would like to do? Do you also want to remove the zero pricing information from the product page?

Cheers,
David.

Submitted by henk on Fri, 2006-09-08 21:54

looks great but some more zeros, and links

Look at the folowing url link

then you can make your own product maybee in the admin but i use a database manager with wysiwyg editor.
Cheers HEnk

yes also from the product page

Submitted by support on Sat, 2006-09-09 08:47

Hi Henk,

No problem - In html/product.php. Change the following code (starting at Line 15)...

        <table border='0' cellpadding='0' cellspacing='0'>
          <tr>
            <td valign='top' style='padding:0px;margin:0px;'>
              <?php if (count($product["products"]) > 1): ?>
                <strong><?php print translate("Best Price"); ?>:</strong>&nbsp;
              <?php else: ?>
                <strong><?php print translate("Price"); ?>:</strong>&nbsp;
              <?php endif; ?>
              <?php print $config_currencyHTML.$mainProduct["price"]; ?>&nbsp;<?php print translate("from"); ?>&nbsp;
            </td>
            <td valign='top' style='padding:0px;margin:0px;'>
              <?php foreach($product["products"] as $priceProduct): ?>
              <?php if ($priceProduct["price"] == $mainProduct["price"]): ?>
                <a href='<?php print tapestry_buyURL($priceProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$priceProduct["merchant"]); ?>><strong><?php print $priceProduct["merchant"]; ?></strong></a><br />
              <?php else: ?>
              <?php break; ?>
              <?php endif; ?>
              <?php endforeach; ?>
              <?php if (isset($mainProduct["extraHTML"])) print $mainProduct["extraHTML"]; ?>
            </td>
          </tr>
        </table>

...and encase it within an IF statement as follows:

      <?php if (floatval($mainProduct["price"]) > 0): ?>
        <table border='0' cellpadding='0' cellspacing='0'>
          <tr>
            <td valign='top' style='padding:0px;margin:0px;'>
              <?php if (count($product["products"]) > 1): ?>
                <strong><?php print translate("Best Price"); ?>:</strong>&nbsp;
              <?php else: ?>
                <strong><?php print translate("Price"); ?>:</strong>&nbsp;
              <?php endif; ?>
              <?php print $config_currencyHTML.$mainProduct["price"]; ?>&nbsp;<?php print translate("from"); ?>&nbsp;
            </td>
            <td valign='top' style='padding:0px;margin:0px;'>
              <?php foreach($product["products"] as $priceProduct): ?>
              <?php if ($priceProduct["price"] == $mainProduct["price"]): ?>
                <a href='<?php print tapestry_buyURL($priceProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$priceProduct["merchant"]); ?>><strong><?php print $priceProduct["merchant"]; ?></strong></a><br />
              <?php else: ?>
              <?php break; ?>
              <?php endif; ?>
              <?php endforeach; ?>
              <?php if (isset($mainProduct["extraHTML"])) print $mainProduct["extraHTML"]; ?>
            </td>
          </tr>
        </table>
      <?php endif; ?>

Finally, in html/prices.php, change the following (line 13):

      <td><strong><?php print $config_currencyHTML.$product["price"]; ?></strong></td>

to...

      <td>
        <?php if (floatval($product["price"]) > 0): ?>
          <strong><?php print $config_currencyHTML.$product["price"]; ?></strong>
        <?php endif; ?>
      </td>

That should do the trick...
Cheers,
David.

Submitted by henk on Sat, 2006-09-09 12:37

works great,

only two things, i think :)

is it possible to delete the row henk from the stocklist see link, and the price in the featured products from to not 0 but the next price
link

Thx HEnk

edit : ) three when its from merchant henk the link must turned of

Submitted by henk on Sun, 2006-09-10 20:28

edit again :)

the only problem is now the link in html/product.php and the featured product from to.

Cheers HEnk

Submitted by support on Sun, 2006-09-10 21:47

Hi Henk,

Just checked your link and there are no "Henk" links left on your page now - or am I not looking in the right place?

Cheers,
David.

Submitted by Henk3001 on Mon, 2006-09-11 07:02

Hi,

The two things now are
the link in the product name,

and the zero price in the featured products

Cheers HEnk

Submitted by support on Mon, 2006-09-11 08:22

Hi Henk,

The link in the product name is generated here; line 11 of html/product.php

<h3><a href='<?php print tapestry_buyURL($mainProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$mainProduct["merchant"]); ?>><?php print $mainProduct["name"]; ?></a></h3>

To remove the link, it can be changed as follows:

<h3><?php print $mainProduct["name"]; ?></h3>

I'm not seeing any zero prices in your featured products section; but assuming that you've created that HTML section using a copy of searchresults.php (related.php???) then it will be the same modification required in that as described in my second post in this thread...

Cheers,
David.

Submitted by Henk3001 on Mon, 2006-09-11 08:49

you have to refresh again till you got one,

now i put a product in with merchant henk and that have a price 0

the result on the featured products and in the search is now 0

link

is it possible when a merchant is henk not to remove the complete price but show the not zero 0 prices.

Cheers
Henk

Submitted by support on Mon, 2006-09-11 09:09

Hi Henk,

You could show the Max price, but not the "second lowest" price because on the lowest and highest price are selected from the database on the search results pages.

          <?php if (floatval($product["price"]) == 0$product["minPrice"] = $product["maxPrice"]; ?>
          <?php if ($product["numMerchants"] > 1): ?>
            <em><?php print translate("from"); ?></em>&nbsp;<strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("Compare Prices"); ?></a></span>
          <?php else: ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
          <?php endif; ?>

(this mod goes in the same place as described in the first reply in this thread)

Cheers,
David.