Dropdown filtering boxes for website code parsing error

Hi, I am having some issues with drop-down menus meant for filtering all the products on my store page on wix. Not sure why its not working I’ve checked my code line by line, it’s driving me insane. Wondering if anyone can help and let me know where have I gone wrong? The only error I’m getting is at the end at line 132 parsing error ‘import’ and ‘export’ may only appear at the top wix.
I’d like the 4 dropdown boxes at the top to be able to filter results on page depending on dropdown box choice. 1st dropdown product type (PC, tablet, Cell phone, etc), 2nd dropdown brand (Apple, Samsung, atc…) 3rd dropdown series (iphone) 4th model. Only the first dropdown loads with page, the second loads after 1st dropdown is selected and enabled, and so on for the other dropboxes. dropdowns are connected to datasheet. I’ve double check typos or correct collection names and also fieldkeys. also checked the functions and export function. Any help would be much appreciated.
Here is the code:

import wixData from 'wix-data';

$w.onReady(function () {

    uniquedropdown1();

});

function uniquedropdown1() {

    wixData.query("Searchfield1")

        .limit(1000)

        .find()

        .then(results => {

            const uniqueTitles = getUniqueTitles(results.items);

            $w("#dropdown1").options = buildOptions(uniqueTitles);

        });

    function getUniqueTitles(items) {

        const titlesOnly = items.map(item => item.typ);

        return [...new Set(titlesOnly)];

    }

    function buildOptions(uniqueList) {

        return uniqueList.map(curr => {

            return { label: curr, value: curr };

            });

        }

    }

    

export function dropdown1_change(event, $w) {

        uniquedropdown2();

        $w("#dropdown2").enable();

    }

    function uniquedropdown2() {

        wixData.query("Searchfield1")

            .contains("znakaZariadenia", $w("#dropdown1").value)

            .limit(1000)

            .find()

            .then(results => {

                const uniqueTitles = getUniqueTitles(results.items);

                $w("#dropdown2").options = buildOptions(uniqueTitles);

            });

        function getUniqueTitles(items) {

            const titlesOnly = items.map(item => item.znakaZariadenia);

            return [...new Set(titlesOnly)];

        }

        function buildOptions(uniqueList) {

            return uniqueList.map(curr => {

                return { label: curr, value: curr };

            });

        }

    }

  export function collection_change(event, $w) {

        uniquedropdown3();

        $w("#dropdown3").enable();

    }

    function uniquedropdown3() {

        wixData.query("Searchfield1")

            .contains("sriaZariadenia", $w("#dropdown2").value)

            .limit(1000)

            .find()

            .then(results => {

                const uniqueTitles = getUniqueTitles(results.items);

                $w("#dropdown3").options = buildOptions(uniqueTitles);

            });

        function getUniqueTitles(items) {

            const titlesOnly = items.map(item => item.sriaZariadenia);

            return [...new Set(titlesOnly)];

        }

        function buildOptions(uniqueList) {

            return uniqueList.map(curr => {

                return { label: curr, value: curr };

            });

export function dropdown1_change(event) {

    // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4

    // Add your code for this event here: 

}

export function dropdown2_change(event) {

    // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4

    // Add your code for this event here: 

}

export function dropdown3_change(event) {

    // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4

    // Add your code for this event here: 

}

export function dropdown4_change(event) {

    // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4

    // Add your code for this event here: 

}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.