Advertisement:

Author Topic: Select category and region before item add form  (Read 4915 times)

keny

  • Full Member
  • ***
  • Posts: 137
Select category and region before item add form
« on: July 07, 2011, 12:10:40 am »
This thread refer to this one : http://forums.osclass.org/index.php/topic,2157.0.html

Idea: let user select the category in a full page before they got access to the form post. (same for region)

Juan and _conejo i would like to know if you think that is more easy to make that in a pluggin or by changing core ?

My idea for a pluggin version was :

change in all theme the link for adding a item from /index.php?page=item&action=item_add to /index.php?page=custom&action=select_category (i know thus function is only in osclass v2.2)

Then we can to the same thing for region

and then we past all information to the original item page with this link /index.php?page=item&action=item_add_post&catId=12&regionId=737520&cityId=31856

Problem is that got a error message telling me that region is not selected if i can bypass thi message then i beleive that i can make a pluggin.

Is it the right way to make that ?

I have no problem coding pluggin as long as i know how to make them.

keny

  • Full Member
  • ***
  • Posts: 137
Re: Select category and region before item add form
« Reply #1 on: July 07, 2011, 05:38:46 am »
Ok i found a way to remove the error message by using this code

Code: [Select]
function select_category_post() {
$message = Session::newInstance()->_getMessage('pubMessages') ;
if(trim($message['msg'])=='Location not selected.'){
Session::newInstance()->_dropMessage('pubMessages') ;
}
    }
    // When posting item
    osc_add_hook('post_item', 'select_category_post');

So i beleive that is possible to make it as a pluggin just tell me if i am on the right way.

Thanks

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Select category and region before item add form
« Reply #2 on: July 07, 2011, 11:55:09 am »
Hi keny,

Nor plugin, nor core modification, it's even easier (as far as I understood the issue) : "new theme".

With some JS it should be easy to load several "panels". This is the first example I found on google (I saw better time ago) : http://demo.webdeveloperplus.com/featured-content-slider/

So basically, you have several <div>'s with the different "pages", with little JS, you change from one div to another (hide, show, fadeIn, fadeOut, or whatever you want). All information is send to a "hidden" form. The user didn't change the page at all, so no need to use hooks or modify core function.


I don't have time to test it, but it should be easy to do. Tell me what you think (I think it's a bad idea to create a plugin about this)



Thanks

keny

  • Full Member
  • ***
  • Posts: 137
Re: Select category and region before item add form
« Reply #3 on: July 08, 2011, 01:02:47 am »
Thanks that easier !