Skip to content

Commit 3661080

Browse files
committed
Changed product model getContent method table alias to product
1 parent 50f66fc commit 3661080

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

app/sql/mysqli/product.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
CREATE PROCEDURE getContent(
99
IN product_id INT,
1010
IN status INT,
11-
IN slug CHAR,
11+
IN slug CHAR,
1212
OUT fetch_all,
1313
)
1414
BEGIN

app/sql/pgsql/product.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
CREATE PROCEDURE getContent(
99
IN product_id INT,
1010
IN status INT,
11-
IN slug CHAR,
11+
IN slug CHAR,
1212
OUT fetch_all,
1313
)
1414
BEGIN
1515

16-
SELECT _.product_id,_.slug,_.name,_.meta_keywords,_.meta_description,_.language_id,product.template,language.code,language.code as array_key
16+
SELECT product.*, _.product_id,_.slug,_.name,_.meta_keywords,_.meta_description,_.language_id,product.template,language.code,language.code as array_key
1717
FROM product_content AS _
1818
LEFT JOIN language ON (language.language_id = _.language_id)
1919
LEFT JOIN product ON (product.product_id = _.product_id)
@@ -29,8 +29,8 @@
2929
AND _.product_id = (SELECT product_id FROM product_content WHERE slug = :slug LIMIT 1)
3030
END @IF
3131

32-
@IF isset(:product_id)
33-
THEN
34-
AND _.product_id = :product_id
32+
@IF isset(:product_id) && :product_id > 0
33+
THEN
34+
AND _.product_id = :product_id
3535
END @IF
3636
END

app/sql/sqlite/product.sql

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
CREATE PROCEDURE getContent(
99
IN product_id INT,
1010
IN status INT,
11-
IN slug CHAR,
11+
IN slug CHAR,
1212
OUT fetch_all,
1313
)
1414
BEGIN
1515

16-
SELECT _.product_id,_.slug,_.name,_.meta_keywords,_.meta_description,_.language_id,product.template,language.code,language.code as array_key
16+
SELECT product.*, _.product_id,_.slug,_.name,_.meta_keywords,_.meta_description,_.language_id,product.template,language.code,language.code as array_key
1717
FROM product_content AS _
1818
LEFT JOIN language ON (language.language_id = _.language_id)
1919
LEFT JOIN product ON (product.product_id = _.product_id)
2020
WHERE 1 = 1
2121

22-
@IF isset(:status)
22+
@IF isset(:status)
2323
THEN
24-
AND product.status = :status
24+
AND product.status = :status
2525
END @IF
2626

2727
@IF isset(:slug) && !(isset(:product_id) && :product_id)

0 commit comments

Comments
 (0)