Support the VirtueMart project and become a member

Main Menu

Attributes/Custom Fields Thread

Started by PRO, September 12, 2011, 15:02:49 PM

Previous topic - Next topic


Quote from: John2400 on March 19, 2012, 12:27:08 PM
What about this :

Thinking out of the box

I don't know if it works

I'm not sure if I understand what is being said there, but it sounds almost exactly like what we have now..

I've made more progress, removing the parent product from the dropdown. I'm not really removing it, the idea is that the parent is really the first atribute. so together with my mod for changing the titles, solves the price on parent issue and odd parent product in dropdown at the same time.

see this link ->
VM 2.0.4 Stable


quick question - when you add say the 24mg size to the cart does it say what product you are ordering or just the size?
(I tried on your site but I got the message '24mg out of stock')


Try it again, I turned off special action for out of stock. You are right it just says 24mg. It seems the more headway I make the more problems that arise. You will see the sku though. I am planning to make good use of the SKU fields and hope that it is acceptable until I can find another solution
VM 2.0.4 Stable


I know the feeling.

I`m really hoping they get it together so that we don `t have to do a bunch of core hacks just to achieve basic functionality.

You`ve come a lot further than I on this, but until I can figure out how to get the price to display in the drop down I`m still dead in the water


More progress.... The cart now shows everything correctly, categories, category and product pages all work the way you would expect from a normal cart...... At this point, I can't explain everything I've done... but it is possible. The only thing I have left to do now I think is modify the email templates because right now they list the products as what shows in the dropdown. in the end, i'm using the different available fields for different things... the backend is a bit weird for working with products. I have to use the small description as the title for the category page, the title as the attributes in the dropdown, and add a custom field as the title for the product details page. small description acts as the product name on the cart page. man what a clusterfuc*.

It is pretty easy to manage if you can remember to treat products with custom variants different that products without.   check out flue cured and try the cart ->


still no progress on prices in the dropdown. maybe a few string type custom fields telling the prices for various options?
VM 2.0.4 Stable



great work

you have been making all your changes in your templates override folder? (when you update VM are you going to have to do it all over again?)


This is for anyone willing to make the necessary changes to make your shop look and act like a normal shop with stockable variants....
This is all done in template overrides, so it should hold after a update. No core files were modified.
Maybe I'm wasting my time, but it's working for me, so I might as well write it up while I'm at it.

This is all based on naming your products as if they are the attribute.

Example: These are all product titles This will fix the odd looking Parent as the first option in the dropdown

Parent: Long Sleeved Shirt (unpublished, and not for sale)
Child: Red (Give your first child a category such as "Shirts", this will be the product you navigate to from the category page)
Child: Green
Child: Blue

First Problem: Now your page titles will be Red, Green, Blue...etc.

Will do write up on this with pictures

Second Problem: Now the product title on the Category page will be Red (the main product that was given the category "Shirts")

Change the product titles on the category page to the short description:
You will then have to enter the title of all Parent products into the short description field


You will be using the short description as the product name on the category page.... (If I can find a way to show custom fields from the product on the category page, I can avoid throwing away the short description)

If there is no short description, it will display the product title like normal (this will make sure theres no extra work for products with no children. just don't use the short description)

You will then lose the short description, so it would be wise to comment out the lines that displays it under the product image as well

Find the code <h2><?php  echo JHTML::link($product->link, $product->product_name); ?></h2> and replace with code below;

<?php /*  If Short Desc is set change Product Title to Short Description     */ ?>
<h2><?php // Product Short Description
if (!empty($product->product_s_desc)) {
   echo JHTML::link($product->link$product->product_s_desc);

else {
   echo JHTML::link($product->link$product->product_name);


Third Problem: Your Cart will display product name as Red, Green, Blue etc. (But you still want to show the option with the actual product name)

Making your shopping cart load correct titles

Will be using short description, the same way as above for product name:

templates/yourtemplate/html/com_virtuemart/cart/default_pricelist.php  -  Around line 139:
Replace <?php echo JHTML::link($prow->url, $prow->product_name).$prow->customfields; ?> with this:

<?php if(!empty($prow->product_s_desc)){ echo JHTML::link($prow->url$prow->product_s_desc). ' - ' .$prow->product_name; }  else { echo JHTML::link($prow->url$prow->product_name);}//.$prow->customfields; ?>
VM 2.0.4 Stable


Thanks corymp, perfect timing for saving my day! Looks like a decent solution, nothing too nasty in this and if it works:)

Quote from: corymp on March 20, 2012, 11:06:24 AM
First Problem: Now your page titles will be Red, Green, Blue...etc.

Will do write up on this with pictures

Great, looking forward! :)
I'm going to try the others now.


Problem: The first child item that has the category selected doesn't show in the drop down menu when viewing the item.


Solution: If you do the same to the parent item as you would to the "main child item" and disable that child item, it works. However like that the solution becomes too messy, relying only on "Product SKU" order for the backend management.


I still don't want to see the children when I do a search. I want to click on the parent and be able to select the variants. Am I missing something really basic?
Edit: I missed the categories instructions (assign category to only one of the children).
I still can't see a selection menu for the variants. :(

Plus, can anyone point me in the direction of the templates location? I can't find those files.


It's Virtuemart that's missing something really basic.

They are in your components dir. I have no idea how can they be in his templates directory?

/templates/yourtemplate/html/com_virtuemart/category/default.php -->


/templates/yourtemplate/html/com_virtuemart/cart/default_pricelist.php -->



besides these need to edit AT LEAST the email template, mini cart & product view files


Quote from: karbono on March 21, 2012, 11:09:51 AM
Edit: I missed the categories instructions (assign category to only one of the children).
I still can't see a selection menu for the variants. :(

You are missing the custom field Generic Child Variant.

Actually this is suppose to be done with the Stock Control custom field but it is obvious that it doesn't work. So using generic child variants is pretty much desperation at this point.


Yes, you would have to manage everything by SKU.

This is a very messy method of achieving something that should be native to the system. I'm almost ready to ditch this whole idea. It seems the more progress I make, the more templates I need to modify.... Stop me now, if there's no point to this...
VM 2.0.4 Stable


Quote from: chiappa on March 21, 2012, 11:21:26 AM
It's Virtuemart that's missing something really basic.

Thanks for the pointers. I'm going to try and get this to work with CSVI


Yes, this could become complicated. I wont follow you on this path unless there is a breakthrough but please keep us posted if you do choose to go on:)

I'm gonna stick to my crappy custom attributes solution, which is at least easy and a semi-working... ;) and continue refreshing this forum every day....