News:

Looking for documentation? Take a look on our wiki

Main Menu

Save function in product edit

Started by alexanderflr, September 12, 2017, 17:45:30 PM

Previous topic - Next topic

alexanderflr

Hi,

Does anyone know where I can find Save classes for product price?
I'm looking for a way to stop Save button to save prices when I edit a product. I don't need the possibility to edit the prices because I created a software that does that and inserts the prices automatically in the database.

I'm using Joomla! 3.7.5 Stable, PHP 7.0.18, Virtuemart 3.2.2
Thank you,
VM 3.2.8, Joomla 3.8.3, PHP 7.0.26

Jörgen

Make an override for the view:

administrator/templates/isis/html/com_virtuemart/product/product_edit_status.php

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

alexanderflr

Hi,
I checked that and is nothing to do with prices  :'(

Thank you.
VM 3.2.8, Joomla 3.8.3, PHP 7.0.26

Jörgen

Sorry
Was a bit Quick, You will find the original files under
administrator/components/com_virtuemart/views/product/tmpl

and the override should be this file
administrator/templates/youradmintemplate/html/com_virtuemart/product/product_edit_price.php

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

alexanderflr

Hi,

Thank you.

I tried to do that but if I change something else to the product and save, all of the prices disappear  :'(
VM 3.2.8, Joomla 3.8.3, PHP 7.0.26

Milbo

Because the normal way in php is to load the form with the current values and to store the whole thing.

So when your system sets the prices, they should be there, when you edit the product and stored with the rest of the form. There is only one function working different, the toggle function. we update only the boolean, when you use the toggle function in the list (to publish or make a product featured). In all other cases, the form overwrites anything which is there. The same with the config. When you store the config, it starts with fresh data. It loads first the config file, then the all values get overwritten by the form. So any values stored in the config, which are not in the file or form get deleted.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

alexanderflr

Hi Milbo,

I understand what you are saying and makes sense but must be a way not to load them, will help me also not the have them at all in the product edit page...  :'(
VM 3.2.8, Joomla 3.8.3, PHP 7.0.26

JM0308

Hi

I have been trying to do this on a website I am working on 2, we do not have as may prices as the original poster but we still have around 70/80 shopper groups and the load time is slow when editing each product.

What I have been trying to do is stop the "Product Pricing" section of the "Product Information Tab" from loading on open. I cant find the correct file that builds the product edit page? I can delete the code from the Product Edit page and it stops the pricing from loading but then when I save it deletes all the data. So my plan was to take out the product pricing from loading so when it saves the product pricing isn't there to save so it just does nothing!

Any ideas?

Thanks
Jack

Studio 42

YOu have a simple solution.
Hide the price container in ROOT/administrator/components/com_virtuemart/views/product/tmpl/product_edit_information.php
search : Product pricing
and replace <fieldset> (it's the second in the file) with
<fieldset style="display:none'>

If you need to quick modify products, you can Buy VM Be Pro and disable price column too in this component.

JM0308

Thank you for your help I will give it a go and let you know!

alexanderflr

Hi Studio 24,

I done this before but the pricing is still loading even if is not visible. I have around 150 price groups, the loading time is not the best.
VM 3.2.8, Joomla 3.8.3, PHP 7.0.26

Studio 42

Problem is that VM does update all fields on save. So removing the field, remove the price.
If you really want remove it, then you have to modify the product model, so price is never saved.

alexanderflr

Hi,

Thank you very much, do you know what lines must be modified? Thank you.
VM 3.2.8, Joomla 3.8.3, PHP 7.0.26

Studio 42

search in
public function store (

add
$data['mprices'] = null;
before
if (isset($data['mprices']['product_price']) and count($data['mprices']['product_price']) > 0){

add
$old_price_ids = null;
before
if (!empty($old_price_ids) and count($old_price_ids) ) {

should work (or comment all the codes about prices in this function)

alexanderflr

Thank you very much, you are a star!
Works great, exactly what I needed.
VM 3.2.8, Joomla 3.8.3, PHP 7.0.26