We setup an woocommerce webshop with fooevents to be able to sell tickets with an barcode. We query the db of the webshop via a script which is called by a cronjob. This script fetches all sold ticket and pushes them into another system via an API. Unfortunately the other system requires an specific barcode format:
| 1 digit prefix | 3 digit system id | 2 digit device id | 7 digit unique ticket id |
We hoped we could define the ticket format in foo events via the admin interface but I cant find such option (also not with help of Google) The in total "6 digit prefix" is always the same so could be hard coded. I tried to find the place where the ticket id is generated but I was also not able to find that line of code.
Can someone help me out an explain me how i can achieve this is the most easy way?
It is not possible to change the barcode layout via the admin interface. The ticketID (used for the barcode) is generated in the class fooevents/classes/woohelper.php
...
1254 | $post['ID'] = wp_insert_post( $post );
1255 | $ticketID = $post['ID'].$rand; <- the ticketID / barcode
1256 | $post['post_title'] = '#'.$ticketID;
1257 | $postID = wp_update_post( $post );
...
Related
I want to have site in ASP.NET where will be simple login system. After login there will be also links to reports made in SSRS. But every user will have different links which he can see.
Nicks and passwords I want to check by Windows Authentication.
1) I'm wondering is it possible to keep these information in another place than database?
2) How I can get similar layout as in Report Manager? I mean, how to display my reports by using ASP.NET?
I'm newbie in ASP.NET (I don't know if it possible to do such things), so I hope I made myself clear.
Thanks in advance,
Monic
Question 1: What kind of information are you talking about, give a coding example or something based on your structure where the community can work on.
EDIT: Yes, it is possible to have the reports on a separate place. Moreover this means for each user you must create the rights under SSRS, in your page you then make a reference with the users authentication to SSRS. From there on, you then use SSRS functionality. This means an administrator will need to be around for every single new user to insert which report a user may see. This is an unhandy approach, because it is more easier just to give the SSRS address so all your users work from there. (You however have nothing to say over how the page looks.)
Question 2: ASP.net has a reportviewer control that gives you the ability to watch a certain report that is available on a reportserver. Most of the function of the SSRS reportviewer can be simulated in this control. Beware that you need to understand the control very good when you are using it. http://msdn.microsoft.com/en-us/library/ms251671(v=vs.110).aspx
As a sidenote:
I once created a website who had users with rights on different reports, different parameters based on their userid. I had a user table consisting out of intern (SSO) and Extern users. Also with different roles. Based on all that, different rights were given.
The link through for the reportviewer used a common reportuser instead of the user his own authentication, the userid then was given as an extra parameter were other parameters were based on.
EDIT:
When you want certain users to receive access to a report, create 3 tables: User, Report and UserReportLink
Example:
Userid | Name
1 | user A
2 | user B
3 | user C
Reportid | Name |ReportLink
1 | report A | 'http://MyReportServer/reports/Report1.aspx'
2 | report B | 'http://MyReportServer/reports/Report2.aspx'
3 | report C | 'http://MyReportServer/reports/Report3.aspx'
4 | report D | 'http://MyReportServer/reports/Report4.aspx'
Userreportid | Userid | Reportid
1 | 1 | 1
2 | 1 | 2
3 | 2 | 1
4 | 2 | 2
5 | 2 | 3
6 | 3 | 2
7 | 3 | 3
8 | 3 | 4
Your page then will consist out of the following logic for the reports:
=> return the user who is logged in (Session perhaps since it's asp.net)
=> return a list of all reports the user needs to see
var q = (from m in UserReportLinks
where m.Userid = this.UserId
select m).ToList();
=> with the above you have your reports for the user.
var l = new List<Report>();
foreach(var item in q)
{
var r = (from m in Reports
where m.Reportid = item.Reportid
return m).ToList();
l.Add(r);
}
//populate a control so the user can select a report
aControl.DataSource = l;
=> lastly, with the selectedId, return the report into the reportviewer.
=> select parameters etc...
I am almost there with this but cannot seem to get this functionality going as planned.
I am creating a questionnaire using drupal content type. What I am trying to do is to create a table like structure as below in content type. The second and third column contain check boxes and first column data(i.e computer, internet) and first row(i.e Everyone have access , Nobody have access) are taxonomy terms . Is it possible to display like this in content type by using some modules in drupal? Anybody have any better suggestions?
| | Everyone have access | Nobody have access |
---------------------------------------------------------
| Computers | 1 | 2 |
---------------------------------------------------------
| Internet | 1 | 2 |
---------------------------------------------------------
| Fax | 1 | 2 |
---------------------------------------------------------
You can use the Term Level Field module. This module provides a field type for referencing terms with a level to an entity.
You may use Editable fields with Views module. Of course, if you didn't need such a display (table forms) you should use Views Bulk Operations modules.
If you need to do this in a node use Tableform module. But if you want to show nodes whike editing a node it is the same. A node should not be used for tasks just for content.
I'm new to Drupal and am trying to embed a Flash game in the middle of the front page. I've created a "Full HTML" text format in Home >> Administration >> Configuration >> Content authoring and I've created a new block using that format by going into Home >> Administration >> Structure >> Blocks and placed it into Content region and display it at the <front> page only:
My problem is that I need to pass the user id and also a custom gender field to the swf file through the FlashVars parameter.
I can see my gender field in the database (I use PostgreSQL 8.4.7/CentOS 5.5/PHP 5.3):
# select * from field_data_field_gender;
entity_type | bundle | deleted | entity_id | revision_id | language | delta | field_gender_value
-------------+--------+---------+-----------+-------------+----------+-------+--------------------
user | user | 0 | 6 | 6 | und | 0 | Male
user | user | 0 | 5 | 5 | und | 0 | Male
user | user | 0 | 1 | 1 | und | 0 | Male
user | user | 0 | 7 | 7 | und | 0 | Female
And I see the users table:
# select uid, name from users;
uid | name
-----+-------
5 | Vasja
6 | Vanja
1 | Alex
0 |
7 | Petja
But how could I print them into my custom content block?
I also suppose there is already some prefilled data structure there, something like a $user array?
Please give me a bit help and directions to get me running on custom blocks.
I'm looking at the docs, but they're talking about custom modules, which is probably a bit overkill in my case?
And also I need to print a message to the Anonymous user telling him or her to sign in or register. Please give me a pointer here
Thank you!
Alex
P.S. My understanding is that swfobject isn't working well with Drupal 7 yet, but that is not a big issue for me.
It sounds like you want to be able to execute PHP code in your block's content. The Full HTML filter mode is not sufficient for that. Take a look at the PHP Filter module. It's included in core, but needs to be activated first, before you can use it for your block.
After that you can use normal PHP code, at which point the documentation on custom modules applies. You could for example access the $user array to retrieve fields, or make direct db calls, depending on where your required information is.
Edit: Of course, having full PHP access is powerful and should only be allowed for administrators. Hence, make a new specific content type in which you allow the PHP filter and ensure in the permissions that no user other than an administrator can create or edit that content type.
I have an ASP.Net website which uses a MySQL database for the back end. The website is an English e-commerce system, and we are looking at the possibility of translating it into about five other languages (French, Spanish etc). We will be getting human translators to perform the translation - we've looked at automated services but these aren't good enough.
The static text on the site (e.g. headings, buttons etc) can easily be served up in multiple languages via .Net's built in localization features (resx files etc).
The thing that I'm not so sure about it how best to store and retrieve the multi-language content in the database. For example, there is a products table that includes these fields...
productId (int)
categoryId (int)
title (varchar)
summary (varchar)
description (text)
features (text)
The title, summary, description and features text would need to be available in all the different languages.
Here are the two options that I've come up with...
Create additional field for each language
For example we could have titleEn, titleFr, titleEs etc for all the languages, and repeat this for all text columns. We would then adapt our code to use the appropriate field depending on the language selected. This feels a bit hacky, and also would lead to some very large tables. Also, if we wanted to add additional languages in the future it would be time consuming to add even more columns.
Use a lookup table
We could create a new table with the following format...
textId | languageId | content
-------------------------------
10 | EN | Car
10 | FR | Voiture
10 | ES | Coche
11 | EN | Bike
11 | FR | Vélo
We'd then adapt our products table to reference the appropriate textId for the title, summary, description and features instead of having the text stored in the product table. This seems much more elegant, but I can't think of a simple way of getting this data out of the database and onto the page without using complex SQL statements. Of course adding new languages in the future would be very simple compared to the previous option.
I'd be very grateful for any suggestions about the best way to achieve this! Is there any "best practice" guidance out there? Has anyone done this before?
In your case, I would recommend using two tables:
Product
-------------------------------
ProductID | Price | Stock
-------------------------------
10 | 10 | 15
ProductLoc
-----------------------------------------------
ProductID | Lang | Name | Description
-----------------------------------------------
10 | EN | Bike | Excellent Bike
10 | ES | Bicicleta | Excelente bici
This way you can use:
SELECT * FROM
Product LEFT JOIN ProductLoc ON Product.ProductID = ProductLoc.ProductID
AND ProductLoc.Lang = #CurrentLang
(Left join just in case there is no record for the current lang in the ProductLoc table)
It's not good idea just to add new columns to existing table. It will be really hard to add a new language in the feature. The lookup table is much more better but I think you can have problem with performance because number of translated records.
I think best solution is to have a shared table:
products: id, categoryid,
and same tables for every language
products_en, products_de: product_id (fk), title, price, description, ...
You will just select from the shared one and join table with your language. The advantage is that you can localize even the price, category, ...
I've setup a view in drupal that lists items like this:
IMAGE 1 | IMAGE 2 | IMAGE 3 | IMAGE 4
desc | desc | desc | desc
where "desc" is, you guessed it, a description of the node. What I need is to end up with something like this:
IMAGE 1 | IMAGE 2 | IMAGE 3 | IMAGE 4
desc | desc | desc | desc
EDIT | EDIT | EDIT | EDIT
ACTION | ACTION | ACTION | ACTION
Where EDIT goes to the edit page of the various nodes. Also, the ACTION signifies a button that I want to appear underneath the items that navigates to a page, let's call it http://www.mysite.com/action and takes the id as a parameter to end up with something like this: http://www.mysite.com/action/1.
I hope this all makes sense.
The pain in the ass way to solving this is to create a theme file views-view-NAME.tpl.php and manipulate the $rows variable. I just think there must be a better way and I'm obviously just missing something.
So, does anybody know how to do this?
You can add links and then style them as buttons (if you really need it to look like a button) by doing something like this:
Add the following fields to your view:
Node: Edit Link (this will take care of permissions for you, only displaying a link for users that have access to edit)
Node: Nid
In order to get that second field to be an arbitrary link containing the node ID, select the Output this field as a link option when configuring the field. In the Link path box, enter the desired link, something like this:
action/[nid]
or, you can use an absolute url
http://www.example.com/action/[nid]
For Drupal 8, I built the Views Any Route module, which lets you create buttons based on routes: https://www.drupal.org/project/views_any_route . The main use for the module is that access checking is included in the construction of the link, which would otherwise require a custom field, or Views Field View, etc.
In this case, if you use the Devel module, you can look up the "routes info" and find the correct route for a node path. You then create the Any Route button for that route, and pass the nid as a parameter (i.e. node={{ nid }}).