You are here:  » Custom fields in price table


Custom fields in price table

Submitted by shaunmac on Sun, 2016-01-24 17:28 in

How would I go about adding custom fields to my price table located on my product page? Right now it's showes (merchant, product name, price, and link). I need to add (quantity, stock, and price per item). I already have it in my database and indexed I'm just not sure how to add it to my price table. Also would I be able to make my price table have rows and columns? Thought it would make reading it easier since there might be up to 20 items compared on each page.
Thank You,
Shaun

Submitted by support on Mon, 2016-01-25 09:20

Hello Shaun,

Within the loop in html/prices.php all custom fields are available in the $product array variable and can be displayed as required using, for example:

<?php
 
print $product["quantity"]; 
?>

One thing to do would be to embed your custom fields within a table shown below the original name column. To do this for the custom fields quantity and stock, edit html/prices.php and look for the following code around line 57:

<td class='hide-for-small-only'><?php print $product["original_name"]; ?></td>

...and REPLACE with:

<td>
  <?php print $product["original_name"]; ?>
  <table>
    <tr><th>Quantity</th><td><?php print $product["quantity"]; ?></td></tr>
    <tr><th>Stock</th><td><?php print $product["stock"]; ?></td></tr>
  </table>
</td>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com