Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Modify splitPageResults Class to limit no. of records


Tejas H.

Recommended Posts

Hello,

I would like to know that if it's possible to limit the no. of records using splitPageResults class.

For example, On my store, I have 100 special products.
But i want to show only 50 special products from it.

When I use splitPageResults class, it's showing all 100 products.

How can i limit that to 50 products?

I truly appreciate any help.

Thanks
Tejas

Link to comment
Share on other sites

Hi @YePix

That isn't working and break the sql query.

After adding the limit to the query, it will be like below after using splitPageResults:

select p.products_id, pd.products_name, pd.products_description, p.products_price, p.products_tax_class_id, p.products_image from products p, products_description pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '1' order by p.products_ordered desc limit 20 limit 0, 15

Notice there are two limits in the query.

One from the main query and one that is generated from splitPageResults class.

Link to comment
Share on other sites

select p.products_id, pd.products_name, pd.products_description, p.products_price, p.products_tax_class_id, p.products_image from products p, products_description pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '1' order by p.products_ordered limit 20

Link to comment
Share on other sites

You are not getting my point.

I am using splitPageResults class for pagination and wants to limit the total records.

 

Here is the code that i am using:

$bestsellers_query_raw = "select p.products_id, pd.products_name, pd.products_description, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' order by p.products_ordered desc";

$bestsellers_split = new splitPageResults($bestsellers_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

How can i limit the no. of total records and with pagination?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...