This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

Sudo

  • ***
  • 47 posts
[SOLVED]Would like to add 'Republish' button
« on: November 30, 2017, 01:32:16 AM »
Hi,
Would like to add a single button (or link) on the user-items page, so user can click and it's adds a ('move to top/republish)
item to the shopping cart and links to the cart page so they can than checkout and item is republished. 
Any help on this would be awesome!!  Would make easier to user to spend money :)
Thanks in advance!
@Sudo
« Last Edit: December 01, 2017, 03:39:53 PM by Sudo »

*

MB Themes

Re: Would like to add 'Republish' button
« Reply #1 on: November 30, 2017, 08:50:51 AM »
@Sudo
This is code for move to top:
Code: [Select]
<?php echo osc_base_url(true); ?>?page=custom&route=osp-cart-update&product=801x1x120
For republish, there are multiple parameters, this is default:
Code: [Select]
<?php echo osc_base_url(true); ?>?page=custom&route=osp-cart-update&product=601x1x120x3x1
- last number (1) is how many republish - repeats
- pre-last number (3) means after how many hours.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Sudo

  • ***
  • 47 posts
Re: Would like to add 'Republish' button
« Reply #2 on: December 01, 2017, 03:10:47 AM »
Will move to top also change the expiration date for expired/unexpired ads?

Thanks!!
@Sudo

@Sudo
This is code for move to top:
Code: [Select]
<?php echo osc_base_url(true); ?>?page=custom&route=osp-cart-update&product=801x1x120
For republish, there are multiple parameters, this is default:
Code: [Select]
<?php echo osc_base_url(true); ?>?page=custom&route=osp-cart-update&product=601x1x120x3x1
- last number (1) is how many republish - repeats
- pre-last number (3) means after how many hours.

Marked as best answer by Sudo on December 01, 2017, 03:39:26 PM
*

MB Themes

Re: Would like to add 'Republish' button
« Reply #3 on: December 01, 2017, 09:09:10 AM »
@Sudo
No it does not touch expiration date, it jsut update publish date and wipe modification date.

You can take a look on it here;
oc-content/plugins/osclass_pay/functions.php

Code: [Select]
    Item::newInstance()->dao->query(sprintf('UPDATE %st_item SET dt_pub_date = "%s" WHERE pk_i_id = %d', DB_TABLE_PREFIX, date('Y-m-d H:i:s'), $item_id));
    Item::newInstance()->dao->query(sprintf('UPDATE %st_item SET dt_mod_date = NULL WHERE pk_i_id = %d', DB_TABLE_PREFIX, $item_id));

To update expiration date you could add something like this:
Code: [Select]
    Item::newInstance()->dao->query(sprintf('UPDATE %st_item SET dt_expiration = "%s" WHERE pk_i_id = %d', DB_TABLE_PREFIX, $some_date_in_future, $item_id));

and set to variable $some_date_in_future correct value.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots