CREATE OR REPLACE VIEW vBluesealProductNameNewList AS
  SELECT
    `pn`.`id`                  AS `id`,
    `pnt`.`productId`          AS `productId`,
    `pnt`.`productVariantId`   AS `productVariantId`,
    `phpc`.`productCategoryId` AS `category`,
    `pn`.`name`                AS `name`,
    `pn`.`langId`              AS `langId`,
    0                          AS `count`,
    p.qty                      AS qty
  FROM ((((`ProductName` `pn`
    JOIN `ProductNameTranslation` `pnt`
      ON (((`pn`.`translation` = `pnt`.`name`) AND (`pn`.`langId` = `pnt`.`langId`)))) JOIN `Product` `p`
      ON (((`pnt`.`productId` = `p`.`id`) AND (`pnt`.`productVariantId` = `p`.`productVariantId`)))) LEFT JOIN
    (`ProductHasProductCategory` `phpc`
      JOIN `ProductCategory` `pc` ON ((`phpc`.`productCategoryId` = `pc`.`id`)))
      ON (((`p`.`id` = `phpc`.`productId`) AND (`p`.`productVariantId` = `phpc`.`productVariantId`))))
    JOIN `ProductSku` AS `ps` ON `ps`.`productVariantId` = `p`.`productVariantId`)
  WHERE ((`pn`.`langId` = 1) AND (`pnt`.`langId` = 1) AND (`ps`.`stockQty` > 0) AND
         (`p`.`dummyPicture` NOT LIKE '%bs-dummy%')) AND `p`.`productStatusId` IN (5, 6, 11);

SELECT
  `pn`.`id`                AS `id`,
  `pnt`.`productId`        AS `productId`,
  `pnt`.`productVariantId` AS `productVariantId`,
  `pn`.`name`              AS `name`,
  `pn`.`langId`            AS `langId`,
  0                        AS `count`
FROM (((((`ProductName` `pn`
  JOIN `ProductNameTranslation` `pnt` ON (((`pn`.`name` = `pnt`.`name`) AND (`pn`.`langId` = `pnt`.`langId`)))) JOIN
  `Product` `p` ON (((`pnt`.`productId` = `p`.`id`) AND (`pnt`.`productVariantId` = `p`.`productVariantId`)))) JOIN
  `ProductSku` `ps` ON (((`ps`.`productId` = `p`.`id`) AND (`ps`.`productVariantId` = `p`.`productVariantId`)))) JOIN
  (`ProductHasProductCategory` `phpc`
    JOIN `ProductCategory` `pc` ON ((`phpc`.`productCategoryId` = `pc`.`id`)))
    ON (((`p`.`id` = `phpc`.`productId`) AND (`p`.`productVariantId` = `phpc`.`productVariantId`)))) JOIN
  `ProductStatus` ON ((`ProductStatus`.`id` = `p`.`productStatusId`)))
WHERE ((`pn`.`langId` = 1) AND (`pnt`.`langId` = 1) AND (`ps`.`stockQty` > 0) AND
       (NOT ((`p`.`dummyPicture` LIKE '%bs-dummy%'))) AND (`p`.`productStatusId` IN (5, 6, 11)))


SELECT
  `p`.`id` AS `productId`,
  `p`.`productVariantId`
FROM ((ProductNameTranslation AS `pn`
  JOIN Product AS `p` ON `p`.`productVariantId` = `pn`.`productVariantId`) JOIN `ProductStatus` AS `ps`
    ON `p`.`productStatusId` = `ps`.`id`)
WHERE `langId` = 1 AND `pn`.`name` = ? AND `ps`.`code` IN ('A', 'P', 'I') AND (`p`.`qty` > 0) AND
      (`p`.`dummyPicture` NOT LIKE '%bs-dummy%');
