top of page

Filter my Phones

CLOSE.png

Filter

Find

Best-Price

12345

CODE
DATABASE

DATABASE

CLOSE.png
001.png

CODE

CLOSE.png

import wixData from 'wix-data';


 

$w.onReady(function () {

    

    $w('#STAG1').onChange(()=>{

        let selectedTags = $w("#STAG1").value

        hide_all_Stags()

        console.log(selectedTags)

        console.log(selectedTags.length)

        

        for (var i = 0; i < selectedTags.length; i++) {

            console.log(i)

            if (selectedTags[i] === "Sony")         {$w("#selectionTags2").show(), console.log("Sony found in the Array")} else {$w("#selectionTags2").hide()}

            

            if (selectedTags[i] === "Samsung")      {$w("#selectionTags3").show(), console.log("Samsung found in the Array")} else {$w("#selectionTags3").hide()}

            if (selectedTags[i] === "LG")           {$w("#selectionTags4").show(), console.log("LG found in the Array")} else {$w("#selectionTags4").hide()}

            console.log(selectedTags[i])

        //.......

        //.......

        //.......

        //.......

        //.......

        //.......

        }

    })

})


 

function hide_all_Stags (parameter) {

    console.log("All tag-menus hided")

    {$w("#selectionTags2").hide;}

    {$w("#selectionTags3").hide;}

    {$w("#selectionTags4").hide;}

}

 

export function dropdown1_change(event) {$w('#BTNfind').label = "Find" + $w('#dropdown1').value}

export function BTNfind_click(event) {start_FilterProzess($w('#dropdown1').value)}


 

export function STAG1_change(event) {

    let selectedTags = $w("#STAG1").value

    console.log(selectedTags)

    let filter = wixData.filter();

    if (selectedTags) {

        filter = filter.hasSome("tags", selectedTags);

        console.log(selectedTags.length)

    }

    $w('#dataset1').setFilter(filter);

}

 

function start_FilterProzess (VALUE) {

 

    // FIRST-PROCESS to FIND ----> "Best-Price"

    if (VALUE === "Best Price"){console.log("Best-Price Search-Process activated !")

        $w("#dataset1").onReady( () => {

            $w("#dataset1").getItems(0, $w("#dataset1").getTotalCount())

            .then( (result) => {

                let items = result.items;

                let totalCount = result.totalCount;

                console.log (items)

                console.log(totalCount)

 

                let bestPrice = 1000

                for (var i = 0; i < totalCount; i++) {

                    if (items[i].price < bestPrice) {bestPrice=items[i].price}

                }

                console.log("bestPrice = " + bestPrice)

                $w('#GRPbestprice').show("FadeIn")

                $w('#TXTprice').text = bestPrice.toString()

            } )

            .catch( (err) => {

                let errMsg = err.message;

                let errCode = err.code;

            } );

        } );

    }

 

    // SECOND-PROCESS to FIND ----> "Newest-Model"

 

    if (VALUE === "Newest Model"){console.log("Newest-Model Search-Process activated !")}

}

google-pixel-4-7-600x460.jpg

Motorola

Memory

128GB

Processor

Price

199.99

GO
google-pixel-4-7-600x460.jpg

Sony

Memory

128GB

Processor

Price

249.99

GO
google-pixel-4-7-600x460.jpg

Google

Pixel-4

Memory

64GB

Processor

Price

555

GO
google-pixel-4-7-600x460.jpg

HTC

Memory

128GB

Processor

Price

329.99

GO
google-pixel-4-7-600x460.jpg

LG

G7-ThinQ

Memory

512GB

Processor

Price

333

GO
google-pixel-4-7-600x460.jpg

Huawai

Memory

64GB

Processor

Price

289.99

GO
google-pixel-4-7-600x460.jpg

Xiaomi


PNGWave
Xiaomi Mi 8 4G

Memory

256GB

Processor

Snap-Dragon

Price

222

GO
google-pixel-4-7-600x460.jpg

Apple

Memory

128GB

Processor

Price

650

GO
google-pixel-4-7-600x460.jpg

Ericsson

Memory

256GB

Processor

Price

249.99

GO
google-pixel-4-7-600x460.jpg

Nokia

Memory

64GB

Processor

Price

189.99

GO
google-pixel-4-7-600x460.jpg

Samsung

S8

Memory

64GB

Processor

Exynoss-8895

Price

399

GO
bottom of page