{"id":2509,"date":"2015-07-10T09:21:58","date_gmt":"2015-07-10T09:21:58","guid":{"rendered":"http:\/\/musilda.cz\/?p=2509"},"modified":"2015-07-10T09:21:58","modified_gmt":"2015-07-10T09:21:58","slug":"oprava-nezobrazovani-dph-v-kosiku-a-pokladne-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/oprava-nezobrazovani-dph-v-kosiku-a-pokladne-ve-woocommerce\/","title":{"rendered":"Oprava nezobrazov\u00e1n\u00ed DPH v ko\u0161\u00edku a pokladn\u011b ve WooCommerce"},"content":{"rendered":"
Dnes jsem narazil na pom\u011brn\u011b zvl\u00e1\u0161tn\u00ed probl\u00e9m a chci se s v\u00e1mi pod\u011blit o jeho \u0159e\u0161en\u00ed. WooCommerce neust\u00e1le zobrazovala v ko\u0161\u00edku a pokladn\u011b nulovou hodnotu DPH.<\/p>\n
P\u0159esto\u017ee jsem nastaven\u00ed n\u011bkolikr\u00e1t kontroloval a hledal chybu, neust\u00e1le ze zobrazovalo „cena obsahuje 0 K\u010d DPH“.<\/p>\n
Vypadalo to tak, \u017ee DPH prost\u011b nen\u00ed v\u016fbec po\u010d\u00edt\u00e1no a nezapisovalo se ani do objedn\u00e1vek. Kde tedy hledat chybu, kdy\u017e nastav\u00ed bylo v po\u0159\u00e1dku, na testovac\u00edm webu v\u0161e fungovalo a DPH se nezobrazilo ani p\u0159i p\u0159epnut\u00ed na defaultn\u00ed \u0161ablonu a deaktivaci plugin\u016f? Downgrade nepomohl, p\u0159einstal\u00e1n\u00ed WooCommerce tak\u00e9 ne.<\/p>\n
Nebudu v\u00e1s nap\u00ednat, v datab\u00e1zi chyb\u011bla jedna tabulka. Nedok\u00e1\u017ei \u0159\u00edci pro\u010d, ale prost\u011b se nevytvo\u0159ila woocommerce_tax_rate_locations.<\/p>\n
I kdy\u017e se u n\u00e1s lokace pro DPH nepou\u017e\u00edvaj\u00ed a tabulka z\u016fstane pr\u00e1zdn\u00e1, tak jej\u00ed neexistence naru\u0161\u00ed proces v\u00fdpo\u010dtu a bude se v\u00e1m v\u0161ude zobrazovat nulov\u00e9 DPH.<\/p>\n
Pro vy\u0159e\u0161n\u00ed sta\u010d\u00ed j\u00edt do phpMyAdmin, zvolit SQL a vytvo\u0159it samotnou tabulku, p\u0159idat kl\u00ed\u010de a autoincrement. Asi by se to dalo napsat do jednoho p\u0159\u00edkazu, ale po p\u011bti hodin\u00e1ch jsem byl r\u00e1d, \u017ee jsem na\u0161el \u0159e\u0161en\u00ed.<\/p>\n
K\u00f3d:<\/p>\n
CREATE TABLE IF NOT EXISTS `wp_woocommerce_tax_rate_locations` (\n`location_id` bigint(20) NOT NULL,\n`location_code` varchar(255) NOT NULL,\n`tax_rate_id` bigint(20) NOT NULL,\n`location_type` varchar(40) NOT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nALTER TABLE `wp_woocommerce_tax_rate_locations`\nADD PRIMARY KEY (`location_id`), ADD KEY `tax_rate_id` (`tax_rate_id`), ADD KEY `location_type` (`location_type`), ADD KEY `location_type_code` (`location_type`,`location_code`);\n\n\nALTER TABLE `wp_woocommerce_tax_rate_locations`\nMODIFY `location_id` bigint(20) NOT NULL AUTO_INCREMENT;\n<\/pre>\nN\u00e1zev tabulky se m\u016f\u017ee zm\u011bnit podle toho, jak\u00fd m\u00e1te zvolen\u00e1 prefix, v tom p\u0159\u00edpad\u011b mus\u00edte nahradit „wp_“ na za\u010d\u00e1tku jm\u00e9na tabluky.<\/p>\n","protected":false},"excerpt":{"rendered":"
Dnes jsem narazil na pom\u011brn\u011b zvl\u00e1\u0161tn\u00ed probl\u00e9m a chci se s v\u00e1mi pod\u011blit o jeho \u0159e\u0161en\u00ed. WooCommerce neust\u00e1le zobrazovala v ko\u0161\u00edku a pokladn\u011b nulovou hodnotu DPH. P\u0159esto\u017ee jsem nastaven\u00ed n\u011bkolikr\u00e1t kontroloval a hledal chybu, neust\u00e1le ze zobrazovalo „cena obsahuje 0 K\u010d DPH“. Vypadalo to tak, \u017ee DPH prost\u011b nen\u00ed v\u016fbec po\u010d\u00edt\u00e1no a nezapisovalo se ani<\/p>\n","protected":false},"author":1,"featured_media":8732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-2509","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2509"}],"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=2509"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2509\/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=2509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=2509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=2509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}