VirtueMart Forum

VirtueMart 2 + 3 => Product creation => Topic started by: Naturt on July 26, 2013, 09:59:55 am

Title: custom field for selection
Post by: Naturt on July 26, 2013, 09:59:55 am
Hi there! I upload product packages (ex.: 1 product package contains 4 types of other products). You can pick your package whatever you want.
Ex.: 2a + 2b, or 1a, 2b, 1c, or 1a, 1b, 1c, 1d and so on.
How can it solve with custom fields? The package price is constant, no mather what 4 product is containted.

Thanks in advance
Title: Re: custom field for selection
Post by: Maxim Pishnyak on July 26, 2013, 16:25:03 pm
What is the problem? You don't allow customers to buy more then four products at once?
Title: Re: custom field for selection
Post by: Naturt on July 26, 2013, 16:30:00 pm
No, sorry for my english.
So this package is uploaded as a product. I want to the ability to collect your own 4 product in your package, as your wish. The package price does not change, only the contents.
Title: Re: custom field for selection
Post by: Maxim Pishnyak on July 26, 2013, 16:41:16 pm
Four custom fields in one product (package).
Each custom field has the same variants: a,b,c,d.
Title: Re: custom field for selection
Post by: Naturt on July 26, 2013, 16:44:40 pm
But what type of custom field? I want a product name and a quantity field
Title: Re: custom field for selection
Post by: Maxim Pishnyak on July 26, 2013, 16:48:56 pm
field1: a
field2: a
field3: b
field4: b
I see that customer wants two a and two b. I.e. 2a+2b.

You need custom field that will be shown in cart ofc. There's only one with such ability.
Title: Re: custom field for selection
Post by: Naturt on July 26, 2013, 16:53:02 pm
It is near ok, but the product names are too long and complex, nobody will type down twice (2a)
Title: Re: custom field for selection
Post by: Maxim Pishnyak on July 26, 2013, 18:24:17 pm
It is near ok, but the product names are too long and complex, nobody will type down twice (2a)
Give me a link where you followed my advice and we'll see what is long and what is complex, ok?
Title: Re: custom field for selection
Post by: PRO on July 27, 2013, 03:07:31 am
so package price does NOT change with the  selections they choose?
I dont understand how you are having a problem with this?

IF the way the build the package effects the price.

Then sometimes you can do- this with custom fields,
and sometimes you would need something like this
http://breakdesigns.net/virtuemart-product-builder

so explain further


Title: Re: custom field for selection
Post by: Naturt on July 30, 2013, 14:21:07 pm
Thanks for the answers, the solution is "Four custom fields in one product (package). Each custom field has the same variants: a,b,c,d."  by Maxim Pishnyak. Sorry, it is take a long time to realize this. And if i made a template override, how i can e-mail the custom fields values to the customer?
In the override i have this:

foreach ($product->customfieldsCart as $field)
              {
echo "<span style='margin-left:0px;'>".JText::_($field->custom_title).":</span>";
echo "<span style='margin-left:2px;'>".$field->display."</span>";
echo "<span style='margin-left:5px;'>".$field->custom_field_desc."</span>";
}

How can I reach the selected value(s) from the $field variable?
Title: Re: custom field for selection
Post by: PRO on July 30, 2013, 18:17:27 pm
Thanks for the answers, the solution is "Four custom fields in one product (package). Each custom field has the same variants: a,b,c,d."  by Maxim Pishnyak. Sorry, it is take a long time to realize this. And if i made a template override, how i can e-mail the custom fields values to the customer?
In the override i have this:

foreach ($product->customfieldsCart as $field)
              {
echo "<span style='margin-left:0px;'>".JText::_($field->custom_title).":</span>";
echo "<span style='margin-left:2px;'>".$field->display."</span>";
echo "<span style='margin-left:5px;'>".$field->custom_field_desc."</span>";
}

How can I reach the selected value(s) from the $field variable?


you are not doing this the way you should.

http://forum.virtuemart.net/index.php?topic=90833.msg298101#msg298101

have you tried the regular virtuemart custom fields?

Title: Re: custom field for selection
Post by: Naturt on July 31, 2013, 09:02:49 am
Yes, i tried it, but i have a custom override with some unique code and a mail.php which is responsible for the mail to the admin and user. This e-mail is contains $product-> and $userContact-> variables, but i can't display the choosen custom field value.
Title: Re: custom field for selection
Post by: Naturt on July 31, 2013, 09:12:49 am
I tried send the selected custom field value in the mail.php this way:

foreach ($product->customfieldsCart as $field)
{
echo $field->custom_value;
}

But this is send me all values...
Title: Re: custom field for selection
Post by: Maxim Pishnyak on July 31, 2013, 11:02:14 am
Thanks for the answers, the solution is "Four custom fields in one product (package). Each custom field has the same variants: a,b,c,d.". Sorry, it is take a long time to realize this.
you are not doing this the way you should.
http://forum.virtuemart.net/index.php?topic=90833.msg298101#msg298101
have you tried the regular virtuemart custom fields?
It is near ok, but the product names are too long and complex, nobody will type down twice (2a)
Give me a link where you followed my advice and we'll see what is long and what is complex, ok?
It's hard to judge without working link or without even screen shot where did you stopped in fair simply process of using custom fields.
And if i made a template override, how i can e-mail the custom fields values to the customer?
At this point I'm even not sure that you already HAVE prepared for using custom fields. No link, remember?

As for template overrides...

Well, you could switch to standard Joomla template (beez5) and check how VM without any template overrides deal with your custom fields.

NOT EVERYBODY COULD FIGHT BLIND.