Author Topic: user_class, user_pages from VM1 to VM2  (Read 6100 times)

shemzone

  • Jr. Member
  • **
  • Posts: 59
  • Bookshop 3 for Virtuemart 2 is on track
    • Bookshop for Virtuemart
user_class, user_pages from VM1 to VM2
« on: August 27, 2011, 23:34:33 pm »
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

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2044
    • alatak.net
Re: user_class, user_pages from VM1 to VM2
« Reply #1 on: August 28, 2011, 22:08:30 pm »
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)

Quote
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?)
it is not just a copy and paste.
But may be you can adapt your code with the template overwrite.

shemzone

  • Jr. Member
  • **
  • Posts: 59
  • Bookshop 3 for Virtuemart 2 is on track
    • Bookshop for Virtuemart
Re: user_class, user_pages from VM1 to VM2
« Reply #2 on: August 31, 2011, 21:10:13 pm »
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

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2044
    • alatak.net
Re: user_class, user_pages from VM1 to VM2
« Reply #3 on: August 31, 2011, 22:31:48 pm »
Hi,

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

shemzone

  • Jr. Member
  • **
  • Posts: 59
  • Bookshop 3 for Virtuemart 2 is on track
    • Bookshop for Virtuemart
Re: user_class, user_pages from VM1 to VM2
« Reply #4 on: September 01, 2011, 23:05:48 pm »
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

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2044
    • alatak.net
Re: user_class, user_pages from VM1 to VM2
« Reply #5 on: September 02, 2011, 08:25:30 am »
Hi shemzone2,

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


shemzone

  • Jr. Member
  • **
  • Posts: 59
  • Bookshop 3 for Virtuemart 2 is on track
    • Bookshop for Virtuemart
Re: user_class, user_pages from VM1 to VM2
« Reply #6 on: September 02, 2011, 14:19:08 pm »
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
Code: [Select]
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 
Code: [Select]
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

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2044
    • alatak.net
Re: user_class, user_pages from VM1 to VM2
« Reply #7 on: September 02, 2011, 15:56:05 pm »
Hi

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

shemzone

  • Jr. Member
  • **
  • Posts: 59
  • Bookshop 3 for Virtuemart 2 is on track
    • Bookshop for Virtuemart
Re: user_class, user_pages from VM1 to VM2
« Reply #8 on: September 02, 2011, 16:29:22 pm »
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10280
  • VirtueMart Version: 3+
Re: user_class, user_pages from VM1 to VM2
« Reply #9 on: September 02, 2011, 17:57:51 pm »
shemzone, what did you add. Cannot tell from your site.
I do NOT do development work for hire.

shemzone

  • Jr. Member
  • **
  • Posts: 59
  • Bookshop 3 for Virtuemart 2 is on track
    • Bookshop for Virtuemart
Re: user_class, user_pages from VM1 to VM2
« Reply #10 on: September 02, 2011, 18:20:26 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9649
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: user_class, user_pages from VM1 to VM2
« Reply #11 on: September 05, 2011, 19:29:28 pm »
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
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

alatak

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2044
    • alatak.net
Re: user_class, user_pages from VM1 to VM2
« Reply #12 on: September 06, 2011, 09:59:37 am »
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.

Quote
Full 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.

Quote
Full 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.

Quote
New 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

  • Jr. Member
  • **
  • Posts: 59
  • Bookshop 3 for Virtuemart 2 is on track
    • Bookshop for Virtuemart
Re: user_class, user_pages from VM1 to VM2
« Reply #13 on: September 06, 2011, 22:59:49 pm »
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

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2044
    • alatak.net
Re: user_class, user_pages from VM1 to VM2
« Reply #14 on: September 07, 2011, 08:24:35 am »
Hi Fred,

Quote
This 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.

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