Osclass forums

Support forums => General help => 3.8.x => Topic started by: MGD4me on July 29, 2019, 08:27:43 pm

Title: How to change Alert1, Alert2, etc to show Category name instead?
Post by: MGD4me on July 29, 2019, 08:27:43 pm
Using ver 3.80 and Bender theme.

I've searched the forums to find a solution, but couldn't find a definitive answer:  Instead of simply displaying a users Alert subscriptions as "Alert1", "Alert2", etc, I would like the actual Category name be displayed, like "For Sale", or "Looking to Buy".

Has someone found a way to do this ??

Thanks.
Title: Re: How to change Alert1, Alert2, etc to show Category name instead?
Post by: marius-ciclistu on July 29, 2019, 10:25:28 pm
In a very difficult manner:) Just joking.
They made it like that in order to use a plugin (I can't remember if it's free or paid).

Also if a user unsubscribes from an alert, the alert is not deleted from db if I remember right.

You can search in my posts some solutions regarding deleting the unsubscribed alerts like

https://forums.osclass.org/development/alerts-in-admin/msg149604/#msg149604

I solved this problem with core modifications and some php logic.
Title: Re: How to change Alert1, Alert2, etc to show Category name instead?
Post by: MGD4me on July 31, 2019, 09:27:15 pm
There is a lot more to this program behind the scenes going on, which makes it tricky to "reverse engineer".

However, I am using this piece of code in 'item.php' to include the Parent Category in a listing, and it works really well (for me). However, when I try to use it in 'user-alerts.php' the value returned to $cat is always blank.

I can't figure out why it retrieves the Parent Category in one instance, and not in the second.  :o(

Code: [Select]
<?php
$aCategories Category::newInstance()->hierarchyosc_item_category_id() );
$cat '<a href="' osc_search_url(array('sCategory' => $aCategories[0]['fk_i_parent_id'])). '">' $aCategories[1]['s_name'] . '</a> : ';

echo $cat;  // displays correctly in item.php, but nothing in user-alerts.php
?>

Title: Re: How to change Alert1, Alert2, etc to show Category name instead?
Post by: marius-ciclistu on July 31, 2019, 10:38:34 pm
The alerts are stored as json if I remember right.