Author Topic: We need a reseller´s product cost/purchase price field in Virtuemart admin..  (Read 3561 times)

Genius WebDesign

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 175
    • Genius WebDesign
Hello out there,

As a shop-owner you normally want to have a clear overview over how much you earn for the products you sell.
If you are a reseller-shopowner (someone who does not produce his own products), then in addition to all the cutomer-related product prices, you also need to have the purchase price (the shop-owner´s cost for the product - not the customer´s cost price).

As it is now there are only input fields for customer-related prices in the Virtuemart product admin page.
As I see it it is strongly missing a price field for the ahop-owner´s own product cost prices.
Actually I have been forced to add my own database field to the Virtuemart price table, which is of course a hack and not very good when upgrading to newer versions of Virtuemart..

Please speak up if you agree or disagree with this feature request.
 

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26417
  • Always on vacation
    • Jenkin Hill Internet
The Cost Price field is already there. When VM2 was introduced it was referred to as the base price, displayable in the front end to store admins only,  but there were a lot VM users who had difficulty with the concept! See http://forum.virtuemart.net/index.php?topic=111093.msg406231#msg406231   - and then browse that thread to see how it is misunderstood.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM3.2.8 on Joomla 3.8.2 PHP 7.0.25

Testing VM3.2.8 on J3.8.3RC

gain

  • Beginner
  • *
  • Posts: 47
Is using the calc rules the only way to modify base price from cost price?

I have different margin for every product and can't modify the base price manually.
Can't create ad hoc calc rule and associate it to my product only too:
from the calc rule I can't select only one product and from product edit I cant select the rule from cost price level (as from base price level with tax)... :(

How can I manage this?

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2639
  • VirtueMart Version: 3.2.5
I ended up creating a separate field for supplier cost price

Trying to manage cost prices / retail prices with all the variants of supplier discounts was too much of a headache - we do this now in external systems.

However, the base price that Jenkin mentioned will work for many shops who have simple supplier discount structures

Storing the cost price in VM enables us to do margin displays in the backend admin

Deploying your own database addition is very simple and easy to maintain as long as you have good code management
regards
A

Joomla 3.8.2
php 5.6 + php 7

gain

  • Beginner
  • *
  • Posts: 47
I ended up creating a separate field for supplier cost price

Trying to manage cost prices / retail prices with all the variants of supplier discounts was too much of a headache - we do this now in external systems.

However, the base price that Jenkin mentioned will work for many shops who have simple supplier discount structures

Storing the cost price in VM enables us to do margin displays in the backend admin

Deploying your own database addition is very simple and easy to maintain as long as you have good code management

Thanks for the reply.
I'm evaluating if I can store the cost price in a custom field.
I've seen these properties in custom field definition:
  • Published (yes/no)
  • Admin only (yes/no)
  • Hidden (yes/no)
How this properties works?
Can be suitable for my needs (have a custom field for only admin purposes without publishing it online)?

Thanks in advance for the support.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2639
  • VirtueMart Version: 3.2.5
Custom fields could be used but they are a real pain and not great for use in admin

I would just add a new database field.

Very simple to do and then easy to customise the admin pages using a view override by putting the view in your admin template html directory

Just add the new field to the database:

   `q_supplier_cost_price` VARCHAR(10) NULL DEFAULT NULL

I use varchar but it is up to you

Then reference that field in :-

administrator\components\com_virtuemart\tables\products.php

Code: [Select]

         var $layout = '';
       /** @var int published or unpublished */
var $published         = 1;

    /** MY NEW variables */
    var $q_supplier_cost_price = null;




Then fix the annoying "bug" that stops you using an override in product admin:-
\administrator\components\com_virtuemart\views\product\view.html.php

Line : 55

Code: [Select]
            //quorvia removed to allow template overides in product admin
//        $this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'product'.DS.'tmpl');


The do your template override to the view: product_edit_information.php and put it in
Create a copy in
administrator/templates/YOUR ADMIN TEMPLATE/html/com_virtuemart/product/product_edit_information.php

And add your new field:-

Code: [Select]
  <tr>
            <td class="label">Supplier Cost</td>
            <td>
                <input type="text" class="inputbox" name="q_supplier_cost_price" id="q_supplier_cost_price" value="<?php echo $this->product->q_supplier_cost_price?>" size="12" maxlength="14" />
            </td>
        </tr>


Code: [Select]




I actually do it slightly differently for all my new variables (as I have more than 1)

I still update the product database and the tables\products.php

But, I create a brand new TAB for my new variables so I ensure that I get all the changes to the standard product edit views
I call this something like

\administrator\templates\YOUR ADMIN TEMPLATE\html\com_virtuemart\product\product_edit_myview.php

Then I just need a tab to display that new view:-

So I created an override  \administrator\templates\YOUR ADMIN TEMPLATE\html\com_virtuemart\product\product_edit.php

