PDA

View Full Version : Add-On Releases - iTrader - Automatically add "Deal URL" to rating page


LifesGreatestGift
02-17-2013, 11:00 PM
this automatically adds the URL to the iTrader "Submit Feedback" page.

Note: jQuery will need to be loaded.

edit plugin iTrader postbit (postbit_display_complete)

Find:
$templater = vB_Template::create('itrader_rate_trade');
$templater->register('itrader', $itrader);
$templater->register('post', $post);
$template_hook['postbit_controls'] .= $templater->render();

Replace With:
$templater = vB_Template::create('itrader_rate_trade');
$templater->register('itrader', $itrader);
$templater->register('post', $post);
$templater->register('thread', $thread);
$template_hook['postbit_controls'] .= $templater->render();

edit template itrader_feedback

Find:
{vb:raw footer}

Replace With:
{vb:raw footer}

<script>
$(document).ready(function() {
$.extend({
getUrlVars: function(){
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.in dexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
},
getUrlVar: function(name){
return $.getUrlVars()[name];
}
});

var ref_url = $.getUrlVar('ref_url');

if (ref_url != '' && ref_url != null) {
$("input[name=dealurl]").val("{vb:raw vboptions.bburl}{vb:if "$vboptions['bburl']", '/', ''}showthread.php?t="+ref_url);
}
});
</script>

edit template itrader_rate_trade

Replace All With:
<a href="{vb:raw vboptions.bburl}/itrader_feedback.php?{vb:raw session.sessionurl}u={vb:raw post.userid}&ref_url={vb:raw thread.threadid}" style="background: url(images/itrader/icon_positive.png) no-repeat transparent left;padding-left: 20px;">{vb:rawphrase itrader_rate_seller}</a>
<span class="seperator">&nbsp;</span>


Now, when a user is viewing a thread, and clicks the "Rate Seller" link, when they go to the following page, the Deal thread URL: (Optional) will be populated with the thread URL.

datoneer
02-18-2013, 07:09 PM
Great job man!

thang28101993
04-28-2013, 01:51 PM
Dear Sir,

Please help me check again! I can't found plugin iTrader postbit (postbit_display_complete) in any where?

Thanks!