News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Article prices of child products are deleted when changing parent article

Started by pinkeltje77, April 17, 2013, 13:00:35 PM

Previous topic - Next topic

dangelo

Is there a solution available for this issue?????

I'm at version 2.0.22a and this issue IS NOT FIXED!!!

Any hack/modifications about that!!??

6 User groups and you can understand what is going on when I make a change at one of my parent products...

Thank you in advance!!

Maxim Pishnyak

Price of child products are modified along with modifying parent product price as well when saving parent product. Cos parent and child prices are collected on the same tab on the edit product page.

I want to believe that you have problem but, please, post here screen shot BEFORE modifying and AFTER it (first tab on edit parent product page ofc).
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

dangelo

It is very accurate description what is happening with the prices at the child products!

From my post here: http://forum.virtuemart.net/index.php?action=profile;area=showposts;u=316234
Quote
Info: Joomla 2.5.11, VM: 2.0.22a, PHP:5.3.21

I have set my parent/child products as follows:
When the product is OK:
     -Parent product (no price)
             -Child#1 (shoppergroup#1 = 10E, shoppergroup#2 = 20E)
             -Child#2 (shoppergroup#1 = 20E, shoppergroup#2 = 40E)

So far everything are OK! If for some reason I want to change the photo or add a new one, or to change the short description, or make any change at all at parent product, ALL the prices from child products are deleted!!!
When the product is NOT OK:
     -Parent product (no price)
             -Child#1 (shoppergroup#1 = 10E, shoppergroup#2 = 20E)
             -Child#2 (shoppergroup#1 = 20E, shoppergroup#2 = 40E)


What is that you are not understanding? It's as simple as that!

Commenting Out the lines 1695 to 1707 resolve my problem for now (hope that this will not create otther issues):
//if ( count($old_price_ids) ) {
// $oldPriceIdsSql = array();
// foreach($old_price_ids as $oldPride){
// $oldPriceIdsSql[] = $oldPride['virtuemart_product_price_id'];
// }
// // delete old unused Prices
// $this->_db->setQuery( 'DELETE FROM `#__virtuemart_product_prices` WHERE `virtuemart_product_price_id` in ("'.implode('","', $oldPriceIdsSql ).'") ');
// $this->_db->query();
// $err = $this->_db->getErrorMsg();
// if(!empty($err)){
// vmWarn('In store prodcut, deleting old price error',$err);
// }
// }


I can't understand the complete procedure, but as far as I can understand, you are deleting the prices at the child products if there are any (I can't understand why to do this.. if you wan't to do this just add a seperate "button" for this procedure!) and you are not (again for some reason) inserting back at them (child products) again!

Imagine that you have a product (parent) with 10 child products and that all childs have prices for 5 different shopper groups. That's 50 prices to be inserted again from scratch every time you are changing.. i.e. the description, or adding a photo, or doing something at the parent product!!! !!!
Not, not so good for the administrator of that VM site.

As amerloc said before, please if the solution is available just post it!


Maxim Pishnyak

Quote from: dangelo on July 29, 2013, 12:48:37 PM
As amerloc said before, please if the solution is available just post it!
Quote from: jjk on May 16, 2013, 15:47:10 PM
This issue has been solved already. I just tested it in the latest developer (SVN) version of VM2 and it works.
I think I could see link to SVN Repository on main page of Virtuemart Project. So it's not so complex to go there in folder "models" and to get repaired "product.php"
Quote from: dangelo on July 29, 2013, 12:48:37 PM
Imagine that you have a product (parent) with 10 child products and that all childs have prices for 5 different shopper groups. That's 50 prices to be inserted again from scratch every time you are changing.. i.e. the description, or adding a photo, or doing something at the parent product!!! !!!
Not, not so good for the administrator of that VM site.
Fully agreed with you that manual product management could be risky for products information i.e. product database.
Risky because not everyone perform deep test of every current version of Virtuemart.

That's way I'm adept of CSVI Improved style of product management:
1. I do export of my products from time to time.
2. Thus, if snowball suddenly will fly in my mouth, I'll be able to find in my Excel-like document rows of deleted prices and I'll be able to perform import of this records back to the web shop database.
This is fast and easy method. Very deadly.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