Code: [Select]
<?php // Loading Templates in Tabs
$tabarray = array();
$tabarray['information'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_INFO_LBL';
$tabarray['description'] = 'COM_VIRTUEMART_PRODUCT_FORM_DESCRIPTION';
$tabarray['status'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_STATUS_LBL';
$tabarray['dimensions'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL';
$tabarray['images'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_IMAGES_LBL';
$tabarray['custom'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_CUSTOM_TAB';
$tabarray['myview'] = 'My new view'//added by quorvia

I now have a tab with my new fields in, that does not get overwritten by updates and still lets me see the new stuff in VM upgrades

I do however have to retrofit the small changes I make to these 2 files

\administrator\components\com_virtuemart\views\product\view.html.php
administrator\components\com_virtuemart\tables\products.php


But it is worth it, as I now have a field that I can update using spreadsheets and csvi and mysql etc that is always attached to a product and can be referenced wherever I wish.

I hope this helps

Some might say that I should create a separate database for my own stuff - but I cannot see the benefits of doing that over extending the current product database.
regards
A

Joomla 3.8.2
php 5.6 + php 7

gain

  • Beginner
  • *
  • Posts: 47
Thank you very much for the explanation of your solution.
It's clear and well formatted, it may be useful to many, even if I don't know if I'll use it...

Thanks again :)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9412
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Okey, so what we need is a possibility to enter the baseprice? so that people can use the costprice as intended, because doing all by profit margin rules is to complex? Hmmm..... I doubt we should do it already for vm3, or? could be to confusing, or?
Hmmm. interesting, I will think about that in my hollidays, cyah
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2639
  • VirtueMart Version: 3.2.5
Milbo

I like the way you keep using "base price" just to confuse us all  ;D

No doubt if you introduced a separate value, it would result in people moaning that it did not do what they wanted and what then is base price etc etc

For many the current "base price" is functional.  For thos awkward people (me included) we can introduce whatever fields we need.

Holidays ?  Tsk tsk.   8)
regards
A

Joomla 3.8.2
php 5.6 + php 7

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1142
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.6
Hello

Nice to see that more people are interested in storing a purchase price. I like to adjust the price that the customer pays in order to adapt to the actual market situation. But I still want to know the price I purchased the product for. It would actually also be interesting to see the purchase price history. Many companies keep track of purchase prices with relation to from whom and at which price it was purchased. But this probably requires a new table with purchase prises :)

Introducing a purchase price is a nice step on the way.

best regards

Jörgen @ Kreativ Fotografi

Joomla 3.8.2
Virtuemart 3.2.6
Olympiantheme Hera (customized)

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2639
  • VirtueMart Version: 3.2.5
Milbo is only considering it as an option

For a retailer it is good to identify the cost price against stock held

Sales and stock movement is then allocated on a FIFO (first in first out) basis

The last retail system I worked with held 3 cost prices with 3 stock values with date of stock entry.

Useful if you have a volatile Retailer Cost price and want to see Retail "Margin on return" against old stock. 
It is easy to adjust a retail price and make a loss on old stock (if you are not really watching!).

You would need to be able to book stock in at a cost price and where the new stock cost differs from current cost, prior stock gets bumped down one level

The oldest level never gets bumped if it has stock in it, it acts as a catch all bucket with the cost price being that of the stock being moved into it.

This is clearly above and beyond where VM is now, but worth a thought.  Many people will have resorted to spreadsheets etc to try and mange this, but you have to be sure where the "system of record" is for your stock.

Ohh I need a Holiday!  8)

regards
A

Joomla 3.8.2
php 5.6 + php 7

oviliz

  • Beginner
  • *
  • Posts: 27
I am interested as well.

I have the following real-life condition:
  • cost prices
  • RRP prices that are a randomly percentage over the cost price between +10% and +13% (I mean, +10.19% +11.93% +10.45% +12.02% etc.)
  • different wholesale groups prices that are grouped per fixed percentage over the COST PRICE (as +5% +7% +10%)

Maybe I will try to implement the Hutson suggestion. Thanks for that.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9412
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Custom fields could be used but they are a real pain and not great for use in admin

Maybe for you. If you setup a pattern and furthermore use only that pattern, it is just a 5 minutes action and the rest is behaviour, very simple.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2639
  • VirtueMart Version: 3.2.5
I know that the rules/patterns will work very well for many VM users and I think it is a real positive part of the development.

It would be great for someone to put a tutorial together with real life examples, so that new users could get to grips with it and put it to some good use.

I have just chosen to use an alternative approach  :)

I manage the pricing and margins using external systems/processes, so VM just gets an ex-vat price.

VM devs are really doing a great job hence why I support the forums with my time and try to help others and test new versions where possible.





regards
A

Joomla 3.8.2
php 5.6 + php 7

jux

  • Jr. Member
  • **
  • Posts: 77
  • VirtueMart Version: latest
Re: We need a reseller´s product cost/purchase price field in Virtuemart admin..
« Reply #14 on: September 30, 2014, 03:43:43 am »
Hello

Nice to see that more people are interested in storing a purchase price. I like to adjust the price that the customer pays in order to adapt to the actual market situation. But I still want to know the price I purchased the product for. It would actually also be interesting to see the purchase price history. Many companies keep track of purchase prices with relation to from whom and at which price it was purchased. But this probably requires a new table with purchase prises :)

Introducing a purchase price is a nice step on the way.

best regards

Jörgen @ Kreativ Fotografi




You have understood everything, please please make in VM3 a field where we can insert purchase price! We need history of purchase price very usefull to control purchase price change

I think it is a must have for all shop owner