NSP5 random images

GK User
Fri Dec 12, 2014 3:37 pm
Hi ...

How can I stop the random of the images.

I want to get only the first one of each item.

Best Regards

Goran
User avatar
Senior Boarder

teitbite
Sun Dec 14, 2014 10:19 pm
Hi

In NSP settings there is a panel to select which image should be displayed. Please tell me what type of article component are You using so I'll show You a screenshot where to change it.
User avatar
Moderator

GK User
Mon Dec 15, 2014 1:18 pm
Sorry for the incomplete information...

I am using the images from the hikashop products,

and I want the first picture of the product to be on the nsp.

Best Regards

Goran
MICROweb
User avatar
Senior Boarder

teitbite
Thu Dec 18, 2014 2:21 pm
Hi

I've just studied the code while module is picking image url form database and it is using an image with the biggest order number. You can change it in /data_sources/com_hikashop/model.php in code:

Code: Select all
      // third query
      $query_news3 = "SELECT
         `m`.`file_path` AS `image`,
         `m`.`file_ordering` AS `ordering`,
         `content`.`product_id` AS `id`
      FROM
         #__hikashop_product AS content
      LEFT JOIN
         #__hikashop_file AS `m`
         ON
         `m`.`file_ref_id` = `content`.`product_id`
      WHERE
         (".$sql_where2.")
         AND
         `m`.`file_type` LIKE 'product'
      ORDER BY
         `content`.`product_id` ASC,
         `m`.`file_ordering` DESC
      ";


to

Code: Select all
      // third query
      $query_news3 = "SELECT
         `m`.`file_path` AS `image`,
         `m`.`file_ordering` AS `ordering`,
         `content`.`product_id` AS `id`
      FROM
         #__hikashop_product AS content
      LEFT JOIN
         #__hikashop_file AS `m`
         ON
         `m`.`file_ref_id` = `content`.`product_id`
      WHERE
         (".$sql_where2.")
         AND
         `m`.`file_type` LIKE 'product'
      ORDER BY
         `content`.`product_id` ASC,
         `m`.`file_ordering` ASC
      ";
User avatar
Moderator


cron