dangelo

I think that I have mention at my post the info of my site VM 2.0.22a (the latest one? I think?).
And if this one is the latest, the file should be there corrected, no? Here: http://dev.virtuemart.net/projects/virtuemart/files I could only find the version that I'm using now.

The CSVI solution that you are suggesting, ok is a solution, but I do get daily backups, I do have all the deleted prices and all my data!
What I do not want! is the rows of my database been deleted with out control by a piece of code working wrong.

These are two different thinks "prevantion" and "restore", the one is before the other...

I will stick with the solution that I'm proposing at earlier posts by amerloc.


Milbo

We deleted the whole sale price? No, we did not.
The error happens only, when you parent has no price, but your childs.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

dangelo

OK you are not deleting the prices, your code does..

It is not logical the prices at child products to be deleted if the parent product has no prices for more than one reason.
If I want to have a product (parent) with general discriptions, images etc and more than on (obviously) child products that has different prices what will happen when:
a) I'm "building" the child product (set prices, add general discriptions etc) and after that I want to change a wrong description at parent product? (prices at parent product gets deleted)
b) I have create everything on my product (parent and  childs) and want to add an image on parent product? (prices at parent product gets deletted)
c) I want to unpublish the parent product? (have not try this but maybe the prices at parent products gets deleted?)

I could try and think many other cases for that "logic"...

The think is that, if you understand that it is an error, maybe it should be corrected at next version?

Please dont missunderstand my intentions. I respect your (as a team) job and I think that you are doing excellent job.

Angelo

jjk

Is there any reason why you can't give the parent product a price and then assign higher or lower prices to your child products?
If your parent product would have a price and you would  use 'Generic child variant' for your child products and enable 'Display Parent as Option' and 'Parent orderable' in your product's Custom Fields tab, you wouldn't have your problem with loosing prices.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

dangelo

Yes, because I dont use the parent product as a product that is added at the basket and it is much more easier to deal with prices where I want them to be used at.

We just think about this in different ways..

jjk

I considered to use your approach myself, but decided against doing it this way, because when you don't allow to add the parent product to the cart, you always need to create one more child product. I don't see any advantage with only assigning prices to child products, except for the case when you want to assign a different option to every product name in the dropdown selection. For example:

Product name: Coffee Cups
With your approach the available dropdown selections could be:
Coffee Cups, white
Coffee Cups, blue
Coffee Cups, red

When including the parent product, which bears the name 'Coffee Cups' the available dropdown selections could be:
Coffee Cups
Coffee Cups, blue
Coffee Cups, red


BTW - I didn't see a reply from you at your other forum thread http://forum.virtuemart.net/index.php?topic=117544.msg397274#msg397274
Didn't the file supplied by kkmediaproduction solve your problem or did you just overlook that reply?
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

dangelo

As I said before... we think about this in different ways..

I'm thinking of VM as a product that can cover all options of doing/presenting products.
I think that is the best practice when you are building an app.

The problem in this topic is NOT which way is the correct one to use, but why when I'm applying a certain approach at VM an error occurs, which is to delete the prices from child products.
And that is the one that need to be fixed or give a workaround at users/developers.


jjk

Quote from: dangelo on August 08, 2013, 16:22:27 PM
And that is the one that need to be fixed or give a workaround at users/developers.
The primary question in my previous reply was "Did the fix supplied to you by kkmediaproduction solve/didn't solve your problem?"  ;)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

K&K media production

QuoteAnd that is the one that need to be fixed or give a workaround at users/developers.

You have open a extra thread for this and I've send you the fix on July 29!

Milbo

Quote from: dangelo on August 08, 2013, 16:22:27 PM
And that is the one that need to be fixed or give a workaround at users/developers.
and the workaround is to give the parent a price. Which is never visible in your case anyway. or use the provided fix.

And we know ourself how nasty it is, because we use a parent as pattern ourself. But we added a price to the parent as fallback.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/