News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

user_class, user_pages from VM1 to VM2

Started by shemzone, August 27, 2011, 23:34:33 PM

Previous topic - Next topic

shemzone

Hi everybody
I have made some development using user_class and user_pages to override and extend the VM 1 core files from VM themes.
I don't see these possibilities in VM2. Where can I find information about this? I understood that the VM themes are gone and are replaced as an override in joomla template>html>com_virtuemart but how to use my user_pages and user_class from there? Is it just a copy and paste of these folders in html>com_virtuemart? (eg template>html>com_virtuemart>user_class / user_pages or something like that?)

Thanks a lot for your answers
Fred aka Shemzone
French Accessibility Expert (Accessiweb)
Member of the Accessiweb Work Group (French work group)
Developer of Bookshop 2 for Virtuemart (Bookshop 3 for Virtuemart 2 is on track)
I will be present at the French Joomladay in Strasbourg on the 25th of march 2012 during which I will present how to work with accessibility

alatak

#1
Hi,

VM2 has been rewritten, and does not have anymore the VM1 classes and user_class.

To modify or add new functionalities, you can develop plugins. (http://dev.virtuemart.net/projects/virtuemart/wiki/Plugin_system#Extension-Plugins)

QuoteIs it just a copy and paste of these folders in html>com_virtuemart? (eg template>html>com_virtuemart>user_class / user_pages or something like that?)
it is not just a copy and paste.
But may be you can adapt your code with the template overwrite.

shemzone

Thank you for your answer Valérie. I'll check this. I think that to rewrite my addon for VM will be an hard work. Anyway I must do it...
Currently, the developer manual for VM2 is very thin...
Regards
Shemzone
French Accessibility Expert (Accessiweb)
Member of the Accessiweb Work Group (French work group)
Developer of Bookshop 2 for Virtuemart (Bookshop 3 for Virtuemart 2 is on track)
I will be present at the French Joomladay in Strasbourg on the 25th of march 2012 during which I will present how to work with accessibility

alatak

Hi,

Tell me what you wrote for the classes. I might be able to tell you how to solve the problem another way.

shemzone

Hi again
I'm going to try to update my addon to VM2, once I'm in front of the wall, I'll ask. :)
Fred
French Accessibility Expert (Accessiweb)
Member of the Accessiweb Work Group (French work group)
Developer of Bookshop 2 for Virtuemart (Bookshop 3 for Virtuemart 2 is on track)
I will be present at the French Joomladay in Strasbourg on the 25th of march 2012 during which I will present how to work with accessibility

alatak

Hi shemzone2,

Great,
May be you don't event need to do something? :)


shemzone

Apart the template stuff (convert VM theme to J! template), I need to know how to extend the classes, the former shop_browse_queries.php (if it's gone), how to call my former $VM_LANG->load('myownaddon'); how to extend the former ps_product.php, and so on.
That why I used heavily the user_class and user_pages features.

I guess I have to extend my own classes by moving them to the controllers folder and to call them with
class VirtuemartControllerMyOwnAddon extends VmController {
...
}


Here, for example, what can I do to extend the save product function (I added extra fields which are filled while saving the product.

Must I use a new function to save my own fields in db like 
function save(){
/* Load the data */
$data = JRequest::get('post');
/* add myownaddon_stuff as html code */
$data['myownaddon_stuff'] = JRequest::getVar('myownaddon_stuff', '', 'post', 'string', JREQUEST_ALLOWHTML );
parent::save($data);
}


or is there a way to extend the controllers/product.php without lose it at each new upgrade of VM?

I didn't dive yet in the VM code and maybe I'll find the solution someday.
Anyway, your help and advice are very welcome.

Fred
French Accessibility Expert (Accessiweb)
Member of the Accessiweb Work Group (French work group)
Developer of Bookshop 2 for Virtuemart (Bookshop 3 for Virtuemart 2 is on track)
I will be present at the French Joomladay in Strasbourg on the 25th of march 2012 during which I will present how to work with accessibility

alatak

Hi

May be the Custom fields can help you to add some extra fields. Did you check that?

shemzone

Hi
About the extra fields: no, not yet.
I'll check this.
The goal is to get what I've done with VM1 for www.bookshop-virtuemart.net with VM2

Fred
French Accessibility Expert (Accessiweb)
Member of the Accessiweb Work Group (French work group)
Developer of Bookshop 2 for Virtuemart (Bookshop 3 for Virtuemart 2 is on track)
I will be present at the French Joomladay in Strasbourg on the 25th of march 2012 during which I will present how to work with accessibility

PRO

shemzone, what did you add. Cannot tell from your site.

shemzone

Hi
I added a lot...
See some examples here:
http://www.bookshop-virtuemart.net/Terre-de-Brume/Collection-Granit-noir/ISBN-2-84362-043-0-Belfast-blues.html
http://www.bookshop-virtuemart.net/Terre-de-Brume/Beaux-livres/ISBN-2-84362-171-2-Chiens-de-Vie.html
http://www.bookshop-virtuemart.net/Les-auteurs/Yvon-Le-Men.html
http://www.bookshop-virtuemart.net/Lister-tous-les-auteurs.html
or here http://zalozba-meander.si/avtorji/lee-child.html

There are new tables in db
Full writers management (not simply authors) -> New table
Full extended information for a product (a book actually) -> New table

New dedicated stringq loaded with $VM_LANG->load('bookshop'); in french, english, slovenian, italian

The custom fields are not enough for me.

You an have a look to the changelog here:
http://www.bookshop-virtuemart.net/Bookshop-virtuemart/bookshop-for-virtuemart-changelog.html
and a couple of tutorials here:
http://www.bookshop-virtuemart.net/Tutorials/
and complete manual here:
http://www.bookshop-virtuemart.net/Telecharger-document/15-Bookshop-for-Virtuemart-Quick-start-guide-English.html

Actually, this is not a hack (or just a couple of VM files since the last version of Bookshop) and I used user_class and user_pages because this can be switched off if you don't want use bookshop anymore.
It has/had its own install package via the update tool of VM 1.

Fred
French Accessibility Expert (Accessiweb)
Member of the Accessiweb Work Group (French work group)
Developer of Bookshop 2 for Virtuemart (Bookshop 3 for Virtuemart 2 is on track)
I will be present at the French Joomladay in Strasbourg on the 25th of march 2012 during which I will present how to work with accessibility

Milbo

Interesting. there are good and bad news for you :-)

First thing, yes extend your objects with the VmController, VmModel and so on.

Second, when you change the database tables, adjust the corresponding file table for it.

Third, you can easily add extra views to vm with a joomla component or plugin.

Fourth, afaik parts of your work can be done with customfields and a product pattern (unpublished parent product), for exampel ISBN, EAN.

For the authors I would add an extra view and an extra menu item beyond manufacturers and use a template overwrite. Just some ideas to handle it
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

alatak

Hi shemzone2

I knew your web site from before. Good job you have done with VM1.
I have done a similar web site, but it was for music.

QuoteFull extended information for a product (a book actually) -> New table
As said Max, you can handle the fields like ISBN, book type (policier, ...) with custom field.

QuoteFull writers management (not simply authors) -> New table
I didn't see what was the difference between writers and authors. But I think ,  I will create a category for each author. In the custom field, you can now select a related category.  May be this solve the cross reference between the authors and the book.

QuoteNew dedicated stringq loaded with $VM_LANG->load('bookshop'); in french, english, slovenian, italian
In Joomla 1.7 you can do that easily, with the language overwriting.

shemzone

Thank you Alatak and Max/Milbo for your advices and ideas.
I'll investigate all of this. The ideal world would be to expect all I have done in VM1 into VM2.
To be more accurate, I think that authors, VM speaking, are like an author in Joomla, meaning that is just a name linked to an account in Joomla. "My" writer/author is more of that. This is an author with a biography, a picture, some extra information and so on that you can link to a product. I guess, the authir in VM is not enough for me. However, the idea  of custom field could do the trick, but no sure.

I will keep you informed if you are interested.

Fred aka Shemzone
French Accessibility Expert (Accessiweb)
Member of the Accessiweb Work Group (French work group)
Developer of Bookshop 2 for Virtuemart (Bookshop 3 for Virtuemart 2 is on track)
I will be present at the French Joomladay in Strasbourg on the 25th of march 2012 during which I will present how to work with accessibility

alatak

Hi Fred,

QuoteThis is an author with a biography, a picture, some extra information and so on that you can link to a product.
If the author is a category, you can have the biography, the picture, and the link ti the product.

QuoteI will keep you informed if you are interested.
Yes we are :)