VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: jimleeder123 on February 06, 2015, 17:24:02 PM

Title: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 06, 2015, 17:24:02 PM
Is it possible to add attributes to products in Virtuemart 3? You could do it in Virtuemart 1 easily but in 3 I cannot find the option. I've seen in VM2 you could create a custom field but the custom field type used in the examples isn't given in VM3.

An example of an attribute would be "extra toppings" on a pizza product, and values would be like "cheese", "peppers" or "pepperoni".

So how can I do this on VM3?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jenkinhill on February 06, 2015, 17:26:18 PM
Custom fields. Install VM3 with default products on a test site & see how it is done. Or look at http://demo.virtuemart.net/
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 06, 2015, 17:38:02 PM
I've seen a post that says about custom fields and I got it to work. But is there a way to add a lot of attributes at once? I will be needing to add 30 attributes per product. Using VM1 I used to copy and paste them in the database. However it looks like in the VM3 database it can't be done that way. Is there a quicker way?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jenkinhill on February 06, 2015, 19:04:18 PM
You can use Groups for custom fields and apply each group to a product with just a couple of clicks.

Or clone a product which makes a duplicate of that product together with its custom fields and field settings.
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: AH on February 06, 2015, 20:42:59 PM
This was designed to be similar to Vm1

http://forum.virtuemart.net/index.php?topic=127362.0 (http://forum.virtuemart.net/index.php?topic=127362.0)
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 09, 2015, 11:18:36 AM
Hi Hutson, thanks again for your great advice on this forum. The plugin works but the only thing is that in the drop down box the letter "A" appears with a weird sign above it, where the "@" sign is in the code. How can this be removed?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: AH on February 09, 2015, 11:43:25 AM
jimleeder123

Post more details - e.g. you exact parameter setting and do this on the plugin page pleae
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 09, 2015, 15:05:51 PM
Its done whenever I type the "@" symbol. I only need to be adding costs with the attributes. I have attached a picture showing what I'm talking about.
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: AH on February 09, 2015, 15:34:54 PM
post the product customfield parameters
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 09, 2015, 15:42:42 PM
I've got this in "drop options" - Cheese@+2,Peppers@+2,Pepperoni@+2
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 09, 2015, 15:57:57 PM
Also is it possible that when the user leaves the drop down boxes as they are in the default option (for example "none" or "nothing") the options aren't shown on the order confirmation e-mail sent to the admin?

A client requested this, so is it possible?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jenkinhill on February 09, 2015, 16:38:31 PM
Quote from: jimleeder123 on February 09, 2015, 11:18:36 AM
the letter "A" appears with a weird sign above it, where the "@" sign is in the code.

Are you using UTF-8 encoding in your template? - eg <meta charset="utf-8"> for HTML5
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 09, 2015, 16:56:24 PM
Well its XHTML, and I think its UTF-8. Its Joomla 2.5.
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jenkinhill on February 09, 2015, 17:18:48 PM
Well you are a web developer so you should be able to work out the encoding? Strange characters are often related to carachter encoding.
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 09, 2015, 17:37:51 PM
I only started in 2014, and haven't encountered any encoding issue before.
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: GJC Web Design on February 09, 2015, 23:49:19 PM
simple solution - forget the @ -- cheese is + 2 quid - what is the "at" for?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: AH on February 10, 2015, 09:55:16 AM
GJC the @ enables the drop variants to be "exploded"

IN the dropbox plugin

http://forum.virtuemart.net/index.php?topic=127362.0 (http://forum.virtuemart.net/index.php?topic=127362.0)

You can use any other character for this

But you need to change the code to something that works for you 


Here

plugins/vmcustom/drop/drop.php

$valueWithPrice = explode('@', $valuesWithPrice);


AND here

plugins/vmcustom/drop/tmpl/default.php

Quote$valueWithPrice = explode('@', $valuesWithPrice);

Note that the XML file explanation will also be incorrect if you use a different character so you could change that too.
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 10, 2015, 10:43:51 AM
Ok thanks a lot, could you give me the file path to the xml file please?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 10, 2015, 10:55:50 AM
The whole of the "drop" folder has its permissions on the server stuck to not being able to write so I can't edit any of the files. The server is using Plesk 10.3.1. Any idea how to fix?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: AH on February 10, 2015, 11:26:26 AM
Change in the zip file and re-install!

The xml ile is in the zip - just look in there
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 13, 2015, 12:00:04 PM
I'm doing this now (since I decided to do all other design parts done first) so what should I edit in the XML file if I change to symbol to "/"?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: GJC Web Design on February 13, 2015, 12:39:37 PM
QuoteGJC the @ enables the drop variants to be "exploded"

exploding cheese?   Not touching this plug then...
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 13, 2015, 12:41:31 PM
Wheres the cheese come from?

On a more serious note, Hutson where do I need to edit the XML file?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: GJC Web Design on February 13, 2015, 13:10:18 PM
http://forum.virtuemart.net/index.php?topic=128108.msg440167#msg440167
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 13, 2015, 15:07:12 PM
I tried editing the drop.php file and default.php files so instead of "@" its now "/", zipped it up and reinstalled it. I did nothing to the XML file. However it's still appearing. I think its going to show the "exploder" sign no matter what.

Hutson - do you know how to fix this or is there a character that won't show like this?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 13, 2015, 17:31:22 PM
I have also seen that editing those 2 files stops it working if I change "@" to "/". Does the XML file definitely need editing and if so where please?
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: AH on February 13, 2015, 17:57:35 PM
Hold on - I see from your original post that the variables were separated correctly and the the "funny" characters were next to you currency symbol

Go check in Vm admin and look what is set in your GBP currency symbol!

I think the problem comes from there - NOT this plugin!!

Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 13, 2015, 18:15:22 PM
The currency symbol is set to "£" as expected, doesn't look like anything is wrong there.
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 13, 2015, 18:22:31 PM
I've tried changing the "£" to "$" and it fixes it. However I need to be a pound sign since this is an English website.
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: AH on February 13, 2015, 18:31:52 PM
Ok I think this is breaking it

plugins/vmcustom/drop/tmpl/default.php



}
// $selects[] = array('value' =>$valueWithPrice[0], 'text' => $text );
$selects[] = array('value' =>$valueWithPrice[0], 'text' => htmlentities($text) );
}


change to

$selects[] = array('value' =>$valueWithPrice[0], 'text' => $text );
// $selects[] = array('value' =>$valueWithPrice[0], 'text' => htmlentities($text) );

Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: jimleeder123 on February 16, 2015, 10:52:48 AM
Thanks a lot - it worked, got there in the end! Got a lot of products to do this for now!
Title: Re: Is it possible to add attributes to products in Virtuemart 3
Post by: AH on February 16, 2015, 11:25:53 AM
 8)  If forgot about having added the htmlentities to the template - Glad it is working for you