ADDING A {retail_price} TAG TO PRODUCT TEMPLATESIf you follow the instructions below carefully, you will have the ability to show the products nett price. This means that you can display *just* this value without pulling in the baggage if the 'show price including tax' configuration setting is enabled.
STEP ONEedit: administrator/components/com_virtuemart/html/shop_product-details.phpAt approx. line 360, there is a bunch of lines that look like this:
/** NOW LET'S BEGIN AND FILL THE TEMPLATE **/
$template = str_replace( "{navigation_pathway}", $navigation_pathway, $template );
$template = str_replace( "{navigation_childlist}", $navigation_childlist, $template );
:
: (removed for brevity )
:
$template = str_replace( "{product_packaging}", $product_packaging, $template ); // Changed Packaging
now, immediately after this group of statements add this:
// (sjc-16-may-2007) :: NET PRICE
// Substitute $retail_price for the {retail_price} tag NB: Your flysheet may want
// to add something like "exc. VAT" or similar so people are aware!
//
$retail_price = $ps_product->get_retail_price($product_id);
$retail_price = $CURRENCY_DISPLAY->getFullValue($retail_price['product_price']);
$template = str_replace( "{retail_price}", $retail_price, $template );
// -- end-of-change
This will replace all occurrences of {retail_price} with the actual nett figure from the database for the product being passed through the fly-page.
The next step requires editing two places so the above should have got you warmed up. You need *both* sets of edits in place for it to be effective throughout VM, be patient.
STEP TWOedit: administrator/components/com_virtuemart/html/shop.browse.phpAt approx. line 395 there is this code:
/** Price: xx.xx EUR ***/
if (_SHOW_PRICES == '1' && $auth['show_prices']) {
$product_price = $ps_product->show_price( $db_browse->f("product_id") );
}
else {
$product_price = "";
}
Immediately after this add the following code:
// (sjc-16-may-2007) :: NETT PRICE
// Locate the raw retail price and save it in $retail_price.. this can then
// be used in any shop flysheet from this point onwards.
//
$retail_price = $ps_product->get_retail_price($db_browse->f('product_id'));
$retail_price = $CURRENCY_DISPLAY->getFullValue($retail_price['product_price']);
// end-of-change
This prepares the $retail_price variable with the required value from the database for the current product, now we just need to add it to the list of {} tags that are recognised.
So, at approx. line 470 give or take a few, there is this code block:
$product_cell = str_replace( "{product_name}", shopMakeHtmlSafe( $product_name ), $product_cell );
$product_cell = str_replace( "{product_s_desc}", $product_s_desc, $product_cell );
$product_cell = str_replace( "{product_details...}", $product_details, $product_cell );
$product_cell = str_replace( "{product_rating}", $product_rating, $product_cell );
$product_cell = str_replace( "{product_price}", $product_price, $product_cell );
$product_cell = str_replace( "{product_price}", $product_price, $product_cell );
$product_cell = str_replace( "{form_addtocart}", $form_addtocart, $product_cell );
$product_cell = str_replace( "{product_sku}", $db_browse->f("product_sku"), $product_cell );
Immediately after this section, paste this code:
// (sjc-16-may-2007) :: NET PRICE
// Substitute $retail_price for the {retail_price} tag NB: Your flysheet may want
// to add something like "exc. VAT" or similar so people are aware!
//
$product_cell = str_replace( "{retail_price}", $retail_price, $product_cell );
// -- end-of-change
Now save everything.
When you browse and display products from now on, all uses of the tag {retail_price} will cause the NETT price to be displayed.
Hope that helps.
Sean Charles.