VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: Gruz on October 05, 2011, 22:57:31 PM

Title: Correct way to extend VM2? Extension Plugins or jos_virtuemart_modules or ...?
Post by: Gruz on October 05, 2011, 22:57:31 PM
Hi.
I want to port my VM Import  extension from 1.1.x to 2.0.
Now I use J1.7+VM2 G

It was ran "from inside" VM to use it's functions to add products, types and so on. It was preparing data as if they were filled by hands and submitted from VM backend and passed them to VM core functions.
Here it is at a Russian forum: http://joomlaforum.ru/index.php/topic,150010.msg813807.html#msg813807 (http://translate.google.com.ua/translate?sl=ru&tl=en&js=n&prev=_t&hl=uk&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fjoomlaforum.ru%2Findex.php%2Ftopic%2C150010.msg813807.html%23msg813807)


How it worked in 1.1.x
1. Installation
I used a Joomla 1.5 component installer possibilities to copy 3 files into the VM folder:
administrator/components/com_virtuemart/html/admin.simple_csv_install.php
administrator/components/com_virtuemart/html/product.simple_csv.php (now it's can be called a view)
administrator/components/com_virtuemart/classes/ps_simple_csv.php (now it's can be called a model)

Then I ran a link (http://sandbox.com.us/administrator/index.php?option=com_virtuemart&page=admin.simple_csv_install) to execute the file:
(http://view.xscreenshot.com/file_f0f8784eb64448307369b7224b489cc4) (http://view.xscreenshot.com/f0f8784eb64448307369b7224b489cc4)
The file used the following class to add my function to jos_vm_function table
require_once(CLASSPATH.'ps_function.php');
$ps_function = new ps_function;
//and so on...

(http://view.xscreenshot.com/file_b73e39e2928793c57a3d200233e0a2af) (http://view.xscreenshot.com/b73e39e2928793c57a3d200233e0a2af)


2. Workflow
Then I could ran a link http://sandbox.com.us/administrator/index.php?option=com_virtuemart&page=product.simple_csv to have my "view" file displayed:
(http://view.xscreenshot.com/file_3d85aac310bbe51b168f27d3116c9b30) (http://view.xscreenshot.com/3d85aac310bbe51b168f27d3116c9b30)
After submitting the form at the above screenshot my class administrator/components/com_virtuemart/classes/ps_simple_csv.php was used to do the job.




So now I need to rewrite it for VM2.0 and I'm stack with new VM approaches.
So I need a direction to dig. What is the analogue of function in 1.1.x now in VM 2.0?
It seems to be jos_virtuemart_modules , correct? Is there any procedure to install custom modules then?
Or maybe I'm wrong:
I read at developer wiki about Extension Plugins:
http://dev.virtuemart.net/projects/virtuemart/wiki/Extension_Plugins (http://dev.virtuemart.net/projects/virtuemart/wiki/Extension_Plugins)
QuoteThis event is fired, when the called view was not found in the backend maincontroller. It allows to add new views to virtuemart

Can I read somewhere about it? Give me some guides, please!
Maybe a module/plugin to use as an example?

P.S. API documentation link here is broken: http://dev.virtuemart.net/projects/virtuemart/wiki/API_documentation (http://dev.virtuemart.net/projects/virtuemart/wiki/API_documentation)
http://vm1.directrouter.com/~virtuem/api/ (http://vm1.directrouter.com/~virtuem/api/)
Title: Re: Correct way to extend VM2? Extension Plugins or jos_virtuemart_modules or ...?
Post by: Milbo on October 06, 2011, 21:48:01 PM
There is no table functions anymore. In your case I think you should use the http://dev.virtuemart.net/projects/virtuemart/wiki/Extension_Plugins