Question: Urgent In Product List Show 10 Product By Default

Urgent In Product List Show 10 Product By Default

Hi sir You are application work greate but i have only one issue I have more then 3000 products and when I load product list page it load all product (3000) and page took five min t

AA

abdul aamer

Asked
Hi sir
You are application work greate but i have only one issue
I have more then 3000 products and when I load product list page it load all product (3000) and page took five min to load
I want load only 10 product by default please help how can i achive this

I have php developer you can explain me technical details salso

Thank you
  • MS

    Mian Saleem

    Answered
    Hello,

    You are not suggested to load all the products once. It need heavy work on your server and the on local machine.

    If you want to check, you can check the query time as we can only improve that other all are dependent on the server and machine.

    ```sql
    SELECT
    sma_products.id AS productid,
    sma_products.image AS image,
    sma_products.code AS code,
    sma_products.name AS name,
    sma_brands.name AS brand,
    sma_categories.name AS cname,
    cost AS cost,
    price AS price,
    COALESCE(quantity, 0) AS quantity,
    sma_units.code AS unit,
    '' AS rack,
    alert_quantity
    FROM
    `sma_products`
    LEFT JOIN `sma_categories` ON `sma_products`.`category_id` = `sma_categories`.`id`
    LEFT JOIN `sma_units` ON `sma_products`.`unit` = `sma_units`.`id`
    LEFT JOIN `sma_brands` ON `sma_products`.`brand` = `sma_brands`.`id`
    GROUP BY
    `sma_products`.`id`
    ORDER BY
    `code` ASC,
    `name` ASC
    LIMIT 10
    ```

    Thank you
  • Login to Reply