How can add tracking code (tradetracker and daisycon) on thank you page - php

I have a task, I did research but I still cannot be done.
I am using OpenCart. And I have to add code tracking (from tradetracker and daisycon) to thank you page.
How can I do it?

If you aren't too comfortable with writing your own extension and your tracking code is JavaScript or HTML you can place it straight into your template. You will find the template you need in:
/catalog/view/theme/default/template/common/success.php
The only problem is that this will now fire every time the page loads. Any success goes to this template.
To fix this you need to go into the controller and make a small addition.
Find:
if (isset($this->session->data['order_id'])) {
Add a new line below reading:
$this->data['enable_tracking'] = TRUE;
Then back in the template before simply add an if statement round the tracking code you have added like so:
<?php if($enable_tracking === TRUE){ ?>
Delete this line and replace with tracking code
<?php } ?>
That should solve your problem.

Related

whmcs module clientarea page per bought product

so I have 2 modules one working(paid for not encrypted)learned a lot from it lets call this the reference_module and I have my own module which was a PHP page which I am rebuilding for WHMCS and it is almost working completly lets call it created_module.
the problem right now I have is the reference_module is called by when going to https://domainwhmcs.nl/clientarea.php?action=productdetails&id=0001&reference
which is working and shows what I want:
the normal header
normal sidebar
normal footer
and its own content in the main content area
it does this by using hooks having ReferenceClientareaheaderoutput and ReferenceClientareapage which works.
so now I tried to recreate this in created_module but when going to https://domainwhmcs.nl/clientarea.php?action=productdetails&id=0001&created which is working but shows me:
its own content
just its own content but I want the same as in Reference.
I think if I am going to paste the code the post will be to long if needed maybe I can post specific parts.
Allread thanks for helping
so I actualy did solve it today you have to use javascript
jQuery.post("index.php",{"action":'dbinfo',"user":username,"serviceid":serviceid},
function(data){
jQuery(".main-content").html(data);
jQuery("#tabs li").removeClass("active");
jQuery("#tabs li").eq(index).addClass("active");
and
if (isset($_POST['action']) && $_POST['action'] == "dbinfo") {
this you do in your module hook if you need help you can contact me

Load pagination on different component

I would like to load pagination module on different module than article. I have found that
components\com_content\views\article\tmpl\default.php contains this:
<?php
if (!empty($this->item->pagination) && $this->item->pagination && $this->item->paginationposition && !$this->item->paginationrelative):
echo $this->item->pagination;
?>
<?php endif; ?>
unfortunately if I put this code for example to my template index file it does not work. Aparently I have to add something more to this.
Could you advice me what other part of the code is needed?
Thank you!
It's a little complicated to wrap your mind around but if you look in the plugins/content folder you will see the pagenavigation plugin. This is the plugin that creates the pagination you see in articles.
THis plugin is triggered by
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$item->params, $offset));
which you can find in `\components\com_content\views\article (and also archive and the tag view of com_tags). I have no idea why it's not triggered in other components except at some point probably someone thought there wasn't a usecase for it.
To trigger the plugin in another component you would need to add that same event or a different event that basically does what the onContentBeforeDisplay method in the plugin does. If it is your own component I would do it in the same place content and tags do. If you need it in one of the core components you could probably do it by using another event.

How can I include / exclude a part of an included PHP file based on the file I am including it in?

The title is a bit convoluted. Let me explain better.
I'm making a blog where registered users can delete and edit their posts. The posts are displayed on 2 sites - the main page, and an admin control panel page. The code for generating the posts is in a separate file.
On the title page, everyone should only be able to see the posts. On the admin page, registered users can edit / delete their posts using the same included php file. There is one function smack in the middle of the code that determines if the editing buttons are visible. I want that function to be present when the file is included on the admin page, and not be present when it is included on the main page.
Let's say that the file which is included, blogposts.php looks something like this:
<?php
code
function();
rest of code
?>
What can i do to exclude that function in the instance where I don't need it?
I've also tried deleting the function and writing:
<?php
require "blogposts.php";
function();
?>
That executes it only on the last post, but should execute it on all of them since it is part of a while loop in the original code.
So, other than writing the code twice, once with and once without the function, if you guys have any ideas I'd appreciate it,
You could place the function inside an if statement, and check the current page against $_SERVER['REQUEST_URI'].
Something like:
if($_SERVER['REQUEST_URI'] == '/current_page_uri.php')
{
function();
}
And then replace the '/current_page_uri.php' with the URI for your admin page.

Stop a particular <div> appearing on just one page

I was wondering could you help me, we currently have an announcement banner across the top of all our webpages which I want to remain apart from one page. A couple of guys did a bit of work for me a put an announcement in which I can edit via Custome Content Type Manager on Wordpress.
In the Header.php the code is there and I'm not sure how to get it to stop appearing on a particular page, the id of the page I DONT want it on is 2664. The code is shown below:
<?php
$gathering_page = get_the_ID();
if( ($gathering_page == 3001 || $gathering_page ==2664) && !(is_front_page()) ){ ?>
I'm not sure if the guys have tried to block it or what this code means.
Any feedback would be appreciated. Thanks
EDIT: This may make it easier; I would like to make a div class disappear on the page named above. the div class is
<div class="snippetHomeTop">
I'm sorry if I did wrong, but have you tried using the is page?
<?php if (is_page('2664')) {
// donĀ“t show content for page ID 2664
} else {
// show content for other pages
}?>
Good Luck

How to theme Ubercart Checkout Complete page

I want to theme the page /cart/checkout/complete
I already saw the settings in admin/store/settings/checkout/settings, but they are not enough.
I want to add some HTML i.e. add a print button at the top of the page.
I would like to have a .tpl.php file to use as template, or otherwise, using an alternate checkout page, how to insert the texts defined in checkout settings.
I tried to make a uc_cart_complete_sale.tpl.php but it isn't called.
Thank you in advance.
According to the Template Suggestion documentation you can provide a custom page.tpl.php for absolutely any path, so a template file with the following name would override page.tpl.php for the path cart/checkout/complete:
page--cart--checkout--complete.tpl.php
Be sure to clear Drupal's cache once you've create the file so the changes are picked up in the theme registry.
After hard work, i found the template page.
It is:
page--cart--checkout--complete.tpl.php
remember to clear the cache
firstly, you should probably check this page: admin/store/settings/checkout/edit/messages
there you can customize a header for the message displayed when the checkout completes.
other than that, you can implement some functions to alter this page. from a short look in the ubercart api maybe this function will do: my_module_checkout_complete() in this link the guy says it worked
another function that should work is theme_uc_cart_complete_sale
there are other options, such as in your template.php check if this is /checkout/complete and do whatever you want. like this:
if (arg(0) == 'cart' && arg(1) == 'checkout' && arg(2) == 'complete')
and than redirect to your page. anyway, there are plenty of ways to accomplish this, but just naming a file 'uc_cart_complete_sale.tpl.php' won't work. sorry...
In D6 at least, you can theme the message by overriding theme_uc_cart_complete_sale() - so if that's what you're after, theme the message by overriding that in your theme (for example, function mytheme_uc_cart_complete_sale($message, $order) {}

Categories