I was wondering how to get a state/province select in the plugin.
In the standard shipping the country select is created by:
<param name="countries" type="vmcountries" scope="com_virtuemart" default="" label="VMSHIPMENT_WEIGHT_COUNTRIES_COUNTRIES" description="VMSHIPMENT_WEIGHT_COUNTRIES_COUNTRIES_DESC"/>
but I cannot find how to get a state select. I searched the source and database and could not even find an instance of "vmcountries" (except for in other xml files).
-- Dave
You need to extend the JElement class with a custom plugin (I did this for a categories select in a shipping plugin)
Use models/state.php as an example and install it in the plugins/vmshipment
Might be simpler to use -> http://www.gjcwebdesign.com/virtuemart-2-joomla-25-postcode-zip-code-shipping-plugin-released.html (http://www.gjcwebdesign.com/virtuemart-2-joomla-25-postcode-zip-code-shipping-plugin-released.html)
This can match state/province names and you only need one method...
Hmmmm.
I had figured there was a built in method considering that the shipping/billing information had state lists. It is sad to know that is not the case.
There is a method but it's not available in the JElement class - that's why you need to basically copy it and extend to JElement.
It can then be accessed by the shipping methods..
Oh, I see.
That makes a lot more sense now.
Am I able to make a stand alone plugin to create this functionality, or do I have to wrap it into my main plugin? I figure this is a pretty useful extension that could be used in lots of different plugins. I am not familiar with how to add a VirtueMart element the correct way.
I noticed this comment in the head of the 'JElementVmCountries' file that I believe controls the vmcountries type element.
* Those plugins cannot be configured througth the Plugin Manager anyway.
I assume this element was installed by a plugin through the Virtuemart all in one component. Correct? How are these controlled if not through the plugin manager?
Regards,
Dave
I used this post to get a simple parameter extension for states: http://forum.virtuemart.net/index.php?topic=94998.0
I gave up trying to add a stand along vmstates plugin. (Didn't really try that hard though). Didn't seem worth the hassle once I figured out that if in the parameters section of the install xml file I add something like
<params addpath="/administrator/components/com_virtuemart/elements" />
<params addpath="/plugins/(my plugin type)/(my plugin name)/elements" />
<params>
... my params ...
</params
it will include all my custom parameters for my plugin. I just tossed the vmstates.php file in a folder named elements in my plugin and we were good to go!