Hello i think is possible clone voucher function for create a new Shipping funcion in Price Tapestry...
Think is possible ???
Hello David,
i have add shipping cost same in tutorial but at this moment the price not is decimalised...
i have
price 50
shipping 10.00
price 60.00
why first price not have .00 or if have last decimal 0 print .4 and not print .40 ???
How to solve it?
Thank's
Hi Marco,
You can decimalise the shipping field in the same way as the normal price field - in includes/admin.php look for the following beginning at line 279:
/* decimalise price */
$importRecord["price"] = tapestry_decimalise($importRecord["price"]);
(search for "decimalise price" as this will have moved if you've applied the upgrade manually)
...and REPLACE with:
/* decimalise price */
$importRecord["price"] = tapestry_decimalise($importRecord["price"]);
$importRecord["shipping"] = tapestry_decimalise($importRecord["shipping"]);
That may solve the problem with the display also, but if not, if you could post the code from your html/prices.php that displays the 3 price columns for each product I'll take a look - it probably just needs to be wrapped in an sprintf() call to format the price as required, e.g. instead of:
print $price;
...it would be:
print sprintf("%.2d",$price);
Cheers,
David.
--
PriceTapestry.com
i have this code:
(prices.php)
<td><strong><?php print $config_currencyHTML.($product["price"]-$product["shipping"]); ?></strong></td>
<td><strong><?php print $config_currencyHTML.$product["shipping"]; ?></strong></td>
<td><strong><?php print $config_currencyHTML.$product["price"]; ?></strong></td>
(searchresults.php)
<strong><?php print $config_currencyHTML.($product["price"]-$product["shipping"]); ?></strong><br />
<small><?php print $config_currencyHTML.$product["shipping"]; ?></small><br />
<small><?php print $config_currencyHTML.$product["price"]; ?></small><br />
(admin.php)
$importRecord["price"] = tapestry_decimalise($importRecord["price"]);
$importRecord["shipping"] = tapestry_decimalise($importRecord["shipping"]);
$importRecord["price"] = tapestry_decimalise($importRecord["price"] + $importRecord["shipping"]);
Hi Marco,
In your changes to html/prices.php and html/searchresults.php it will be this code where the prices are subtracted that will be causing it to print out with no decimal places:
<?php print $config_currencyHTML.($product["price"]-$product["shipping"]); ?>
To fix this, in place of the above, have a go with:
<?php print $config_currencyHTML.sprintf("%.2f",($product["price"]-$product["shipping"])); ?>
Cheers,
David.
--
PriceTapestry.com
Sorry Marco,
It should have been %.2f not %.2d, corrected above...
Cheers,
David.
--
PriceTapestry.com
Edit: Updated for new Responsive HTML / Responsive HTML Plus templates 14/10/15
Hi Marco,
Many users have added a shipping field to their site, which can be registered and imported on Feed Registration Step 2 following the instructions for adding a new field from this thread.
Simply follow the instructions provided using "shipping" in place of the example field "keywords".
Then, to display the new shipping field in the price comparison table, look for the following code at line 27 of html/prices.php:
<th><?php print translate("Price"); ?></th>
...and REPLACE with:
<th><?php print translate("Price"); ?></th>
<th><?php print translate("Shipping"); ?></th>
And then look for the following code at line 59:
<td class='pt_pr_price'><?php print tapestry_price($product["price"]); ?></td>
...and REPLACE with:
<td class='pt_pr_price'><?php print tapestry_price($product["price"]); ?></td>
<td class='pt_pr_price'>
<?php
if ($product["shipping"])
{
print tapestry_price($product["shipping"]);
}
else
{
print "Check website";
}
?>
</td>
If you require more flexibility or overrides, let me know more information about the data you have available and how you wish to use it and I'll take a look for you...
Cheers,
David.
--
PriceTapestry.com