News:

Looking for documentation? Take a look on our wiki

Main Menu

Child products with checkboxes

Started by newsomjk, October 10, 2013, 18:33:37 PM

Previous topic - Next topic

newsomjk

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"

Maxim Pishnyak

A combination of custom fields could do the deal.
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

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

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

newsomjk

#3
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.

Maxim Pishnyak

Looks like posts given to you remained invisible.
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

newsomjk

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.

balai