{"id":2601,"date":"2015-12-04T08:14:25","date_gmt":"2015-12-04T08:14:25","guid":{"rendered":"http:\/\/musilda.cz\/?p=2601"},"modified":"2015-12-04T08:14:25","modified_gmt":"2015-12-04T08:14:25","slug":"jak-zmenit-pozici-meny-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-zmenit-pozici-meny-ve-woocommerce\/","title":{"rendered":"Jak zm\u011bnit pozici m\u011bny ve WooCommerce"},"content":{"rendered":"

Zm\u011bna pozice m\u011bny ve WooCommerce je jednoduch\u00e1, sta\u010d\u00ed vyu\u017e\u00edt nastaven\u00ed m\u011bny. Krom\u011b pozice, si m\u016f\u017eete zm\u011bnit po\u010det desetinn\u00fdch m\u00edst, odd\u011blovat tis\u00edc\u016f a desetinn\u00fdch m\u00edst a m\u011bnu samotnou.<\/p>\n

\"nastaveni-meny\"<\/a><\/p>\n

 <\/p>\n

Funguje to perfektn\u011b, pokud v\u0161ak nepou\u017e\u00edv\u00e1te pluginy, pro zobrazov\u00e1n\u00ed v\u00edce m\u011bn.<\/p>\n

V tuto chv\u00edli m\u00e1m konkr\u00e9tn\u00ed zku\u0161enost s WPML, kdy dle nastaven\u00ed, m\u016f\u017eete pro ka\u017edou m\u011bnu, vybrat pozici symbolu m\u011bny.<\/p>\n

\"nastaveni-meny-wpml\"<\/a><\/p>\n

 <\/p>\n

A co mysl\u00edte? Nastaven\u00ed nefunguje.<\/p>\n

M\u016f\u017eete sice p\u0159ekliknout mezi m\u011bnami, ale roletka s nastaven\u00edm se ned\u00e1 rozbalit, ani zm\u011bnit.<\/p>\n

Na\u0161t\u011bst\u00ed se to d\u00e1 pom\u011brn\u011b jednodu\u0161e vy\u0159e\u0161it, pou\u017eit\u00edm filtru woocommerce_price_format. Vzhledem k tomu \u017ee se jedn\u00e1 o WPML, m\u00e1me k dispozici konstantu ICL_LANGUAGE_CODE, kter\u00e1 vrac\u00ed aktu\u00e1ln\u011b vybran\u00fd jazyk.<\/p>\n

Do functions.php, nebo do va\u0161eho pluginu, p\u0159id\u00e1me n\u00e1sleduj\u00edc\u00ed k\u00f3d:<\/p>\n

add_filter('woocommerce_price_format', 'musilda_currency_position' );\nfunction musilda_currency_position() {\n\n  if(!empty(ICL_LANGUAGE_CODE)){\n    if(ICL_LANGUAGE_CODE == 'cs'){\n      $currency_pos = 'right_space';\n    }\n    elseif(ICL_LANGUAGE_CODE == 'en'){\n      $currency_pos = 'left';\n    }\n    else{\n      $currency_pos = 'right_space';\n    }\n\n  }else{\n    $currency_pos = 'right_space';\n  }\n\n\n    switch ( $currency_pos ) {\n        case 'left' :\n            $format = '%1$s%2$s';\n        break;\n        case 'right' :\n            $format = '%2$s%1$s';\n        break;\n        case 'left_space' :\n            $format = '%1$s %2$s';\n        break;\n        case 'right_space' :\n            $format = '%2$s %1$s';\n        break;\n    }\n\n\n    return $format;\n\n}\n\n<\/pre>\n

V tuto chv\u00edli, pokud je jazykem \u010de\u0161tina, je symbol vpravo s mezerou, v p\u0159\u00edpad\u011b angli\u010dtiny je vlevo bez mezery. U ostatn\u00edch jazyk\u016f je nastaven\u00e1 pozice stejn\u00e1, jako u \u010de\u0161tiny.<\/p>\n\n\n

Dal\u0161\u00ed u\u017eite\u010dn\u00e9 snippety najdete na str\u00e1nce U\u017eite\u010dn\u00e9 snippety pro WooCommerce<\/a><\/strong> <\/p>\n","protected":false},"excerpt":{"rendered":"

Zm\u011bna pozice m\u011bny ve WooCommerce je jednoduch\u00e1, sta\u010d\u00ed vyu\u017e\u00edt nastaven\u00ed m\u011bny. Krom\u011b pozice, si m\u016f\u017eete zm\u011bnit po\u010det desetinn\u00fdch m\u00edst, odd\u011blovat tis\u00edc\u016f a desetinn\u00fdch m\u00edst a m\u011bnu samotnou.   Funguje to perfektn\u011b, pokud v\u0161ak nepou\u017e\u00edv\u00e1te pluginy, pro zobrazov\u00e1n\u00ed v\u00edce m\u011bn. V tuto chv\u00edli m\u00e1m konkr\u00e9tn\u00ed zku\u0161enost s WPML, kdy dle nastaven\u00ed, m\u016f\u017eete pro ka\u017edou m\u011bnu, vybrat<\/p>\n","protected":false},"author":1,"featured_media":8732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,25,29],"tags":[],"class_list":["post-2601","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-woocommerce","category-woocommerce-snippety"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2601"}],"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=2601"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2601\/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=2601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=2601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=2601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}