I'm using Drupal 6.15 with ubercart 2.x and I'm trying to implement ubercart's hook_checkout_pane() to override their default uc_cart_checkout_pane(). My goal is to disable some of the default checkout panes - customer information and order comments.
I made a function my_module_checkout_pane() in my_module.module and it does get called, but the uc_cart version seems to be generating what's actually rendered.
I understand why both functions get called and I can change the order they're called in by modifying my module's weight in the system table, but doing so doesn't seem to affect what ends up on the page. Whether my_module's function is called first or second, the uc_cart version is what's rendered. The only way I can get my function to affect the page is to actually alter uc_cart_checkout_pane() so it doesn't return any output but that's not a "good" solution.
Is there some other place I need to do something to make Drupal favor my hook implementation over uc_carts'? Alternatively, is there another way to accomplish this?
you can enable or disable checkout panes in "Checkout settings".
btw: no need to alter module weights, you can do this with pane weights.
If I'm not mistaken, hook_checkout_pane is for creating new checkout panes, not overriding default ones. Seems like you'd use hook_checkout_pane to make your own pane and just use that instead? See http://www.ubercart.org/forum/development/11698/alter_checkout_panes
Apologies if I'm mistaken.
Related
I'm trying to pragmatically set those 2 variables upon installing a site.
user_pictures (Disabling user pictures altogether)
user_register (allowing visitors to register without admin)
I'm using Features with strongarm but no luck. Even with the feature enabled the options are wrong in the account settings.
Setting the variable manually with a script doesn't do the trick either, although the options show the correct checkbox as ticked, I still have to to the page a click "save configuration" to confirm the setting.
This goes for maaany other variables I'm tryign to set, and I'm not sure if this is possible but it would be nice.
Thank you!
One solution which only solves part of my problem is to use Install profiles. The problem with those is that some variables still don't seem to take effect or work at all...
https://drupal.org/developing/distributions
https://drupal.org/project/profiler
It looks like this is the intended behavior of the features module, according to this old issue on drupal.org:
Say when developing a site, and set the settings at admin/user/settings for user_register. then you go live, later you decide to change the value, make a feature and strongarm that user_register variable then deploy that. The setting will still be in the database (as a variable), thus the feature is overridden.
The simplest solution is to not rely on features to set your variables on installation. It's much simpler to use hook_install anyway. I suppose we're only supposed to think of the Features module as a means of setting up or updating complicated configuration from the Features administration page, but not when the module itself is enabled or updated.
This will set the variables you describe for the example module:
function example_install() {
variable_set('user_pictures', 0);
variable_set('user_register', 1);
}
If other parts of your feature also aren't being set up correctly, perhaps you should try this instead:
function example_install() {
// This will only revert 'variable' features. Include additional features as needed.
features_revert(array('example' => array('variable')));
}
Is it possible to display an existing widget (configured via the widgets control panel) in a WordPress theme bypassing the whole "sidebar" thing? It may not be good practice, but I sort of expect this to be possible - and can't find a way to do it.
I've read about "the_widget", but looks like this function call creates a new one (complete with new title, text etc) instead of reusing a widget that I have configured in the control panel.
If this is not possible - I'll have to use the sidebars, but hoped to avoid doing it in several specific places, seems overkill.
Thanks for any help.
Yes, you can. Just look on the specific widget's code, you'll find the function that the sidebar calls, call that function right on the theme passing the parameters you need in an array.
I'm trying to create a simple module to preview themes in Drupal. Each user has their own custom node and I want to be able to show them a preview of how the theme will work without them actually enabling it. Right now this is what I have:
function theme_preview_info($new_theme, $node_id)
{
global $custom_theme;
$custom_theme = $new_theme;
$node = node_load($node_id);
return $node->body;
}
It will display the content of the node, but the formatting is all messed up. How can I properly display the node exactly as it would as if i went to node/1, but instead view it at theme_preview/theme_name/1?
Do you have any experience building Drupal modules?
If not, you may find that what you are trying to do is not all that simple.
You will need some interface for the user to choose which theme they are previewing. Then, you will need to hook into Drupal's routing to direct users to the appropriate node using the selected theme preview based on a customized path alias (theme_preview/theme_name/1). There's most likely a lot of other back-end overhead that I'm not anticipating at the moment.
If you have experience with building Drupal modules, though, that might not be a big deal.
Switching out the theme is probably the easiest part. If you're in Drupal 7, you can use an implementation of hook_custom_theme() to change the theme used for particular nodes based on your intended criteria (i.e., which theme the user selected).
http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_custom_theme/7
This way, you can actually allow Drupal and the selected theme to completely handle the rendering of the page, giving a more accurate preview.
I'm not sure how exactly you would go about creating the user's theme-switching interface or routing the user to a specific path alias for each theme selection.
You also might want to look into the ThemeKey module (http://drupal.org/project/themekey). It's possible you could use that module somehow to simply set up ab version of each node to be viewed in each different theme.
A recent change (link to Google Cache as d.p.org seems to be down right now) to the way Plone calculates the review list for the full_review_list view. In order to support LinguaPlone better, WorkflowTool now explicitly adds a Language='all' to the query used to retrieve a worklist, whereas before only results in the user's current language were shown. The code is in Products.CMFPlone.WorkflowTool#getWorklistsResults().
Is it possible to override this new behaviour to obtain the old behaviour?
We really ought to make that customizable via a ZCML override, but you're right, in that form it's not overridable simply. So no matter what approach you're going to take, you'll have to copy that method and modify it somewhere else and then hook it in so that your customized version takes precedence.
Where do you need to see the changes? Just in the initial review list portlet? In that case, just override the renderer for that portlet, add a method to the new renderer, copy in the code, make your changes, then override the renderer to use the renderer method instead of the one on portal_workflow.
If you want to see the changes in the full review list you click through to from the portlet, then you'll have to use collective.monkeypatcher to patch the method on portal_workflow. I'd recommend against this, since you probably want someplace where users can go to see the full review list with all languages.
I have some nodes I am displaying in a view. They are displayed as nodes, unformatted. I would like the user to be able to choose from some predefined sort criteria ( via drop down list or similar).
So they could pick recently active, most commented, newest, etc., and re-query for new results.
Its easy with tables because you can make the labels clickable, but I do not know how to have similar functionality with a raw node preview display.
Just a thought, from me to me, and for anyone else who may be trying to do this.
An easy, sleezy option would be to just add another page view for each of the required sorts, and provide a link to these other views in the header of each of the pages.
This could also allow for (easier) linking to the individual sorts, so say if you have a sidebar block displaying recently commented nodes, you could adjust the .tpl.php of the block to have the title link to the view displaying the full set of recently commented nodes.
also im pretty sure there should be a way to do this with arguments, but i dont know how
Views 3 supports exposing sort order (just like you can expose filters)
Select the sort order (e.g. add sort by node creation date, then click on the settings for that), you should be able to expose the sort order to the end user. This is just like clicking on the settings for a filter and then choosing to expose it.
Standard views isn't going to support this, so IMO you're best off implementing a custom solution using just a plain old view and this jQuery plugin. You can either do this at the theme layer (the same way as any other JS in a theme) or a custom module (via drupal_add_js() to add the plugin and your bit of custom code). Either way will work, although the custom module has the obvious benefit of being theme independent (and thus more portable).
If you go the custom module route, please consider releasing it as a contrib module on http://drupal.org.