*

Gile

  • ***
  • 42 posts
Redirect after post item
« on: February 08, 2024, 02:12:33 PM »
Hi,
If anyone else is using this theme, is there an explanation why after publishing the ad it turns out a white blank page, instead of redirecting to the item page.?
Is there any custome function to overwrite the default redirection after publishing the iten or what ever...?
Redirection after publishing an ad does not work ?


Thyanks for advice

*

MB Themes

Re: Redirect after post item
« Reply #1 on: February 08, 2024, 03:02:01 PM »
Enable error log and check for details about error you get on background.
https://docs.osclasspoint.com/debug-php-errors
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Gile

  • ***
  • 42 posts
Re: Redirect after post item
« Reply #2 on: February 09, 2024, 02:54:11 PM »
Enable error log and check for details about error you get on background.
https://docs.osclasspoint.com/debug-php-errors


Hi,
I got an error log, but I doubt this has something to do with the redirection after posting the item:

[09-Feb-2024 14:05:57] PHP Deprecated:  Automatic conversion of false to array is deprecated in /www/public_html/oc-content/themes/patricia/search.php on line 407
[09-Feb-2024 14:06:34] PHP Warning:  Undefined array key "s_name" in /www/public_html/oc-content/themes/patricia/functions.php on line 152
[09-Feb-2024 14:07:04] PHP Deprecated:  Automatic conversion of false to array is deprecated in /www/public_html/oc-content/themes/patricia/search.php on line 407
[09-Feb-2024 14:24:42] PHP Warning:  Undefined array key 103 in /www/public_html/oc-content/themes/patricia/main.php on line 116
[09-Feb-2024 14:29:16] PHP Deprecated:  Automatic conversion of false to array is deprecated in /www/public_html/oc-content/themes/patricia/search.php on line 407
[09-Feb-2024 14:29:17] PHP Deprecated:  Automatic conversion of false to array is deprecated in /www/public_html/oc-content/themes/patricia/search.php on line 407

Code: [Select]
search.php line 407 >   $parent_cat['pk_i_id'] = isset($parent_cat['pk_i_id']) ? $parent_cat['pk_i_id'] : '';
main.php line 116  >     if($category_icons[osc_category_id()] <> '') {
functions.php line 152 >  return $city . ' ' . __('in', 'patricia') . ' ' . $region . ($country_full['s_name'] <> '' ? ' (' . $country_full['s_name'] . ')' : '');

I using: Osclass version: 8.2.1 and latest Theme version
  • PHP verzija: 8.3.1
  • MySQL 10.6.16-MariaDB

Thanks for advice

*

MB Themes

Re: Redirect after post item
« Reply #3 on: February 09, 2024, 03:23:41 PM »
Thanks for feedback, updated Patricia theme and fixed issues.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Gile

  • ***
  • 42 posts
Re: Redirect after post item
« Reply #4 on: February 12, 2024, 07:51:57 PM »
Hi,
The update did not bring anything new and the error is still present :
Code: [Select]
[12-Feb-2024 13:59:45] PHP Deprecated:  Automatic conversion of false to array is deprecated in /oc-content/themes/patricia/search.php on line 407
[12-Feb-2024 14:11:21] PHP Warning:  Undefined array key "pk_i_id" in /oc-content/themes/patricia/search.php on line 331


But, I doubt that this has something to do with the redirection after the post new item, the PHP Warning can be ignored, but there is something else that worries me more error below, some of them point to core:

Code: [Select]
[12-Feb-2024 14:18:04] PHP Deprecated:  Creation of dynamic property ImageProcessing::$img is deprecated in /oc-includes/osclass/classes/ImageProcessing.php on line 223
[12-Feb-2024 14:18:09] PHP Deprecated:  Implicit conversion from float 266.6666666666667 to int loses precision in /oc-includes/osclass/classes/ImageProcessing.php on line 303
[12-Feb-2024 14:43:52] PHP Warning:  Trying to access array offset on false in /oc-content/themes/patricia/item.php on lines 194,196 197, 199, 220 and 227
[12-Feb-2024 17:56:00] PHP Notice:  <strong>Message body empty</strong><br />
 in /oc-includes/osclass/utils.php on line 573


Also, I tried several ways to overwrite with the custom function, but that didn't work either :



Code: [Select]
if (!function_exists('patricia_redirect_to_item')) {
    function patricia_redirect_to_item($item) {
        if ($item) {
            View::newInstance()->_exportVariableToView("item", Item::newInstance()->findByPrimaryKey($item['pk_i_id']));
            osc_redirect_to(osc_item_url());
        }
    }
    osc_add_hook('posted_item', 'patricia_redirect_to_item');
}


..and


Code: [Select]
if (!function_exists('patricia_redirect_to_item')) {
    function patricia_redirect_to_item($item) {
        if ($item) {
            // Assuming $item['pk_i_id'] is the correct primary key
            $item_id = $item['pk_i_id'];
            $item_obj = Item::newInstance()->findByPrimaryKey($item_id);
           
            if ($item_obj) {
                View::newInstance()->_exportVariableToView("item", $item_obj);
                osc_redirect_to(osc_item_url());
            }
        }
    }
    osc_add_hook('posted_item', 'patricia_redirect_to_item');
}


But, nothing work  :-\


*

MB Themes

Re: Redirect after post item
« Reply #5 on: February 13, 2024, 09:47:03 AM »
Thanks, theme updated.
Core errors are probably related to using incompatible PHP version with your Osclass.
You can define redirect after publish in Listing settings.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Gile

  • ***
  • 42 posts
Re: Redirect after post item
« Reply #6 on: February 14, 2024, 08:38:07 AM »
Thanks, theme updated.
Core errors are probably related to using incompatible PHP version with your Osclass.
You can define redirect after publish in Listing settings.


Hi, Thanks for the engagement, but I need to dig deeper, something is wrong, but I can't figure it out. I installed the subdomain with clone and everything works fine there, but it is an older version of osclass core.

Regards
Darko