{"id":7872,"date":"2024-03-15T14:00:00","date_gmt":"2024-03-15T14:00:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=7872"},"modified":"2024-03-15T14:00:00","modified_gmt":"2024-03-15T14:00:00","slug":"struktura-woocommerce-databaze","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/struktura-woocommerce-databaze\/","title":{"rendered":"Struktura WooCommerce datab\u00e1ze"},"content":{"rendered":"\n

Ned\u00e1vno byl na blogu aktualizov\u00e1n \u010dl\u00e1nek o struktu\u0159e WordPressu<\/a>, kter\u00fdm by bylo vhodn\u00e9 nejprve za\u010d\u00edt, abychom se nejd\u0159\u00edve dok\u00e1zali orientovat v samotn\u00e9m WordPressu.<\/p>\n\n\n\n

Dnes si uk\u00e1\u017eeme p\u0159ehled o struktu\u0159e WooCommerce datab\u00e1ze, kter\u00fd m\u016f\u017ee komukoliv pracuj\u00edc\u00edm s Woo p\u0159ij\u00edt vhod. Pro ostatn\u00ed m\u016f\u017ee poslou\u017eit alespo\u0148 k pochopen\u00ed z\u00e1kladn\u00edch operac\u00ed v datab\u00e1zi.<\/p>\n\n\n\n

Zjednodu\u0161en\u00fd diagram WooCommerce datab\u00e1ze s aktivn\u00edm HPOS<\/strong>.<\/p>\n\n\n\n

\"\"<\/a><\/figure>\n\n\n\n

Jak z\u00edskat p\u0159\u00edstup k WooCommerce datab\u00e1zi?<\/h2>\n\n\n\n

Budeme pot\u0159ebovat p\u0159\u00edstup k phpMyAdmin, kter\u00fd v\u011bt\u0161inou najdeme v nastaven\u00ed na\u0161eho webhostingu. Levn\u011bj\u0161\u00ed hostitel\u00e9 \u010dasto pou\u017e\u00edvaj\u00ed cPanel. Pro prov\u00e1d\u011bn\u00ed pokro\u010dil\u00fdch SQL dotaz\u016f bude pot\u0159eba WP-CLI(n\u00e1stroj pro p\u0159\u00edkazov\u00fd \u0159\u00e1dek). <\/p>\n\n\n\n

Tabulky spojen\u00e9 s produkty a objedn\u00e1vky<\/h2>\n\n\n\n

P\u0159i manipulaci s daty tabulek m\u016f\u017ee b\u00fdt zprvu obt\u00ed\u017en\u00e9 se v nich orientovat. Mezi nej\u010dast\u011bji pou\u017e\u00edvan\u00e9 tabulky v tomto ohledu pat\u0159\u00ed woocommerce_order_items<\/a> <\/strong>a woocommerce_order_itemmeta<\/a><\/strong>, kter\u00fdm se nejsp\u00ed\u0161e nevyhneme. P\u0159i manipulaci s produkty a objedn\u00e1vky bohu\u017eel nejsou jedin\u00e9, kter\u00e9 tato data obsahuj\u00ed.<\/p>\n\n\n\n

Ve kter\u00fdch tabulk\u00e1ch najdeme data o produktech?<\/h3>\n\n\n\n

Pokud v tabulk\u00e1ch posts a postmeta nenajdeme \u017e\u00e1dn\u00e9 produkty, nejsp\u00ed\u0161e budeme m\u00edt povolen\u00e9 HPOS v nastaven\u00ed WooCommerce(WooCommerce > Nastaven\u00ed > Pokro\u010dil\u00e9 > Vlastnosti<\/strong>). <\/p>\n\n\n\n

HPOS ji\u017e nen\u00ed z\u00e1visl\u00e9 na tabulce _posts, a p\u0159in\u00e1\u0161\u00ed zcela nov\u00e9 a optimalizovan\u011bj\u0161\u00ed tabulky.<\/p>\n\n\n\n