Ok so i ceated a hook and when starting an auction it points to auction-edit page so that if osclass pay is required before activation it does not start.
Same as on the auction page itself.... Button to select/deselect in admin area was added.
Few steps to follow and it works.
step1: In user-items.php from THEME find:
<a class="delete" onclick="return confirm('<?php echo osc_esc_js(__('Are you sure you want to delete this listing? This action cannot be undone.', 'epsilon')); ?>
')" href="<?php echo osc_item_delete_url(); ?>
"><i class="fas fa-trash"></i> <?php _e('Delete', 'epsilon'); ?>
</a>
Underneath add:
<div class="auction">
<script>
function startAuctionFromItemPage(itemId) {
var firstConfirmation = confirm(<?php echo json_encode(__('If you proceed, the auction will start immediately and become active. You are required to adjust the auction settings immediately after starting. Note: You are obligated to sell the item to the highest bidder. Are you sure you want to proceed?', 'epsilon')); ?>
);
if (firstConfirmation) {
var secondConfirmation = confirm(<?php echo json_encode(__('IMPORTANT: Please do not forget to set the duration and price for your auction after clicking on \'Proceed\', otherwise the auction will become active and will be offered at the lowest price. Are you sure you want to proceed?', 'epsilon')); ?>
);
if (secondConfirmation) {
startAuction(itemId);
} else {
alert(<?php echo json_encode(__('Auction has been canceled', 'epsilon')); ?>
);
}
} else {
alert(<?php echo json_encode(__('Auction has been canceled', 'epsilon')); ?>
);
}
}
function startAuction(itemId) {
if (itemId !== "") {
window.location.href = <?php echo json_encode(osc_route_url('act-create-item-auction', array('createItemId' => ''))); ?>
+ itemId;
}
}
</script>
<?php if (function_exists('act_item_link_hook') && act_item_link_hook() == 1) { osc_add_hook('item_links', 'act_item_link_hook'); } ?>
</div>
step2 THEME CSS / file style.css search for: USER ITEMS and underneath add:
.start-auction-btn { padding: 6px 8px; margin: 6px 6px 0 0; border-radius: 6px; background: #00bdd6; color: #fff; font-size: 13px; font-weight: 600; line-height: 1.2; box-shadow: 0 0 0 1px rgb(59 73 223 / 30%) inset; text-decoration: none; cursor: pointer; transition: background 0.2s, color 0.2s;}
.start-auction-btn:hover { background: #2f3ab2; color: #fff;}
Step3: SELECT PLUGIN AUCTION MAP / index.php from AUCTION plugin find:
osc_set_preference('hook_header_links', 1, 'plugin-auction', 'BOOLEAN');
Underneath that line add:
osc_set_preference('hook_item_links', 1, 'plugin-auction', 'BOOLEAN');
Step4: In functions.php from plugin find:
osc_add_hook('header_links', 'act_header_link_hook');
Underneath add:
// ADD AUCTION LINK IN USER ITEMS
function act_item_link_hook() {
if(act_param('hook_item_links') == 1) {
echo '<button type="button" class="start-auction-btn act" onclick="startAuctionFromItemPage(' . osc_item_id() . ')">' . __('Start Auction', 'auction') . '</button>';
}
}
Step5: in admin/configure.php from AUCTION plugin find:
$hook_header_links = mb_param_update('hook_header_links', 'plugin_action', 'check', 'plugin-auction');
Underneath that line add:
$hook_item_links = mb_param_update('hook_item_links', 'plugin_action', 'check', 'plugin-auction');
In the same file find:
<div class="mb-row">
<label for="hook_header_links" class=""><span><?php _e('Add Auctions Button to Header', 'auction'); ?>
</span></label>
<input name="hook_header_links" id="hook_header_links" type="checkbox" class="element-slide" <?php echo ($hook_header_links == 1 ? 'checked' : ''); ?>
/>
<div class="mb-explain">
<div class="mb-line"><?php _e('When enabled, button to search page with auctions only is added to header. Require Osclass Hooks 8.2 support.', 'auction'); ?>
</div>
</div>
</div>
<hr/>
Underneath that line add:
<div class="mb-row">
<label for="hook_item_links" class=""><span><?php _e('Add Auctions Button to User items', 'auction'); ?>
</span></label>
<input name="hook_item_links" id="hook_item_links" type="checkbox" class="element-slide" <?php echo ($hook_item_links == 1 ? 'checked' : ''); ?>
/>
<div class="mb-explain">
<div class="mb-line"><?php _e('When enabled, button to initialize auction is added to user active items. Require Osclass Hooks 8.2 support.', 'auction'); ?>
</div>
</div>
</div>
<hr/>
Your done
