change ubercart order success message Drupal 7 - drupal-7

In Drupal 7, I am using Ubercart.
After placing an order it shows a message like this:
Your order is complete! Your order number is...
I want to change this message.
I tried to change function uc_cart_uc_message(), but it is not changing.

Related

Using Matomo API to get top 10 visited pages starting with a certain URL

For a weblog I am trying to get the top 10 popular posts from for example the last month. I figured I'd get the data out of Matomo, as that's already tracking visits and has an API. I've never used this API before though, so I've been reading the documentation and trying out some things. I am able to get data from the API using the Actions.getPageUrls method. However, when I try to filter using segment=^http://example.org/post I still get data from other URL's. It looks like it filters on session and gives back all data from the sessions that have at least 1 page that conforms to the filter.
The full URL I'm using is: http://example.org/matomo/index.php?&module=API&token_auth=12345&method=Actions.getPageUrls&format=json&idSite=1&period=month&date=today&expanded=1&segment=pageUrl%3D%5Ehttp%253A%252F%252Fexample.org%252Fpost. I've also tried with less and no URL encoding for the segment, but that doesn't seem to make a difference. If I use a URL that doesn't exist I get an empty array returned.
Am I doing something wrong? Is there a different way to only get the top pages with a URL starting with http://example.org/post? Or do I have to sift through the data myself to only get the pages I want?
I am using Matomo version 3.13.5.
I figured it out. There is no need to use segment. This can be achieved using the flat, filter_column and filter_pattern parameters.
Setting flat=1 will make it so all pages are returned in a single array, instead of hierarchically.
With filter_column and filter_pattern I can filter the results.
The URL I use now is: http://example.org/matomo/index.php?&module=API&token_auth=12345&method=Actions.getPageUrls&format=json&idSite=1&period=month&date=today&flat=1&filter_column=label&filter_pattern=%5E%2Fpost%2F. This does exactly what I want.
The unencoded pattern is ^/post/, so this will filter out any page that does not start with /post/.

How do I display a message when no results are found in drupal 7 views

I'm global:php to display data in my views page. In case there is no data's in view that time its showing empty screen. But i want to display "no match forund" instead of empty screen.
Please make sure you have the 'Views PHP' module enabled in order to use Global:PHP.

Get nid of a view in Drupal 7

I created a view that makes a block for my homepage. I need to render this block in my PHP. Problem is, I need the nid to render the node and I usually get these by going to Structure -> Blocks -> Click configure and the ID is in the page url at that point. For this view I created, there is no ID, just /admin/structure/block/manage/views/cfps-block/configure.
How can I get the ID so I can render this programmatically?
If i understand your problem correctly.
Open you view
For example:
Blockquote
example.com/admin/structure/views/view/custom_view/edit
get the Machine Name of that view suppose it is block, than you can render it by using following code.
echo views_embed_view('custom_view', 'block');
Read the manual if any confusion:
https://api.drupal.org/api/views/views.module/function/views_embed_view/7

How to render Drupal 7 Date Field

How can I properly render exclusively end date from the Drupal 7 Date field in template file?
$node->field_start_date[LANGUAGE_NONE][0]` (is it correct?)
I can get to raw values but I want it to get formatted etc.
You can use the code below:
drupal_render(field_view_field('node', $node, 'field_end_datetime'));
field_view_field: https://api.drupal.org/api/drupal/modules!field!field.module/function/field_view_field/7

How to hide a field in node display if it's value is 0. Drupal 7.

I am using a drupal installation as a REST server for an Android application. I store data in nodes and occasionally a field is blank, for example a location that has no phone number. I had to standardize the JSON coming out of the drupal REST server to a specified class, so I was forced to add 0, as the value in the field.. Works great in Andriod, but when viewed on the drupal site, it looks bad..
So question is, if the value of the field is 0, Id like to change it to
'None'.
I could do this in D6 with cck, but i dont know d7 field api. Thanks
You can do this in the node.tpl.php file, in the field.tpl.php file or with the template_preprocess_field function (recommended) and with so many other options with an if statement.
See an example for first template and one for second option with the preprocess function.
If you don't want to edit tpl.php files or you don't have access to the template.php file of your theme you can use the Field formatter conditions module that allows you to do this condition. Alternatives are Custom Formatters and field_formatter_css_class.

Resources