VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: newsomjk on October 10, 2013, 18:33:37 PM

Title: Child products with checkboxes
Post by: newsomjk on October 10, 2013, 18:33:37 PM
I've asked a similar question before, never got an answer and tried my own method. Turns out the method I went with was messing up the digital downloads plugin.

What we're trying to do is this... we have main "products" called papers. Let's say we have a paper named "Industry Report".

User's can't buy the actual "Industry Report" product, but it has children products: Charts & Tables, Summary, Full Report, and Webinar. In our old virtuemart, this worked fine, we showed a table of the children products with checkboxes. A user could then select a combination of the four, and click one add to cart button and then checkout and receive download links.

I'm trying to figure out how I can make a similar setup in this new virtuemart and nothing is working well. At the moment I'm trying to query the child products on the default_addtocart.php override, and then use

$model = newVirtueMartModelProduct();
$child = $model->getProductSingle($id,false);


to basically load an extra product in the product details page, and go from there for setting up the form. Problem is this isn't loading a similar structure as the main product for that page. Is there a similar function that would load the same model structure?

Really the main problem right now, is that when I display the child products right now, they show the same form as if you view them on their own page, but instead of the add to cart button it shows a text field that says "Choose a product variant first"
Title: Re: Child products with checkboxes
Post by: Maxim Pishnyak on October 10, 2013, 18:47:37 PM
A combination of custom fields could do the deal.
Title: Re: Child products with checkboxes
Post by: jenkinhill on October 10, 2013, 23:44:36 PM
Look at Cherry Picker - http://extensions.joomla.org/extensions/extension-specific/virtuemart-extensions/virtuemart-products-search/10328
Title: Re: Child products with checkboxes
Post by: newsomjk on October 11, 2013, 01:19:42 AM
Well I got it by using this:


foreach($ids as $pid){
$product = $model->getProduct($pid['virtuemart_product_id'],true);
$childproducts[] = $product;
}


But now, my question is why do these child products have the same product_s_description and product_description as the parent item? I checked in the database and both fields are empty there.
Title: Re: Child products with checkboxes
Post by: Maxim Pishnyak on October 11, 2013, 11:13:37 AM
Looks like posts given to you remained invisible.
Title: Re: Child products with checkboxes
Post by: newsomjk on October 11, 2013, 15:40:25 PM
Wow, I don't know why I bother asking for help on this forum.

The support is utter shit. I'm always told "here look at this" and it's a link to a beginner's guide to templating or something else that is never relevant.

I'm not saying the Cherry Picker plugin doesn't help with this, but it has a lot of extra stuff that I don't need and costs money. I shouldn't need to pay for a plugin to show child products.

Not to mention, I said I already achieved my goal, however the backend is putting variables in an array when they shouldn't be there. But that's fine, feel free to be a smart ass and tell me that I'm not reading your posts. I'll just do another god damn sql query to pull the ACTUAL s_description and description of a product instead of using this shitty system's functions to get them.
Title: Re: Child products with checkboxes
Post by: balai on October 11, 2013, 16:33:45 PM
Hi

I cannot help you with coding but this one can be helpful
http://extensions.joomla.org/extensions/extension-specific/virtuemart-extensions/virtuemart-products-display/22355