Welcome, Guest. Please login or register.
Login with username, password and session length


VirtueMart 1.1.8 - [SECURITY RELEASE] is available! Read more....

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
Pages: [1]   Go Down
Print
Author Topic: How to display only the net price?  (Read 5278 times)
Joomla
Newbie
*
Posts: 6


« on: May 14, 2007, 14:39:16 PM »

Hello,

I want to display only the net price (price without the tax).  How do I get rid of the gross price?

This is my first time using joomla so forgive me if my question has been answered before.(I looked around but I didn't find anything..)

Thanks a lot!
Logged
seancharles
Newbie
*
Posts: 6


« Reply #1 on: May 16, 2007, 12:23:21 PM »

Spooky!

I have the same requirement... a UK based trading site that is for tradespeople who want to see only the 'nett' price, no VAT shown.

Currently I know that that the database only stores the nett figure so when I have a solution I will post it here... hopefully in the next day or so because *I* need to get it working.

I know *what* to do, but as is always the case with VM, you have to make sure you cover all bases and also not to muck up anything else by accident!

Will post solution as soon as I have one!
Logged
seancharles
Newbie
*
Posts: 6


« Reply #2 on: May 16, 2007, 14:44:51 PM »

ADDING A {retail_price} TAG TO PRODUCT TEMPLATES

If 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 ONE
edit: administrator/components/com_virtuemart/html/shop_product-details.php

At 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 TWO
edit: administrator/components/com_virtuemart/html/shop.browse.php

At 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.

Logged
Joomla
Newbie
*
Posts: 6


« Reply #3 on: May 16, 2007, 15:21:44 PM »

Do you have to be an administrator to edit the code?  How did you access the code?
Logged
seancharles
Newbie
*
Posts: 6


« Reply #4 on: May 16, 2007, 15:32:06 PM »

Yo do NOT need to be an administrator to do this, but you do need to be a developer!

You have to edit the Virtue-Mart source files that are mentioned in the post, then save them and the changes will take place the next time you request a page.

Somewhere on your machine you must have installed Joomla, the files are within that installation directory. For example, if you installed on Windows under C:/your-sitename then the files to edit would be at:

C:/your-sitename

Are you a developer ?
Are you comfortable coding with PHP ?

Or, as I suspect from your question, you are the luck person who has to build a web-site using things you have never used before and it all feels like the end of the world and totally confusing!  I have been there myself many times!

Logged
seancharles
Newbie
*
Posts: 6


« Reply #5 on: May 16, 2007, 15:35:55 PM »

You do NOT need to be an administrator to do this, but you do need to be a developer!

You have to edit the Virtue-Mart source files that are mentioned in the post, then save them and the changes will take place the next time you request a page.

Somewhere on your machine you must have installed Joomla, the files are within that installation directory. For example, if you installed on Windows under C:/your-sitename then the files to edit would be at:

C:/your-sitename/administrator/components/com_virtuemart/html/shop_product_details.php
C:/your-sitename/administrator/components/com_virtuemart/html/shop_browse.php


Are you a developer ?
Are you comfortable coding with PHP ?

Or, as I suspect from your question, you are the luck person who has to build a web-site using things you have never used before and it all feels like the end of the world and totally confusing!  I have been there myself many times!
Logged
Joomla
Newbie
*
Posts: 6


« Reply #6 on: May 16, 2007, 17:18:13 PM »

Its great to know that somebody out there has been where I am now!  Grin  The site has already been setup by someone else.. not on my computer.  And yes, I am new to php programming! (But I'm eager to learn it!)

Is it still possible to work (and access the code) on the code?  Do I have to work on the same computer .
Logged
seancharles
Newbie
*
Posts: 6


« Reply #7 on: May 17, 2007, 01:22:14 AM »

If you have access to the location where it has been installed, then yes, you can make the changes I described.

You do not have to be on the same computer; if you have an editor that supports remote editing then you can use that. Most of the time I use a unix program called 'midnight commander' and 'vim' to do my editing.

If you are on a windows box, I suggest using something like JEdit as it lets you read and write files to and from an FTP server.

JEdit is at www.jedit.org and runs on any computer that Java will run on. It has some very good PHP support modules as well.

I would never suggest editing a live site though just in case you break it... much better to have a local copy of the site and Apache on your development machine and then just upload the changed files when you know you have a working solution.

Tell me some more about your situation, I could possibly help. For what it's worth I am in the UK and skype-able...


Logged
Ricsike
Newbie
*
Posts: 3


« Reply #8 on: June 18, 2008, 07:48:19 AM »

Hi,

I found this solution for my problem.
It's work, but I'like to do back the original status.

I changed back the original code, but the nothing happend.

How can I reverse this procedure?

Thanks a lot

Richard
Logged
Ricsike
Newbie
*
Posts: 3


« Reply #9 on: June 18, 2008, 08:01:45 AM »

Hi,

And another reflection.

When I put the products to the basket, the VAT = 0! It is not valid!
The products are set to 20% VAT.

Richard
Logged
Pages: [1]   Go Up
Print
Jump to: