Where is the query located?
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
Go to admin - system - settings - store - edit - Default Items Per Page (Catalog)
Here you can set the number.
If you are on version 2.2.0.0 or higher then
Go to admin - extension - themes - store - edit - Default Items Per Page (Catalog)
Here you can set the number.
Opencart Extensions | Professional opencart support | Support Ticket | support@cartbinder.com
imdevlper18 wrote:If you are on version 2.1.0.2 or lowere then
Go to admin - system - settings - store - edit - Default Items Per Page (Catalog)
Here you can set the number.
If you are on version 2.2.0.0 or higher then
Go to admin - extension - themes - store - edit - Default Items Per Page (Catalog)
Here you can set the number.
please read my question carefully,your answer is not to my question.
It is not about per page,it is about select limit number of products from database.
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
As i understand, but i said above based on this line.I mean there is no way that someone would browse 1000 products therefore large amount of records only slowing things down
See when query is made all products are not called from database, but only part of it are called. So slowing things down is never going to happen. If you are showing limited number of products per page to your customers.
Opencart Extensions | Professional opencart support | Support Ticket | support@cartbinder.com
do you know how to do it?imdevlper18 wrote:As i understand, but i said above based on this line.I mean there is no way that someone would browse 1000 products therefore large amount of records only slowing things down
See when query is made all products are not called from database, but only part of it are called. So slowing things down is never going to happen. If you are showing limited number of products per page to your customers.
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
You can follow instructions mentioned in first post.
Opencart Extensions | Professional opencart support | Support Ticket | support@cartbinder.com
please don't answer to my question again,your English is too bad to understand my question.imdevlper18 wrote:If you show limited products per page, then page will load fast.
You can follow instructions mentioned in first post.
if it is as what you said,i will not post a question here.
For example, I have 1000 products in category N, but I want to limit the amount of product that are shown to 100 and I want other products to be hidden. (I mean there is no way that someone would browse 1000 products therefore large amount of records only slowing things down)
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
it is about not to select all the products from database per category.
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
Perhaps you learn to read and check the queries in product-model.
Products / page set limit in query. There are no more products loaded than the value set in limit ( limit is product / page )
Code: Select all
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
Just wondering why you would limit your sales this way?chongshengdz wrote:it is not about products per page.
it is about not to select all the products from database per category.
If you don't want to show more than 100 products per category, maybe you should rethink your categories creating more of them or perhaps divide your products by different niches across multiple stores using multistores. I mean why add more products if you aren't going to let a customer see and buy them??
Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.
pprmkr wrote:Solution is already given twice!
Perhaps you learn to read and check the queries in product-model.
Products / page set limit in query. There are no more products loaded than the value set in limit ( limit is product / page )
Code: Select all
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
please read my question twice before answering my question.
it is really not about setting products per page.
if it is so,i won't post a question here,it is really simple.
please read my question again below.
For example, I have 1000 products in category N, but I want to limit the amount of product that are shown to 100 and I want other products to be hidden. (I mean there is no way that someone would browse 1000 products therefore large amount of records only slowing things down)
Where is the query located?
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
labeshops wrote:Just wondering why you would limit your sales this way?chongshengdz wrote:it is not about products per page.
it is about not to select all the products from database per category.
If you don't want to show more than 100 products per category, maybe you should rethink your categories creating more of them or perhaps divide your products by different niches across multiple stores using multistores. I mean why add more products if you aren't going to let a customer see and buy them??
because if you have 50000 products in a category,the load time will be very slow.
so need to limit it to speed up the category load time and only show part of the products.
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
What you might be referring to is the Pagination range that splits the product results into separate pages based on the over-limited quantity of products . The codes you are looking for by each categories would be located in the catalog/controller/product/category.php file where:chongshengdz wrote:pprmkr wrote:Solution is already given twice!
Perhaps you learn to read and check the queries in product-model.
Products / page set limit in query. There are no more products loaded than the value set in limit ( limit is product / page )
Code: Select all
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
please read my question twice before answering my question.
it is really not about setting products per page.
if it is so,i won't post a question here,it is really simple.
please read my question again below.
For example, I have 1000 products in category N, but I want to limit the amount of product that are shown to 100 and I want other products to be hidden. (I mean there is no way that someone would browse 1000 products therefore large amount of records only slowing things down)
Where is the query located?
Code: Select all
$pagination = new Pagination();
$pagination->total = $product_total;
$pagination->page = $page;
$pagination->limit = $limit;
$pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');
$data['pagination'] = $pagination->render();
$data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));
// http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html
if ($page == 1) {
$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], true), 'canonical');
} elseif ($page == 2) {
$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], true), 'prev');
} else {
$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page - 1), true), 'prev');
}
if ($limit && ceil($product_total / $limit) > $page) {
$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), true), 'next');
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
straightlight wrote:What you might be referring to is the Pagination range that splits the product results into separate pages based on the over-limited quantity of products . The codes you are looking for by each categories would be located in the catalog/controller/product/category.php file where:chongshengdz wrote:pprmkr wrote:Solution is already given twice!
Perhaps you learn to read and check the queries in product-model.
Products / page set limit in query. There are no more products loaded than the value set in limit ( limit is product / page )
Code: Select all
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
please read my question twice before answering my question.
it is really not about setting products per page.
if it is so,i won't post a question here,it is really simple.
please read my question again below.
For example, I have 1000 products in category N, but I want to limit the amount of product that are shown to 100 and I want other products to be hidden. (I mean there is no way that someone would browse 1000 products therefore large amount of records only slowing things down)
Where is the query located?
is already handled and re-worked into the Opencart v2.2.0.0 release with the previous and next page sessions.Code: Select all
$pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], true), 'canonical'); } elseif ($page == 2) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], true), 'prev'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page - 1), true), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), true), 'next'); }
You guy is trying to misunderstand my question.
$pagination->total = $product_total = 1000; # is what i need,but the category page still loads slow.
i need a better solution.
i need something like this select * from table order by product_id desc limit 1000;
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
please get out of here since you are not willing to help.straightlight wrote:You can look for an extension on the site that would match your needs. If you are unable to find any results, you can always post a new topic in the commercial support forum to get this done as a custom job.
if i can find an extension,i will not post a question here.
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
1 quick query counts total records in table with given filter ( category, searchstring or tag ):chongshengdz wrote: $pagination->total = $product_total = 1000; # is what i need,but the category page still loads slow.
Code: Select all
$sql = "SELECT COUNT(DISTINCT p.product_id) AS total";
Next query gets restricted amount of records with the same filter but with start and limit when needed.chongshengdz wrote: i need a better solution.
i need something like this select * from table order by product_id desc limit 1000;
For example:
- table holds 175000 records
- 5000 products in category
- limit / page is set to 15 ( default )
- start = 0 because page = 1
Code: Select all
$sql = "SELECT p.product_id, (SELECT AVG(rating) AS tot ....
....
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
Queries can be found in catalog/model/catalog/product.php.
Try it yourself in phpMyAdmin:
- select database
- select tab SQL
- enter "SELECT COUNT(DISTINCT product_id) AS total FROM oc_product"
- study result
- Then enter SQL "SELECT * FROM oc_product LIMIT 0,15"
- study result
What did you see?
There are may tips out there regarding speeding up database. From MyISAM to InnoDB, adding indexes and more ...
so how to do it?pprmkr wrote:1 quick query counts total records in table with given filter ( category, searchstring or tag ):chongshengdz wrote: $pagination->total = $product_total = 1000; # is what i need,but the category page still loads slow.Returns 1 valueCode: Select all
$sql = "SELECT COUNT(DISTINCT p.product_id) AS total";
Next query gets restricted amount of records with the same filter but with start and limit when needed.chongshengdz wrote: i need a better solution.
i need something like this select * from table order by product_id desc limit 1000;
For example:
- table holds 175000 records
- 5000 products in category
- limit / page is set to 15 ( default )
- start = 0 because page = 1
Returns 15 recordsCode: Select all
$sql = "SELECT p.product_id, (SELECT AVG(rating) AS tot .... .... $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
Queries can be found in catalog/model/catalog/product.php.
Try it yourself in phpMyAdmin:
- select database
- select tab SQL
- enter "SELECT COUNT(DISTINCT product_id) AS total FROM oc_product"
- study result
- Then enter SQL "SELECT * FROM oc_product LIMIT 0,15"
- study result
What did you see?
There are may tips out there regarding speeding up database. From MyISAM to InnoDB, adding indexes and more ...
where to change the code?
Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet
I am very sorry if my post is not clear.
Perhaps you should read it again!
- I told you where to find the queries.
- I asked you to do 2 little tests and post your findings.
- I added comment about speeding up database.
Users browsing this forum: Google [Bot] and 184 guests