You are here:  » Price with and without shipping


Price with and without shipping

Submitted by mennov on Tue, 2012-01-31 14:26 in

I added extra field to the database for shipping like described in http://www.pricetapestry.com/node/4266. This works perfectly.

I also added this code to the PT/include/admin.php:

/* decimalise price */
$importRecord["price"] = tapestry_decimalise($importRecord["price"]);
$importRecord["shipping"] = tapestry_decimalise($importRecord["shipping"]);
$importRecord["price"] = $importRecord["price"] + $importRecord["shipping"];

So my new price in the database is now the price+shipping.

Now my question, how can I post the price without shipping cost to my wordpress? With %DB_shipping% I can post the shipping price, with %PRICE% the total price, but how do I substract these two.

*Total noob with php*

Submitted by support on Tue, 2012-01-31 14:33

Hello mennov,

Sorry about the delay in your post appearing - I moderate all posts before publishing in order to protect customer information / URLs etc.

It would be straight forward to implement a new place holder %EXPRICE% so that you can show the price ex. shipping in the price comparison table.

in pto_product.php, look for the following code at line 78:

$each = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$each);

...and REPLACE with:

$each = str_replace("%PRICE%",$pto_config_currencyHTML.$product->price,$each);
$each = str_replace("%EXPRICE%",$pto_config_currencyHTML.sprintf("%.2f",($product->price - $product->shipping)),$each);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by mennov on Tue, 2012-01-31 14:39

Thanks for the quick reply David, works like a charm!