I set multiple prices for 3 different shoppergroups in a parent and child article.
This is working fine, however when I change something on the parent article all prices in the child articles are completely deleted.
So when a parent changes I need to fill in all pricing info for the subarticles. Is this a bug?
I really need the prices to stay on changing anything in the parent article. Please help!
Which VirtueMart 2 version do you use? Do you have the child products set up as 'generic child variant'?
I use latest version 2.0.20b.
What do you mean by generic child product?
I generated the child product on the parent product bottom. Add child variant.
Then i edited the created product with the right sku, category and pricing details for the shopper groups.
I'm not shure if your method works without having defined a custom field before using the 'Add child variant' in the 'Product Edit view'.
Normally you would go to 'Products' > 'Custom fields' > Click "New" and enter something similar to this into the form field:
Custom Field Type: Generic child variant
Title: Product Variants (or whatever name you want to display in the frontend product view)
Published: Yes (checked)
Cart Attribute: Yes
Layout Position: ontop (not shure if this is still required. It probably works without specifying this VM template position in the newer versions)
Click on "Save"
After doing the above, add a child product the way you did before or from the product list. Then go to the 'Custom fields' tab in your parent product's 'Product Edit view' and configure the 'Product Variants' (Generic child variant) for example: Display parent as option = Yes, Parent orderable = Yes, Product Alias selected.
Yes did it that way. I have made a custom field type: generic child variant.
Stange thing is though, it works with single prices in the articles.
So if i set a fixed single price (without shoppergroup choice set) it works as intended. And the price on the child products are preserved.
However when I set multiple prices for the various shopper groups they are deleted upon changing the parent article.
Just tested this. Actually seems to be a bug. I'll report it to the developers.
So single prices work as expected storing the product, but not multiprices. Thx
Thanks, I hope to get a quick solution for this.
My client wants his site up and running and this is a showstopper.
@milbo:
Indeed I tested with single price and then te prices of the child products are preserverd.
When set multiple prices the prices of all the related child products are deleted upon changing the parent article.
Please let me now if there is a quick solution coming up?
My site in progress has to go live ...
I have the Same problem
Joomla! 2.5.9
VM2 2.0.20b
I am using the stockable plugin. Everytime I modify the main product all the prices I have added to the child products are gone. This is a clients site and it worries me because he has hundreds of products. I am only testing it now but when i do the the product upload to the DB I hope that this will not affect all the products.
Please DEV fix this problem
Yeah I have the same problem. When I modify the main product all the child product prices are erased. Is there a fix for this yet? Because this is for a client site and I need to get this fixed or change carts.
OK Guys I have found the Damn problem.
VM2 2.0.20b
It is in the product.php file line 1546:
if ( count($old_price_ids) ) {
//delete old unused Customfields
$this->_db->setQuery( 'DELETE FROM `#__virtuemart_product_prices` WHERE `virtuemart_product_price_id` in ("'.implode('","', $old_price_ids ).'") ');
$this->_db->query();
}
This damn code doesn't know if they are old unsued or used. So I have commented it out and now the prices stay. the only problem now is once you add them you can no longer delete the price fields. you can modify them though. So it atleast stops them from being deleted.
$old_price_ids seems to be the root variable that is used to delete the prices. Below is the line that retrieves all the prices for a certain product ID
Line 1486
// Get old IDS
$this->_db->setQuery( 'SELECT `virtuemart_product_price_id` FROM `#__virtuemart_product_prices` WHERE virtuemart_product_id ='.$this->_id );
$old_price_ids = $this->_db->loadResultArray();
Well not sure how to fix this I am still running vmbug to see if I can fix it but for the moment if you comment out ;
if ( count($old_price_ids) ) {
//delete old unused Customfields
$this->_db->setQuery( 'DELETE FROM `#__virtuemart_product_prices` WHERE `virtuemart_product_price_id` in ("'.implode('","', $old_price_ids ).'") ');
$this->_db->query();
}
Then atleast you won't have to worry about your prices disappearing. I would suggest creating a Group called Delete for when I or the DEV find a solution for this
This issue has been solved already. I just tested it in the latest developer (SVN) version of VM2 and it works.
If this has been fixed can the developers please post the fix here so we can fix this.
Just to clarify, I an using Joomla 2.59 // VM2 2.0.20b and this problem happens with the stockable variant plugin. I not sure about the generic but this one is sure.
I set prices in Child for Public/default then a price for shoppers then a price for Wholesale Group for each variant. Now if I go and modify anything in the Parent then all those prices are erased. I even checked the DB.
Problem with my solution is if you erase the products now the price entries stay in the DB but atleast if you modify the Parent you dont lose your prices.
If there is a solution for this please let us know. My way allows us to set specific prices for each variant to certain groups.
WHy the heck did you guys remove the wholesale price that worked so well in VM 1. Should have left it and added your new system as a plugin or option.
You could create a copy of your site and test if the latest developer version 2.0.21c solves your price problem using the stockable plugin (without the stockable plugin prices are not erased in 2.0.21.x when the parent is modified) However, afaik the goal is to remove the stockable plugin and integrate its features into the dynamic child variants - but this still is work in progress and might not be available before version 2.1.
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!!
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).
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!
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.
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.
http://forum.virtuemart.net/index.php?topic=117544.msg397274#msg397274
We deleted the whole sale price? No, we did not.
The error happens only, when you parent has no price, but your childs.
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
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.
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..
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?
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.
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?" ;)
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!
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.