compound attribute in ezpublish content class - ezpublish

I am designing a content class in ezpublish 5 where i need a filed like rating in different categories. I want to give content editor an interface in admin panel where he can choose a category to rate from dropdown and then text field to put rating point (1-5).
How to achieve this in ezpublish5?

The Matrix data/fieldtype sounds like it's close to what you need.
It allows you to set a table of values with a set number of columns. The limitation here is that each field is a free text entry for users.
| Review | Rating | Notes |
|-------------------|-------------|--------------------|
| Customer Service | 5 | Friendly & polite |
| Quality of Food | 4 | Tasty & Plentiful |
| ... | ... | ... |
There is a symfony bundle available for the Matrix fieldtype to allow access to the data in the Symfony stack: https://github.com/ezcommunity/EzMatrixFieldTypeBundle.
Alternatively there is the option to create your own data/fieldtype: http://share.ez.no/learn/ez-publish/creating-datatypes-in-ez-publish-4 & https://doc.ez.no/display/EZP/eZ+Publish+5+Field+Type+Tutorial

Related

Ordering/Reordering the list based on a specific column which holds an order number in JPA

I'm using JPA and also I have a table like below structure:
|--------------|--------------------------------|
| ID | Title | OrderNumber |
|--------------|--------------|-----------------|
| 1 | Test | 0 |
|--------------|--------------|-----------------|
| 2 | Test2 | 1 |
|--------------|--------------|-----------------|
So, It's easy to order the list by the 'OrderNumber' in queries, but I've not found an appropriate way to update/set its value in reordering operation yet (Because I have an option in user-side to change the order of the list by drag and drop).
What is a suitable way to solve this problem without any store procedure in the database?

Cucumber - run same feature a number of times depending on records in a database

