Access to existing database created for my site.

I created web site sophiafloraldesigns.net using WIX. It has database for products. How can I access this database using Corvid?

Are you trying to access the datasets in your Wix Editor?
https://support.wix.com/en/article/corvid-working-with-wix-data

Or through code itself.
https://www.wix.com/corvid/reference/wix-data.html
https://www.wix.com/corvid/reference/wix-dataset.html

You can find examples here too that you can open in your own editor.
https://www.wix.com/corvid/examples

Also, as you mention dataset for products, can we assume that you are talking about the Wix Stores app and its own collection of Products? If you are, then you can see the collections for Wix Stores here.
https://support.wix.com/en/corvid-by-wix/wix-stores-with-corvid

Along with the Wix Stores API here.
https://www.wix.com/corvid/reference/wix-stores.html
https://www.wix.com/corvid/reference/wix-stores-backend.html

You will also find examples for Wix Stores in the above linked examples section.
https://www.wix.com/corvid/examples?category=stores

Depending on what you are trying to achieve here, you can try searching the forum for previous posts too, as there will be plenty of older posts about working Wix Stores and with data and datasets etc.

Thank you. But I’ve tried to follow instructions provided in first link https://support.wix.com/en/article/corvid-working-with-wix-data
I see Site Structure on the left side but there is no DB icon in the Editor and also when I click New Collection link under Database + sign nothing happens.

If you have added Wix Stores to your website and published it, then you should be seeing the Wix Stores app own datasets underneath the Database tab in your site structure, you shouldn’t need to add your own datasets for it.


These are the Wix Stores app own collections that get added automatically when you add Wix Stores to your site as shown in this link from before.
https://support.wix.com/en/corvid-by-wix/wix-stores-with-corvid

Even though you have simply used the Wix Stores own product gallery with quick links on your pages, the products should still be in these datasets.
https://support.wix.com/en/article/customizing-your-wix-stores-product-quick-view

I put this code to my Shop page:

import wixData from “wix-data”;
$w.onReady(function () {
loadProducts();
});

function loadProducts() {

wixData.query(‘Store/Products’)
.find()
.then(res => {
console.log(“bla bla I love WIX”);
let options = [{“value”: ‘’, “label”: ‘All Products’}];
options.push(…res.items.map(product => {
return {“value”: product.title, “label”: product.title};
}));
//$w(‘#productGallery1’).push(options);
});

}

And when I preview it it says:

The Store/Products collection does not exist. You cannot work with a collection using the Data API before it is created in the Editor.

Also if I just have this code:

$w.onReady(function () {
console.log(“bla bla I love WIX”);
});

I do not see any log in the developer console:

Finally I found the way it works.

  1. I put this code to my Shop page:
    import wixData from “wix-data”;
    $w.onReady( function () {
    loadProducts();
    console.log(“Shop page loaded”);
    });
    function loadProducts() {
    wixData.query(‘Stores/Products’)
    .find()
    .then(res => {
    console.log(“Products found”);
    let options = [{“value”: ‘’, “label”: ‘All Products’}];
    options.push(…res.items.map(product => {
    console.log(product.name);
    return {“value”: product.name, “label”: [product.name};](product.name};
    }));
    });
    }
    2.)
    [}));](product.name};
    }));
    });
    }
    2.)
    [});](product.name};
    }));
    });
    }
    2.)
    [}](product.name};
    }));
    });
    }
    2.)
    [2.](product.name};
    }));
    });
    }
    2.) Saved edited page and published site.
  2. Launch site on page Shop and entered into debug console F12. There I can see:


Still curious why I can not see this log in dev mode when I preview the page?

Another problem: when I added this code:
function loadOrders() {
wixData.query(‘Stores/Orders’)
.find()
.then(res => {
console.log(“Orders found”);
let options = [{“value”: ‘’, “label”: ‘All Orders’}];
options.push(…res.items.map(order => {
console.log(order.number);
return {“value”: order.number, “label”: order.number};
}));
//$w(‘#productGallery1’).show(“a”, options);
});
}

I’m getting this:
Unhandled promise rejection Error: Permission denied: {“message”:“Read not permitted”,“details”:{}}.

Why?

Why I do not have Content Manager icon
on the left side of the Editor? I added Content Manager to the editor using ±>Content Manager->Add to site and nothing happened.

What part of the content manager can you not access?

https://support.wix.com/en/article/about-the-content-manager

For this error simply look in the Wix Stores collections that are being used.
https://support.wix.com/en/corvid-by-wix/wix-stores-with-corvid

With the Products collection it is setup for Anyone .
https://support.wix.com/en/article/corvid-wix-stores-products-collection-fields#permissions

Whereas when you use the Orders collection it is setup as Admin .
https://support.wix.com/en/article/corvid-wix-stores-orders-collection-fields#permissions

Hence why when your code is tested like this with both Products and Orders combined together…

import wixData from "wix-data";

$w.onReady(function () {
});

loadProducts();
console.log("Products loaded");

function loadProducts() {
wixData.query('Stores/Products')
.find()
.then(res => {
console.log("Products found");
let options = [{"value": '', "label": 'All Products'}];
options.push(...res.items.map(product => {
console.log(product.name);
return {"value": product.name, "label": product.name};
}));
});
}

loadOrders();
console.log("Orders loaded");

function loadOrders() {
wixData.query('Stores/Orders')
.find()
.then(res => {
console.log("Orders found");
let options = [{"value": '', "label": 'All Orders'}];
options.push(...res.items.map(order => {
console.log(order.number);
return {"value": order.number, "label": order.number};
}));
});
}

It will only work perfectly for you when you test it in the preview mode as you are logged in as Admin and can view both Products and Orders collections.

Whereas when you view it on the live site it will show you errors as you are not logged in as Admin, so you do not have the permissions to access Orders.

So, the only way that this would work on a live site is if it was only being viewed by the Admin of the website after they had logged in and the site knows that it is the Admin viewing that page.

Nobody else will be able to view Orders and they will always get the errors back.