I want to remove the pagination limit or set something called show all or show all records
since when i click the export button it limits my records so , i want to show all the records that are available ,So that in one click i can export all the records. how to do this?
The limit options in the dropdown are set in classes/controller/AdminController.php:
/** #var array Number of results in list per page (used in select field) */
protected $_pagination = array(20, 50, 100, 300, 1000);`
The default pagination limit (on first load) is defined directly below:
/** #var int Default number of results in list per page */
protected $_default_pagination = 50;
You can change this variable by overriding AdminController, you can read more about overriding files in PrestaShop here:
http://doc.prestashop.com/display/PS16/Overriding+default+behaviors#Overridingdefaultbehaviors-Overridingaclass
Related
I need a load more button to control the repeater shown content.
Here is my steps in the back end after load more button was clicked:
Repeater bind data (Full data/All rows).
Keep the maximum items count (static) from the repeater.
Set total row to show (static) + 1 and initialize the value to select top N row as the limit.
Repeater bind data again (The amount to show only).
Check if repeater items count is less than maximum items count, if not then hide the load more button.
Suppose these steps can give me the expected output?
//Declaration
public static int max = 0;
public static int totalShow = 0;
//SetupControl()
if(!IsPostBack){
rptItems.ClassName = "Blog";
rptItems.Path = "/Shared/%"
rptItems.DataBind();
max = rptItems.Items.Count();
}
//This part is put under a new function
totalShow += 1;
rptItems.SelectTopN = totalShow;
rptItems.DataBind();
lbnLoadMore.Visible = rptItems.Items.Count() < max;
Besides, I'm confusing about the functions as shown below:
Both are from the class CMSRepeater, what's the different? Which one should I use in order to set the limits?
Using static members is definitely not a good approach. Their values would be shared by all users of the application. There are better ways of storing user-specific data:
session (server-side)
JS (client-side) and passing them to the server via query string or hidden field
Regarding TopN and SelectTopN, they do the same thing. It's probably because of backward compatibility.
From the algorithmical point of view, there's no need to bind data multiple times nor to make more than one round-trip to the database. You just need to initialize the datasource/repeater with correct values.
I'd recommend you reading the following articles to get some inspiration:
Turn a Kentico repeater web part into an infinite scroll / lazy loader by Laura Frese
Dynamic jQuery AJAX viewer by Jan Hermann
I need to extend Shopware variants models in order to add some custom attributes such as the type of metal,the type of stone a jewel, which is the base article.
These attributes will be used both in backend and frontend.
How can I do that? Thanks
Extending the Shopware core model itself is not possible at all. Depending on what specific model you are trying to extend there would be two different ways for some workaround:
If its the article itself that you want to extend you could use the custom attribute fields as described here: http://community.shopware.com/Anlegen,-Anpassen-und-Ausgabe-von-Artikel-Attributen_detail_1208.html
Another way would be to write a plugin where you create attribute fields by code on plugin install(). This is only possible on entities that do have an attribute table which belongs to the entity itself. For example s_order and s_order_attributes
For the second way create a method in your plugin's Bootstrap.php like the following and call the method in the plugin's install() method:
public function installOrderAttributes()
{
Shopware()->Models()->addAttribute(
's_order_attributes',
'ordermod',
'Random1',
'DECIMAL(12,4)',
false,
0.0000);
Shopware()->Models()->addAttribute(
's_order_attributes',
'ordermod',
'Random2',
'DECIMAL(12,4)',
false,
0.0000);
$metaDataCacheDoctrine = Shopware()->Models()->getConfiguration()->getMetadataCacheImpl();
$metaDataCacheDoctrine->deleteAll();
Shopware()->Models()->generateAttributeModels(array('s_order_attributes'));
}
The addAttribute() function in /engine/Shopware/Components/Model/ModelManager.php has the following signature:
/**
* Shopware helper function to extend an attribute table.
*
* #param string $table Full table name. Example: "s_user_attributes"
* #param string $prefix Column prefix. The prefix and column parameter will be the column name. Example: "swag".
* #param string $column The column name
* #param string $type Full type declaration. Example: "VARCHAR( 5 )" / "DECIMAL( 10, 2 )"
* #param bool $nullable Allow null property
* #param null $default Default value of the column
* #throws \InvalidArgumentException
*/
public function addAttribute($table, $prefix, $column, $type, $nullable = true, $default = null);
Hope this will help.
Kind regards!
I am getting records min and max 1000 records at a time. if i am keeping this way to fetch record , My program takes long time to retrieve. And also i don't need 1000 records in certain situation.
I have already tried in this way .
Setup -> Integration -> Web Services Preferences
Are there any other alternate possibilities to mention the page size in GUI mode or RESTlet [like in filter or search] ?
Setup -> Integration -> Web Services Preferences ,has nothing to do with the search result size
You can use nlapiCreateSearch() to limit search results
var search = nlapiCreateSearch(RECORD_TYPE, FILTERS, COLUMNS);
var results = search.runSearch();
var records = results.getResults(0, (MAX < 1000? MAX: 1000) );
var component = getComponent("dvwContent");
return component.getRowCount() + " documents have been found";
If I'm placing this code into a computed value outside of a filtered dynamic view (referred to by "dvwContent"), it should return me the number of entries found, referring to this question & answer: Count entries in XPages view
If the number of hits exceeds the page display limit, it is giving me the number of filled rows on the page + 2. So if I display 25 lines per page, it tells me that "27 documents have been found" (if I display 50 docs, it tells me 52) - even if there are a lot more pages. It works correctly if there are less hits than the page display limit.
Does anybody have a solution for displaying/counting the correct number of hits?
As Stefan mentioned in his comment .getRowCount() refers to the rows visible on the page. From what I get you're interested in the entries of the view rather than the rows shown by the redering component.
One option that comes to my mind would be to access the viewEntryCollection object through the Domino view in question and then get the entry count from that:
var vw=database.getView("dvwContent");
var filter=["someFilter"];
var vec=vw.getAllEntriesByKey(filter, true);
return vec.getCount().toString() + " documents have been found";
I have a SharePoint list column of type 'Single line of text'. Out of the box SharePoint only provides the ability to display a 'Count' total for this column type. I would like to be able to perform a custom aggregation on the data (specifically to sum numeric data held as text to overcome this deficiency).
I have found examples for doing something similar for calculated columns using XSLT and Javascript but I believe that both of these approaches fail where the data is paginated (only aggregating the subset of the list content displayed on screen).
I want to retain the functionality of the ListViewWebPart (rendering, sorting, filtering, view definition, action menus etc.) but add this functionality. How can I do this?
The only things you can do with totals are:
Average; Count; Max; Min; Sum; Standard Deviation; Variance
Not sure how to calculate anything else.
I've not had a chance to fully test it but this is the best I could come up with:
Create a WebPart which contains two controls:
A ViewToolBar with the context of the list/view to be displayed
A Literal containing the rendered HTML of the view to be displayed
This will then render as the original list/view.
On rendering the WebPart, get the items from the view, specifying the RowLimit as the maximum value so that all items in are retrieved (not just the first page).
Iterate over the items, calculating the total in a suitable data type to retain precision.
Render the total as a hidden value in the HTML and overwrite the rendered Count total with Javascript such as by the method described here.
A rough sketch of the code:
public sealed class TextAggregatingWebPart : WebPart {
protected override void CreateChildControls() {
base.CreateChildControls();
var web = SPContext.Current.Web;
var list = web.Lists[SourceList];
var view = list.Views[ViewOfSourceList];
var toolbar = new ViewToolBar();
var context = SPContext.GetContext(
Context, view.ID, list.ID, SPContext.Current.Web);
toolbar.RenderContext = context;
Controls.Add(toolbar);
var viewHtml = new Literal {Text = view.RenderAsHtml()};
Controls.Add(viewHtml);
}
protected override void Render(HtmlTextWriter writer) {
EnsureChildControls();
base.Render(writer);
var web = SPContext.Current.Web;
var list = web.Lists[SourceList];
var view = list.Views[ViewOfSourceList];
var items = list.GetItems(new SPQuery(view) {RowLimit = uint.MaxValue});
foreach (SPItem item in items) {
// Calculate total
}
// Render total and Javascript to replace Count
}
}
Note that this doesn't solve the problem with the Modify View screen only showing Count as a total for text columns. Also there is a possibility that changes to the list between the initial rendering by the view and the retrieval of the items for aggregation could produce discrepancies between the total and the displayed items.