I have a cucumber feature that checks a website has processed payment files correctly (BACS,SEPA, FPS etc). The first stage of the process is to create the payment files which in-turn create expected result data in a database. This data is then used to validate against the payment processing website.
If I process one file, my feature works perfectly validating the expected results. Where I'm stuck is how I get the feature to run (n) number of times depending on the number of records/files that were originally processed.
I've tried an 'Around' hook using a record count iteration with no joy, can't see how I can fit it into an outline scenario and now think that perhaps a rake task to call the feature might work.
Any ideas would be greatly appreciated.
Here's a sample of the feature:
Feature: Processing SEPA Credit Transfer Files. Same Day Value Payments.
Background:
Given we want to test the "SEPA_Regression" scenario suite
And that we have processed a "SEPA" file from the "LDN" branch
And we plan to use the "ITA1" environment
Then we log in to "OPF" as a "SEPA Department" user
#feature #find_and_check_sepa_interchange #all_rows
Scenario: Receive SEPA Credit Transfer Files for branch
Given that we are on the "Payment Management > Interchanges" page
When I search for our Interchange with the following search parameters:
| Field Name |
| Transport Date From |
| Bank |
| Interchange Reference |
Then I can check the following fields for the given file in the "Interchanges" table:
| Field Name|
| Interchange Reference |
| Transport Date |
| File Name |
| File Format |
| Clearing Participant |
| Status |
| Direction |
| Bank |
When I select the associated "Interchange Id" link
Then the "Interchange Details" page is displayed
Update I've implemented nested steps for the feature so that I can call the database records first and feed each set of records (or at least the row id) into the main feature like so:
Feature
#trial_feature
Scenario: Validate multiple Files
Given we have one or more records in the database to process for the "SEPA_Regression" scenario
Then we can validate each file against the system
Feature steps:
Then(/^we can validate each file against the system$/) do
x = 0
while x <= $interchangeHash.count - 1
$db_row = x
# Get the other sets of data using the file name in the query
id = $interchangeHash[x]['id']
file_name = $interchangeHash[x]['CMS_Unique_Reference_Id']
Background.get_data_for_scenario(scenario, file_name)
steps %{
Given that we are on the "Payment Management > Interchanges" page
When I search for our Interchange with the following search parameters:
| Field Name |
| Transport Date From |
| Bank |
| Interchange Reference |
Then I can check the following fields for the given file in the "Interchanges" table:
| Field Name|
| Interchange Reference |
| Transport Date |
| File Name |
| File Format |
| Clearing Participant |
| Status |
| Direction |
| Bank |
When I select the associated "Interchange Id" link
Then the "Interchange Details" page is displayed
Seems a bit of a 'hack' but it works.
If you have batch processing software, then you should have several Given (setup) steps, 1 When (trigger) step, several Then (criteria) steps.
Given I have these SEPA bills
| sepa bill 1 |
| sepa bill 2 |
And I have these BAC bills
| bac bill 1 |
| bac bill 2 |
When the payments are processed
Then these sepa bills are completed
| sepa bill 1 |
| sepa bill 2 |
And I these bac bills are completed
| bac bill 1 |
| bac bill 2 |
It's simpler, easier to read what is supposed to be done, and can be expanded to more. The works should be done in the step definitions of setting up and verifying.

Category/Product Pageviews Magento

I run an ecommerce company which is made on Magento.
I need to find Category and Product wise page views and conversions for my website.
Google Analytics does not show me the Pageviews data for the said groups.
Is there a way to track the same in GA or some extension to do so.
We tried to use Jirafe, the data was right but it seems to run the cron every hour and would
at times use too many DB instances and thus eating into site bandwidth.
I've got a template that included a popular products widget for the homepage. While researching how to remove a product I didn't want in there, I stumbled up the table report_viewed_product_index which may or nay not be part of their template's code.
The people are "Templates Master" and the module which contains this code is "TM Highlight". The below query may not be perfectly exact, but at least corresponds to our "top 5" products widget.
<?
SELECT sfoi.sku, count(rvpi.product_id)
FROM
report_viewed_product_index rvpi
INNER JOIN
( SELECT DISTINCT sku, product_id FROM sales_flat_order_item ) as sfoi
ON sfoi.product_id=rvpi.product_id
GROUP BY rvpi.product_id
ORDER BY count(rvpi.product_id) DESC
LIMIT 0,10;
+------------+------------------------+
| sku | count(rvpi.product_id) |
+------------+------------------------+
| HM69.BLK | 11055 |
| FP-HUS | 3455 |
| 2VCOILS | 2829 |
| TB900 | 1920 |
| 460-1505 | 1396 |
| 2112-0061 | 1293 |
| JAMBNUTS | 1077 |
| VM520-110 | 1076 |
| TR200038PC | 1066 |
| 016-721 | 1008 |
+------------+------------------------+
?>

How do I keep Cognos from splitting my subgroups across pages?

I am reporting off of a cube into a crosstab with the results being summarized. For example:
| Val 1 | Val 2
----------------------------------------------------
Division 1 | Region 1 | Location 1 | 5.00 | 3.00
| |-----------------------------
| | Location 2 | 2.00 | 6.00
| |-----------------------------
| | Reg Sum | 7.00 | 9.00
|----------------------------------------
| Region 2 | Location 1 | 4.00 | 3.00
| |-----------------------------
| | Location 2 | 12.80 | 7.40
| |-----------------------------
| | Location 3 | 5.00 | 11.00
| |-----------------------------
| | Reg Sum | 21.80 | 21.40
|----------------------------------------
| Div Sum | 28.80 | 30.40
----------------------------------------------------
Division 2 | Region 1 | Location 1 | 3.00 | 12.85
etc...
Currently, Cognos is breaking the page in the middle of the Division 1/Region 2 subgroup. If the whole region subgroup (including summary) doesn't fit on the remainder of the page, I want it to go to the next page.
I've tried pagination at the region and location level. That has not given me the results I want. Any ideas as to how I can achieve this?
EDIT: Forgot to mention that this is Cognos 8.4.
well, a litle bit out-dated, but nevertheless here is what worked for me:
unlock
place a 1x1 table object inside the Regions cell
place the regions name inside the table object (just drag it inside
the table)
in the table's paginations properties deselect the option Allow row
contents to break across pages
you might also need to specify the height of the table object.
You can use Page breaks to achieve this.
In your example, click on Region data item. From Structure menu, click "Set Page Break using Master/Detail".
That will do the trick.
Please note, for crosstab and chart, report studio creates Page Break using Master/Detail relationship. If you were using List or repeater, then you could use the option of creating page break without Master/Detail relationship.
Please refer to IBM Infocenter for more information on Page Breaks and Page Sets. http://publib.boulder.ibm.com/infocenter/c8bi/v8r4m0/index.jsp?topic=/com.ibm.swg.im.cognos.c8bi.doc/welcome.html

DataMapper associates that depend on two columns

I have a table of products with attributes like SKU, Name, etc.
It seems like I need to have separate tables for each category of product due to the large variety of features depending on the category.
Say I have a table/class for boots, tools and hats
I'd like (unless there's a better way) to join/associate my products table to the other tables where appropriate (depending on category)?
Products Table
id | Name | SKU | Category(Table) | CategoryTableForeignKey
----------------------------------------------------------------------
1 | boot1 | 123 | Boots | 2
2 | knife1 | 345 | Tools | 42
-
Boots Table
id | product_id | Size | Width | Color | Sex
----------------------------------------------------------------------
2 | 1 | 9.5 | Wide | Olive | Male
-
Tools Table
id | product_id | length | Fixed | Coating | Etc
----------------------------------------------------------------------
42 | 2 | 4.5 | False | ... | ...
I'm not sure how to do this with DataMapper classes.
Ideally, I'd like to be able to:
my_boot = Boots.get(1)
my_boot.product.sku
Edit: dkubb pointed out a flaw in my code.
When you use has() what you're saying is that the foreign key is in the other model. If you want the foreign key to be in the table associated with the current model you want to use belongs_to.
class Product
include DataMapper::Resource
#descripe product properties ...
has n, :boots
end
Class Boot
include DataMapper::Resource
#describe boot properties ...
belongs_to :product
end
About DataMapper Associations: http://datamapper.org/docs/associations.html

Resources