SELECT
PCFV.id,
PCFV.value,
PCFV.slug,
COUNT(*) AS total_products
FROM product_custom_field_values PCFV
JOIN product_details PD
ON PD.product_custom_field_id = 30
AND CONCAT(',', PD.product_custom_field_value, ',') LIKE CONCAT('%,', PCFV.id, ',%')
JOIN products P
ON P.id = PD.product_id
AND P.status = 'Live'
AND pd.product_id IN (46,49,50,54,56,57,58,59,60,61,62,63,65,66,67,68,69,70,71,72,74,75,76,78,79,80,81,84,85,86,87,88,89,90,91,92,93,94,97,98,102,103,104,105,106,107,109,110,1655,1656,1657,1658,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,1671,1672,1674,1675,1678,1679,1682,1683,1684,1685,1686,1687,1688,1689,1690,1692,1693,1694,1695,1696,1697,1698,1699,1700,1702,1703,1704,1705,1706,1709,1710,1711,1712,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1728,1729,1730,1731,1732,1733,1734,1735,1737,1738,1739,1740,1742,1743,1744,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1773,1774,1775,1776,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1791,1792,1793,1794,1795,1798,1799,1800,1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,1813,1815,1816,1817,1819,1820,1821,1822,1824,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,1837,1838,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,1851,1852,1853,1855,1856,1858,1859,1860,1861,1862,1863,1864,1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1894,1895,1896,1897,1899,1900,1901,1902,1903,1904,1906,1907,1909,1911,1912,1914,1915,1916,1917,1918,1919,1920,1921,1923,1924,1925,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1941,1942,1943,1944,1945,1946,1948,1949,1950,1951,1952,1953,1954,1955,1956,1958,1959,1960,1962,1963,1964,1965,1966,1967,1968,1971,1972,1973,1974,1975,1976,1977,1979,1980,1981,1982,1983,1985,1986,1988,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2018,2019,2023,2025,2026,2027,2028,2029,2030,2031,2032,2033,2035,2040,2041,2042,2043,2044,2046,2047,2048,2050,2051,2052,2053,2055,2056,2057,2059,2060,2061,2062,2063,2064,2065,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2078,2079,2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2094,2095,2096,2097,2098,2099,2100,2101,2102,2103,2104,2108,2109,2110,2111,2112,2113,2115,2116,2117,2118,2119,2120,2121,2122,2123,2124,2125,2126,2127,2128,2129,2131,2132,2133,2134,2135,2136,2137,2138,2139,2140,2141,2142,2143,2145,2149,2151,2152,2153,2154,2155,2156,2157,2158,2159,2160,2161,2163,2164,2165,2166,2167,2168,2169,2170,2171,2172,2173,2174,2175,2176,2177,2178,2179,2180,2181,2182,2183,2184,2186,2188,2189,2191,2192,2195,2196,2197,2198,2199,2200,2201,2202,2204,2205,2206,2207,2208,2210,2211,2212,2213,2214,2215,2216,2217,2218,2219,2220,2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2281,2307,2333)
WHERE
PCFV.value != ''
AND PCFV.product_custom_field_id = 30
GROUP BY PCFV.id
ORDER BY PCFV.orders, PCFV.value
Warning (512): Could not render cell - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pd.product_id' in 'on clause' [/var/www/vhosts/eurowines.co.uk/httpdocs/vendor/cakephp/cakephp/src/Database/Statement/MysqlStatement.php, line 39] [CORE/src/View/Cell.php, line 262]Code Context } catch (Exception $e) {
trigger_error(sprintf('Could not render cell - %s [%s, line %d]', $e->getMessage(), $e->getFile(), $e->getLine()), E_USER_WARNING);
$e = object(PDOException) {
errorInfo => [
(int) 0 => '42S22',
(int) 1 => (int) 1054,
(int) 2 => 'Unknown column 'pd.product_id' in 'on clause''
]
[protected] message => 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pd.product_id' in 'on clause''
[protected] code => '42S22'
[protected] file => '/var/www/vhosts/eurowines.co.uk/httpdocs/vendor/cakephp/cakephp/src/Database/Statement/MysqlStatement.php'
[protected] line => (int) 39
}Cake\View\Cell::__toString() - CORE/src/View/Cell.php, line 262
include - APP/Template/Element/Front/product_sidebar_tabs.ctp, line 49
Cake\View\View::_evaluate() - CORE/src/View/View.php, line 1419
Cake\View\View::_render() - CORE/src/View/View.php, line 1380
Cake\View\View::_renderElement() - CORE/src/View/View.php, line 1855
Cake\View\View::element() - CORE/src/View/View.php, line 783
include - APP/Template/Products/index.ctp, line 158
Cake\View\View::_evaluate() - CORE/src/View/View.php, line 1419
Cake\View\View::_render() - CORE/src/View/View.php, line 1380
Cake\View\View::render() - CORE/src/View/View.php, line 880
Cake\Controller\Controller::render() - CORE/src/Controller/Controller.php, line 796
Cake\Http\ActionDispatcher::_invoke() - CORE/src/Http/ActionDispatcher.php, line 126
Cake\Http\ActionDispatcher::dispatch() - CORE/src/Http/ActionDispatcher.php, line 94
Cake\Http\BaseApplication::__invoke() - CORE/src/Http/BaseApplication.php, line 235
Cake\Http\Runner::__invoke() - CORE/src/Http/Runner.php, line 65
Cake\Routing\Middleware\RoutingMiddleware::__invoke() - CORE/src/Routing/Middleware/RoutingMiddleware.php, line 162