VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Kuubs on August 10, 2018, 15:17:34 PM

Title: Don't show products not associated to categories / Don't show certain products
Post by: Kuubs on August 10, 2018, 15:17:34 PM
Hello,

I have a couple of products that I only want to be orderable with products. These products should not be accessible in their product details page so to speak. So I made these products and didn't give them a category. But I can still click on its name in the cart and it will take me to the product page.

Is it possible to disable these things? Or do I need to make some sort of hack that doesn't allow the product to have a paying method nor a shipping method and thus cannot be bought?

EDIT: Maybe make a certain category that is not accesible? That is also an option, to make a certain category (NOT-ACCESSIBLE) that you hide from google and the visitors of the website
Title: Re: Don't show products not associated to categories / Don't show certain products
Post by: Studio 42 on August 10, 2018, 17:22:34 PM
Hi,
You can modify the order and cart layout and remove the URL to product.
Eg for cart yoursite/components/com_virtuemart/views/cart/tmpl/default_pricelist.php
Change
echo JHtml::link ($prow->url, $prow->product_name);
To echo $prow->product_name;
Another solution is to add redirect rules, if you dont have not to many products to redirect.
Last solution, is to add a redirection in product when no categories are set and product have no parent.
Title: Re: Don't show products not associated to categories / Don't show certain products
Post by: Kuubs on August 13, 2018, 10:05:05 AM
Quote from: Studio 42 on August 10, 2018, 17:22:34 PM
Hi,
You can modify the order and cart layout and remove the URL to product.
Eg for cart yoursite/components/com_virtuemart/views/cart/tmpl/default_pricelist.php
Change
echo JHtml::link ($prow->url, $prow->product_name);
To echo $prow->product_name;
Another solution is to add redirect rules, if you dont have not to many products to redirect.
Last solution, is to add a redirection in product when no categories are set and product have no parent.

Ok awesome. I think that is a good solution to redirect these products to other products. Now there is 1 last thing that needs to be addressed.

For example when you order the product with the extra products, you can remove the main product and the extra products stay in the cart. Now these products cannot be ordered without the main product. Is there a solution to remove these products as well from the cart or do you have another solution for that?
Title: Re: Don't show products not associated to categories / Don't show certain products
Post by: Studio 42 on August 13, 2018, 10:27:02 AM
To remove unwanted products, if you have always same rule(eg product having no categories), you need to call the cart helper delete function with a plugin for eg.
Title: Re: Don't show products not associated to categories / Don't show certain products
Post by: StefanSTS on August 13, 2018, 21:56:40 PM
A question first:
Do you really need the additional product to be a VirtueMart product?
If you don't control your stock with VirtueMart there might be a simpler solutions that works well.

You could make a product:
Main Product
-> just add a custom field "string" with
- no additional product
- additional product 1
... or more, if the customer can choose between additional products.

You could also make a parent product.
Main Product
- add child products: Main Product + no additional product
- add child products: Main Product + additional product 1
- add child products: Main Product + additional product 2

This way you don't have to modify anything and no trouble in future.

Stefan