Osclass forums
Support forums => Suggestions => Topic started by: darren on January 02, 2012, 11:30:43 pm
-
Feature Request:
Mark Items as expired in the dashboard in a user's "My Account" section (once they have actually expired)
Allow users to re-publish an item after it has expired.
Allow users to remove a listing (without deleting it) after their item sells
I have been looking through the code to attempt to add these features on my own, but I have not been able to do it yet. Any suggestions or help would be great. I will gladly offer my help if anyone familiar with the code can point me in the right direction in terms of what files need t be updated. Thanks much...
-
Hi darren,
I agree with your suggestion, we need this functions
disable, activate and mark as sold is allredy noted by osclass developer
topic:
http://forums.osclass.org/suggestions/user-can-disable-items/
regards
-
Hi darren,
Welcome to the community!
To add the text expired next to an item you could add the following code in the user-items.php file.
<?php
if(osc_item_is_expired()) {
_e('EXPIRED','modern');
}
?>
As for "Allow users to re-publish an item after it has expired." I as well have been looking for a solution to this.
As for "Allow users to remove a listing (without deleting it) after their item sells " I just submitted a feature suggestion for this as I have a site I am working on that I wanted this functionality. Here is the link to the issue for the code. https://github.com/osclass/OSClass/issues/102 Please do note that if you make these changes they will be overwritten when you do an update unless the osclass team adds this feature.
Jay
-
Hi Jay,
somehow it's not work, deactivate - button takes me to search page and items are not deactivate
regards
-
Hi ingo,
where about did you add the code in the item.php file? I forgot to add the line number where I added this code and that line was 245.
Make sure that the item.php file is the one in the root folder.
Jay
-
sorry,
I make it several times exact as your said/wrote but still takes me to search page
anyway thanks a lot.
3:35 h AM in Austria, I will take a break, bye!
-
Not sure if this is obvious, but just incase.... if you're using this code:
if(osc_item_is_expired()) {
_e('EXPIRED','modern');
}
Make sure to wrap it in <?php ?> tags, like:
<?php
if(osc_item_is_expired()) {
_e('EXPIRED','modern');
}
?>
-
I am thinking that the code was not added in the right place in the item.php file and it cannot find the deactivate code section and it just redirects you to the search page.
I uploaded the root folder item.php file try replacing yours with this. Make a backup of yours first just in case it does not work but it should.
Jay
-
@Jesse
Thanks, I used from the beginning correct code
@Jay
Thanks, your item.php file is the same like mine, it redirects me to right page -....mypage.../item/activate/19
but actually Im on the search page - Your search result...
Jay you made a little typo at github:
<a href="<?php echo osc_item_deactivate_url();?>" ><?php _e('Dectivate', 'modern'); ?></a>
<?php } ?>
No idea what am I doing wrong, thanks guys
-
I think I have problem with german language,
beacuse It's same in admin panel when I try to Manage items, it will be > redirect to > /oc-admin/index.php?page=items&catId=99 page but it shows blank page, if I enable new language in oc-admin it shows items but only for short time
regards
-
Hi ingo,
Can you tell me what the url of the deactivate link is?
Jay
-
Hi Yay,
........................................................
thanks
-
Hi ingo,
I found another error. In the code that got entered into hDefines.php look for the following line
return osc_base_url() . 'item/activate/' . $id ;
change it like so
return osc_base_url() . 'item/deactivate/' . $id ;
Try it like above I am currently unable to test if that fixed the problem as my permalinks are not working right at the moment.
Jay
-
unfortunately does not work
-
I got my permalinks working and I found out that we need to add another rewrite rule to the generate_rules.php and then it works just fine with permalinks.
Add the following code on line 53 of the generate_rules.php file.
$rewrite->addRule('^item/deactivate/([0-9]+)/?$', 'index.php?page=item&action=deactivate&id=$1');
You may have to disable and re enable your permalinks for the change to take place.
Jay
-
still nothing
I trayed several times Dis/Enable and login/out
-
Does it work if you disable the premalinks?
Jay
-
Yes ;D
-
That is good that it works. I think the reason it is not working with permalinks enabled is because in the function that got added to the hDefines.php I had a typo it should be like so
function osc_item_deactivate_url($id = '') {
if ($id == '') $id = osc_item_id();
if ( osc_rewrite_enabled() ) {
the line below is the line that had activate instead of saying deactivate
--> return osc_base_url() . 'item/deactivate/' . $id ;
} else {
return osc_base_url(true) . '?page=item&action=deactivate&id=' . $id ;
}
}
Check that and then I think it should work with permalinks enabled.
Jay
-
yes in deed, I de / activate more than 10 times to make a sure
Jay you're 8)
Regards
-
As for "Allow users to re-publish an item after it has expired."..... basically all you need to do is update the "Published" date (dt_pub_date) in the database table os_t_item.
Although, not sure how to do that with OSClass functions, yet. It's essentially a simple php/sql function though.
-
today the same problems with permalinks as yesterday + lots of bugs
1. displays - Deactivate / expired at same time. It means you have to disable at first after you can Activate >>after activating >> redirect to item page (not comfortable)
2. displays - 4 pages with items in user manager - actually there are 3 pages with items >> if you click on fourth page it displays = you dont have any items.
3. if you deactivate item on third page you will be redirect to first page in user manager
4. it does not display at all on wich page you are at the moment.
5. if you click on image you will be redirect to upload page -- /oc-content/uploads/16.jpg - not to item
6. if you deactivate -- flash massage -- your item has been published successfully :(
sorry, that's the life
regards
-
1. that can be changed in the root item.php file. Look for this line $this->redirectTo( osc_item_url( ) ); and change it like so $this->redirectTo( $_SERVER['HTTP_REFERER'] );
2. I am not sure as to why it is showing 4 pages instead of 3.
3. do the same as number 1 except you are looking for this line $this->redirectTo( osc_user_list_items_url( ) );
4. I do not quite follow are you talking about the pagination page numbers?
5. Look for this line around the image <a href="<?php echo osc_resource_url(); ?>" rel="image_group"> and change it like so <a href="<?php echo osc_item_url(); ?>" rel="image_group">
6. That is strange it should be showing this item has been deactivated.
Jay
-
4. I do not quite follow are you talking about the pagination page numbers?
obaut this: 1 2 [ 3 ] 4 > marking of the current page
i will try with new changes - Thanks
ingo
-
Hi ingo,
Add this rule to your style.css of your theme. This will change the color of the text of the current page you are one so if you are on page 3 the letter 3 will be the color red or what ever color you want it to be.
.paginate .searchPaginationSelected { color: red; }
Jay
-
Thanks :)
-
Just a quick update due to some file name changes probably
The last step here https://github.com/osclass/OSClass/issues/102 must now be made in oc-admin/settings.php instead of generate_rules.php, which does not exist anymore apparently
You can place the code on line 679 for example
Make sure to deactivate and reactivate the permalinks option in OSClass admin to make it work
By the way, even though this Deactivate / Activate function perfectly works, it does not make Expired disappear after an ad has been reactivated, wondering why