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) {}
Related
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
How to add css to specific wordpress user to hide plugin fiction over front end? I installed the wp-about-author plugin but I need to set as hidden for admin user. So when the admin make any blog post then the wp-about-author wont be displayed. Unfortunately no feedback from the plugin developer. Thanks for any suggestions.
CSS way is not recommended since the user can check out actual DOM by view the source.
Instead, You can prevent from even showing up in the DOM Tree by modifying a plugin php file.
$level = get_the_author_meta('user_level');
if ($level == 10) {
return;
}
Add this line to wp-about-author.php on line #31.
This works, I tested.
Try to update plugin better then hack css :) You can add to wp-about-author.php on line #102 something like:
if (wp_admin()) $return_content = '';
I didn't check it, but might work for you.
How can I check for buddypress from a theme? I've found this page for BP Plugin development
but this action never gets loaded if I hook from a theme. Why does it not work?
P.S. I need call some BP's functions from a theme, like: Show "BP's Activity Stream" at specific places.
What I mean with "never gets loaded" is:
(File in subdirectory of theme, and included in functions.php)
function sometestfunction() {
exit();
}
add_action ('bp_include', 'sometestfunction');
This must make wordpress show a blank page, won't ?
Simple check if function 'bp_is_active' is defined:
if ( function_exists('bp_is_active') ) {
// do something here...
}
see shanebp answer and comments.
this action never gets loaded
You mean never gets called?
Not sure why that would be, since you don't provide any code.
But it's meant for loading plugins.
If BP is installed, it is loaded by the time theme templates are parsed.
Have you tried calling BP functions in your theme?
I've never had a problem doing that.
Put your function(s) in one of these places:
a plugin
theme/functions.php
bp-custom.php
http://codex.buddypress.org/plugindev/bp-custom-php/
If your code will be used on installs you don't control, you should check for a BuddyPress component:
if( bp_is_active( 'activity' ) {
http://codex.buddypress.org/developer/bp-is-active/
I am working on a wordpress site and would like to clarify a basic concept that is definitely very important, and this is how to customize/extend a wordpress hook (at least that's what I think I want to do!)
As the real world example, I am setting up a wp-ecommerce site. When a user adds an item to the cart, I would like to do one or two more things than the original function does. Looking through the source, I find:
/wp-content/plugins/wp-e-commerce/wpsc-includes/ajax.functions.php
with the function:
function wpsc_add_to_cart()
I know I could simply edit the code right here, but obviously that is the completely wrong way to go about it as when the plugin is updated, I will lose changes. What is the correct way to extend a function that is part of a plugin, or wordpress for that matter?
Endless thanks in advance.
You can use the wordpress action hooks to resolve the code loss while plugin upgrade.
You can remove the function which is in plugin file by using remove_action hook and do your own code by adding add_action in your function.php file. So that you can customize your plugin code from theme's function.php.
Here are the examples to explain.I hope it will help.
http://codex.wordpress.org/Plugin_API
http://themeshaper.com/2009/05/03/filters-wordpress-child-themes/
I use a little supressed notice function (it lives in my child themes function.php page), for plugins that get irritating eg: please setup twitter account to use , this kind of warning is not useful at certain stages and sometimes just do not care for it.
function supressed_notices_active(){
echo '<div class="error"><p>Supressed Notices are active</p></div>';
}
if(function_exists('the_plugin_custom_function_call')){
remove_action('the_plugin_custom_function_call' );
add_action('admin_notices','supressed_notices_active');
}else{
function test_message_from_me(){
echo '<h1>show</h1>';
}
add_action('admin_notices','test_message_from_me');
}
So I create the supressed notice function to at least create a warning, so i remember.
Check if the target function exists with the function_exists($target_function) hook
then remove this action from running with the remove_action($tag,$target_function) hook
then just add your custom function with the add_action($tag,$target_function) hook (do not need to have a separate function this could just be a closure)
then else if the function does not exist either still run a new action or leave this section, it can be useful for testing to just add anything so you atleast get some feed back.
What you could try... Copy the function within the plugin file,
paste it into your themes functions.php file,
ie:
function wpsc_add_to_cart() {
global $wpdb, $wpsc_cart;
// default values etc..etc..
// new code here?
}
the only thing with this is, if the plugin is updated and that funciton is renamed or removed, changed or something you could start to run into trouble...
could you not ask the plugin developer to possibly add your requirements to it,
possibly for a small fee? but if your using it as your main shopping cart, then chances are, that small investment could be a good thing.
Marty
I'm trying to make a custom Taxonomy Term page in Drupal 7. I've created a page--taxonomy.tpl.php file in my templates folder. The file only prints out a message. I now try to force the template file by adding
function template_preprocess_page($variables) {
if (arg(0) == 'taxonomy') {
$variables['template_file'] = 'page--taxonomy-tpl';
}
}
in my template.php, but it won't work. Can you help me? And if I get the custom page working, how do I fetch the nodes with this term (in page--taxonomy.tpl.php)? Thanks in advance.
Try using this in your template.php:
function template_preprocess_page(&$variables) {
if (arg(0) == 'taxonomy') {
$variables['theme_hook_suggestions'][] = 'page__taxonomy';
}
}
You need to pass $variables by reference, so add a & before it
template_file has changed to theme_hook_suggestions in Drupal 7
You don't need the -tpl in the template suggestion unless you want it to be a part of the filename like "page--taxonomy-tpl.tpl.php" which I don't think is what you want.
For more information, check out template_preprocess_page(), theme_get_suggestions() and Working with template suggestions
Not sure if this would meet your requirements, but one of default D7 views - Taxonomy term - emulates Drupal core's handling of taxonomy/term pages. You could just enable it (it would automatically replace Drupal's core taxonomy URLs), and then do whatever you want with it, keeping original page structure, all blocks etc, using Views' page templates (see "Theming information" in "Advanced") and all other bells and whistles...
Since you are using Drupal 7, you could also create a file name "taxnomy-term.tpl.php" and edit according to your needs.
See taxonomy-term.tpl.php
Full control over the taxonomy term page can be obtained using hook_menu_alter() . See https://drupal.stackexchange.com/questions/48420/theming-and-overriding-taxonomy-term-vocabulary-page/111194#111194