*

Tango

  • ****
  • 214 posts
View Seller Items
« on: December 17, 2021, 05:02:48 PM »
@Frosticek
In some of your themes, like Veronika you're using a function from the List Seller Items plugin, that gives us the ability to view the seller items inside the Search section, like in the below screenshot.


This is pretty awesome, as in theory, you can view and sort the user items based on categories, price etc.
Now the problem appears when you use that plugin on other themes (and even Veronika) and you try to actually sort those items.
For example, when I click on view Only items with picture, the search returns ALL items with pictures and not the ones from the actual seller.

It happens because of the following:
  • First time you view the user items, the query is: mysite/search/seller_post,5
  • When you try to view the user items with pictures for example, the query turns into: mysite/search/sOrder,dt_pub_date/sShowAs,gallery/iOrderType,desc/bPic,1
    This will return all items with pictures, and not just the ones from the seller.
To make it work properly, the script should return: mysite/search/sOrder,dt_pub_date/sShowAs,gallery/iOrderType,desc/bPic,1/seller_post,5
- In case of Veronika: veronika.mb-themes.com/search/sOrder,dt_pub_date/iOrderType,desc/bPic,1/seller_post,5

The question is, how do I do that?
How do I keep the user id in the search query?

In the plugin, the code that handles this is:
Code: [Select]
    function display_search($params = null){
        if ($params == null) {
            return false ;
        }

foreach ($params as $key => $value) {
            if ($value != '') {
                // We may want to have param-specific searches
                switch ($key) {
                    case 'seller_post':
                        Search::newInstance()->addConditions(sprintf("%st_item.fk_i_user_id = %d ", DB_TABLE_PREFIX, $value)) ;
    break ;
                }
     }
         }
     }

Any ideas?
Thanks!
« Last Edit: October 16, 2022, 12:50:07 PM by Tango »

*

Tango

  • ****
  • 214 posts
Re: View Seller Items
« Reply #1 on: December 17, 2021, 05:34:40 PM »
Edit: I'm now seeing in the Veronika Demo, that this plugin is also part of the Veronika bundled plugins, so we can now consider this to be a bug.

Thanks!

Marked as best answer by Tango on December 21, 2021, 10:09:47 PM
*

MB Themes

Re: View Seller Items
« Reply #2 on: December 21, 2021, 08:03:05 AM »
@Tango
It would require modifications in theme, in search form, there should be:
Code: [Select]
<input type="hidden" name="seller_post" value="<?php echo osc_esc_html(Params::getParam('seller_post')); ?>"/>
Plugin may not be useful anymore as osclass itself allows to filter based on user ID (not sure in input name is user or userId)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Tango

  • ****
  • 214 posts
Re: View Seller Items
« Reply #3 on: December 21, 2021, 10:11:21 PM »
Code: [Select]
<input type="hidden" name="seller_post" value="<?php echo osc_esc_html(Params::getParam('seller_post')); ?>"/>
Thanks a lot! That did the trick. :P

PS: Veronika should be updated also.