1. Home
  2. ReHub Theme
  3. Advanced tips and customizations
  4. Enable custom frontend posting for Dokan

Enable custom frontend posting for Dokan

As you know, Dokan plugin uses own frontend submit system. Problem is that you can’t customize it. Sometimes, you want to change some fields, add own fields and even want to use own frontend submit plugin. Here simple code which can allow to redirect “add product” button to your custom page instead of default.

So, first of all, create page with submit form which you will use, then, go to Dokan – Settings – Selling Options and disable there Product Popup

Then, add in theme option – general – js code in footer next script

<script>
jQuery(document).ready(function($) {
var mynewsubmitlink = 'http://localhost/wordpress/add-test-post/';
$(document).on('click', '.dokan-add-product-link a', function(e){
    e.preventDefault();
    window.location.href= mynewsubmitlink;
});
});
</script>

Instead of http://localhost/wordpress/add-test-post/ add you link on page with submit form

Also, maybe you need change all edit links in product list. So, full code will be

<script>
function getParameterByName(name, url) {
 if (!url) url = window.location.href;
 name = name.replace(/[\[\]]/g, "\\$&");
 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
 results = regex.exec(url);
 if (!results) return null;
 if (!results[2]) return '';
 return decodeURIComponent(results[2].replace(/\+/g, " "));
}
jQuery(document).ready(function($) {
var mynewsubmitlink = 'http://localhost/wordpress/add-test-post/';
$(document).on('click', '.dokan-add-product-link a', function(e){
 e.preventDefault();
 window.location.href= mynewsubmitlink;
});
$(document).on('click', '.dashboard-widget .widget-title a', function(e){
 e.preventDefault();
 window.location.href= mynewsubmitlink;
});
$('.product-listing-table .row-actions').each(function(e){
var link = $(this).find('.delete a').attr('href');
var linkid = getParameterByName('product_id', link);
$(this).find('.edit a').attr('href', mynewsubmitlink +'?wpfepp_action=edit&wpfepp_post='+linkid);
});
});
</script>

This code is for RH frontend PRO plugin. If you have another plugin, you need to check link structure of edit page and place it instead of

$(this).find('.edit a').attr('href', mynewsubmitlink +'?wpfepp_action=edit&wpfepp_post='+linkid);

 

for example, it can be

var producteditlink = $(this).find('.edit a').attr('href');
var neweditlink = producteditlink.replace('edit', '?puff=edit&puff_post='+linkid);

 

 

Was this article helpful to you? Yes No

How can we help?