I added a Sale Price field and have it displaying on the product page in the description and the Stockist table. My problem is when there isn't a sale price. Most feed leave this field empty if there isn't a sale price, however, a $0.00 still somehow displays.
I've tried a "search and replace" global filter that looks for $0.00 and a drop record for a field that has $0.00 in the field to drop. However, I can't create a filter with an empty field.
Example:
http://www.example.com/shops/product/Personalized-Large-Duffle-Camo.html
I guess databases also abhor a vacuum :-)
Reset up mysql from scratch with sql from 15/01, added custom sale_price fields in feeds & products. Sale price no longer displays in product description, only display in Shortist table: {link saved} (this merchant feed has same $ in price & sale price fields).
Your above code is in html/prices.php and html/product.php. includes/admin.php has $importRecord["sale_price"] = tapestry_decimalise($importRecord["sale_price"]);
What did I not do (or do)?
Hi,
To do the same in html/product.php you need to use the $product_main variable instead of $product, that should be all it is - have a go with:
<?php
if ($product_main["sale_price"] && ($product_main["sale_price"] != "0.00"))
{
print "Sale Price: ".tapestry_price($product_main["sale_price"]);
}
?>
Cheers,
David.
--
PriceTapestry.com
How would I go about doing this for custom fields on my product page? Not all of my custom fields are used in each item and I only want the fields that have data to display. This is what I'm using now to display my custom fields in html/products.
<tr>
<th>Type:<th>
<td><?php print $product_main["type"]; ?></td>
</tr>
thanks,
Shaun
Hi Shaun,
For each <tr> in your table, enclose the entire row within an IF construct, against the field to be displayed, for example, in place of the above, you would use:
<?php if ($product_main["type"]): ?>
<tr>
<th>Type:<th>
<td><?php print $product_main["type"]; ?></td>
</tr>
<?php endif; ?>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi,
If you're using the tapestry_price() function to display the price this will cause $0.00 to be displayed if the field is empty. What I would do is use a test at the time of display to only show the field if not empty and not "0.00" - for example:
<?php
if ($product["sale_price"] && ($product["sale_price"] != "0.00"))
{
print tapestry_price($product["sale_price"]);
}
?>
(substitute sale_price for what you have actually used as the field name on your pt_products table)
Hope this helps!
Cheers,
David.
--
PriceTapestry.com