{"id":4202,"date":"2017-09-06T09:55:11","date_gmt":"2017-09-06T09:55:11","guid":{"rendered":"http:\/\/musilda.cz\/?p=4202"},"modified":"2017-09-06T09:55:11","modified_gmt":"2017-09-06T09:55:11","slug":"id-objednavek-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/id-objednavek-ve-woocommerce\/","title":{"rendered":"Id objedn\u00e1vek ve WooCommerce"},"content":{"rendered":"\n

Jednou zvl\u00e1\u0161tnost\u00ed ve WooCommerce jsou jejich id. Kdo by o\u010dek\u00e1val souvislou \u010d\u00edselnou \u0159adu, bude velmi p\u0159ekvapen.<\/p>\n\n\n\n

Ka\u017ed\u00e1 \u010d\u00edslo objedn\u00e1vky za\u010d\u00edn\u00e1 znakem # a n\u00e1sleduje \u010d\u00edslo. \u010c\u00edsla objedn\u00e1vek tak jsou #20, #21, #22 a tak d\u00e1le.<\/p>\n\n\n\n

Kdy\u017e se ale pod\u00edv\u00e1te na n\u00e1sleduj\u00edc\u00ed obr\u00e1zek z administrace eshopu, uvid\u00edte, \u017ee \u010d\u00edsla nen\u00e1sleduj\u00ed za sebou:<\/p>\n\n\n

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

Mezi 885 a 887 chyb\u00ed jedno \u010d\u00edslo.<\/p>\n\n\n\n

Vysv\u011btlen\u00ed souvis\u00ed s t\u00edm, \u017ee objedn\u00e1vky ve WooCommerce jsou custom post type.<\/p>\n\n\n\n

V\u0161echny post type se toti\u017e ukl\u00e1daj\u00ed do tabulky wp_posts. Prefix wp_ se m\u016f\u017ee m\u011bnit, tak\u017ee tabulka se m\u016f\u017ee jmenovat asdf_posts, tak\u017ee budeme pou\u017e\u00edvat posts.<\/p>\n\n\n\n

Pod\u00edvejte se na screen s daty z tabulky posts:<\/p>\n\n\n\n

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

Sloupec, kde jsou \u010d\u00edsla od 883, do 888 m\u00e1 n\u00e1zev ID a do n\u011bj se ukl\u00e1d\u00e1 \u010d\u00edslo z\u00e1znamu v tabulce posts. Nav\u00edc se automaticky navy\u0161uje, tak\u017ee ka\u017ed\u00fd nov\u00fd z\u00e1znam m\u00e1 \u010d\u00edslo o 1 vy\u0161\u0161\u00ed.<\/p>\n\n\n\n

Na \u0159\u00e1dc\u00edch 885 a 887 jsou objedn\u00e1vky, co\u017e odpov\u00edd\u00e1 i obr\u00e1zku z administrace eshopu. Ale na \u0159\u00e1dku 886 je automatick\u00fd vytvo\u0159en\u00fd koncept.<\/p>\n\n\n\n

Pro\u010d tomu tak je?<\/p>\n\n\n\n

WordPress do t\u00e9to tabulky ukl\u00e1d\u00e1 v\u0161echny \u010dl\u00e1nky, str\u00e1nky, m\u00e9dia, revize a tak d\u00e1le. Tak\u017ee, pokud mezi objedn\u00e1vkami provedete import 300 produkt\u016f a k nim nahrajete obr\u00e1zky, bude se jednat minim\u00e1ln\u011b o 600 z\u00e1znam\u016f v datab\u00e1zi a \u010d\u00edsla objedn\u00e1vek se budou li\u0161it o 600 \u010d\u00edsel. V na\u0161em p\u0159\u00edpad\u011b by bylo \u010d\u00edslo dal\u0161\u00ed objedn\u00e1vky #1449.<\/p>\n\n\n\n

Pokud chcete m\u00edt \u010d\u00edsla objedn\u00e1vek za sebou, budete muset vyu\u017e\u00edt n\u011bkter\u00fd z plugin\u016f, nap\u0159\u00edklad https:\/\/wordpress.org\/plugins\/woocommerce-sequential-order-numbers\/<\/p>\n\n\n\n

P\u0159\u00ed\u0161t\u011b se pod\u00edv\u00e1me na to, co jsou akce objedn\u00e1vky.<\/p>\n","protected":false},"excerpt":{"rendered":"

Jednou zvl\u00e1\u0161tnost\u00ed ve WooCommerce jsou jejich id. Kdo by o\u010dek\u00e1val souvislou \u010d\u00edselnou \u0159adu, bude velmi p\u0159ekvapen. Ka\u017ed\u00e1 \u010d\u00edslo objedn\u00e1vky za\u010d\u00edn\u00e1 znakem # a n\u00e1sleduje \u010d\u00edslo. \u010c\u00edsla objedn\u00e1vek tak jsou #20, #21, #22 a tak d\u00e1le. Kdy\u017e se ale pod\u00edv\u00e1te na n\u00e1sleduj\u00edc\u00ed obr\u00e1zek z administrace eshopu, uvid\u00edte, \u017ee \u010d\u00edsla nen\u00e1sleduj\u00ed za sebou: Mezi 885 a 887<\/p>\n","protected":false},"author":1,"featured_media":8732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[25,26],"tags":[],"class_list":["post-4202","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce","category-woocommerce-manual"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/4202"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=4202"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/4202\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8732"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=4202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=4202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=4202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}