์๋ ,
์ง๋ ์ฐ์ปค๋จธ์ค ์ ๋ฐ์ดํธ ์ดํ ๊ฐ๋ณ ์ํ์ ํธ์งํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ ํ ๋ฐ์ดํฐ๋ "๋จ์ ์ ํ"์ ๋ํ๋ด์ง๋ง ์ ํ์ ๊ฐ๋ณ์ ์ ๋๋ค.
Copy and paste the system status report from **WooCommerce > System Status** in WordPress admin here.
๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๊ธฐ๋ณธ ์ธ์ด์์ ๋ณต์ฌํ๋ฉด ๋ณํ์ ๋ณต์ฌํ ๊ฐ๋ฅ์ฑ ์์ด ๋จ์ํ ์ ํ๋ง ํ์๋ฉ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ์ด๋ป๊ฒ ํด๊ฒฐํ ์ ์์ต๋๊น?
์๋ ํ์ธ์,
ํ๋ฌ๊ทธ์ธ "jQuery Migrate Helper"๋ฅผ ์ค์นํ๋ ค๊ณ ํ์ต๋๊น?
์ ์ฅ์์์ ์ฝ๋๋ฅผ ์ฌ์ฉํ๊ณ ๋ค์ด๋ก๋ ์ฝ๋์์ ์ง์ zip์ ๋ค์ด๋ก๋ํ์ฌ ์ค์นํ์ญ์์ค. ํด๊ฒฐ๋ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค. ๋ค์ ์ฃผ์ ์ด๊ฒ์ ๋ง์ด ํ ์คํธํ ์์ ์ด์ง๋ง ๋ชจ๋ ํผ๋๋ฐฑ์ ํ์ํฉ๋๋ค.
์ ์ฅ์์์ ์ฝ๋๋ฅผ ์ฌ์ฉํ๊ณ ๋ค์ด๋ก๋ ์ฝ๋์์ ์ง์ zip์ ๋ค์ด๋ก๋ํ์ฌ ์ค์นํ์ญ์์ค. ํด๊ฒฐ๋ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค. ๋ค์ ์ฃผ์ ์ด๊ฒ์ ๋ง์ด ํ ์คํธํ ์์ ์ด์ง๋ง ๋ชจ๋ ํผ๋๋ฐฑ์ ํ์ํฉ๋๋ค.
zip์ ๋ค์ด๋ก๋ํ๊ณ GitHub์์ ์ค์นํ ํ 2๊ฐ์ง ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
1) ๊ธฐ๋ณธ ์ธ์ด์์ ๋ณด์กฐ ์ธ์ด๋ก ์ ํ์ ๋ณต์ฌํ๋ฉด ๋ง์ ๋ณํ์ด ์์ฑ๋ฉ๋๋ค.
2) ๊ณ ๊ฐ๋ ์ฃผ๋ฌธ ํ, ์ฌ๊ณ ๊ฐ ๋จ์๋ ํ์ ๋๋ ์ํ์
๋๋ค.
1. If I copy a product from the primary language into the secondary it creates many variations, (example if I have a product with 2 colors, the second language creates 10 variations from the color)
ํ๋ฌ๊ทธ์ธ์ GitHub ๋ฒ์ ๊ณผ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ต์ PR #518์ด ๊ฐ๋ณ ์ ํ๊ณผ ๊ด๋ จ๋ ๊ฒ์ ๋ง์น ๊ฒ ๊ฐ์ต๋๋ค.
์ข์, ์ฃผ์ ๋ฅผ ์ฝ์์ต๋๋ค. ์ด์ ๋ฌธ์ ๋ ๋ฉํ ์์ฑ์ ์ฒ ์ ์ค๋ฅ์
๋๋ค. ์
๋ฐ์ดํธ ์ฟผ๋ฆฌ๋ก ํด๊ฒฐํ๊ณ src/Hyyan/WPI/Plugin.php์์ ์ด๋ฆ์ ์์ ํ ์ ์์ต๋๊น?
@mrleemon ๋๋ ๋น์ ์ด ์ด ํ๋ก์ ํธ์ ๊ณต๋ ์์
์
์ฃ์กํฉ๋๋ค. ์ค๋์ ์ ์คํ์ ๋ํ ๋ช ๊ฐ์ง ์์ ์ฌํญ๋ง ์ปค๋ฐํ์ต๋๋ค. ์ด ํ๋ฌ๊ทธ์ธ์ ๋ด๋ถ ์๋์ ๋ํ ๋์ ์ง์์ ๊ฑฐ์ 0์ ๊ฐ๊น์ต๋๋ค.
์ด ๋ณํ ๋ฒ๊ทธ๋ฅผ ์์ ํ๊ธฐ ์ํด ๋ฌด์์ ํด์ผ ํ๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
์ง๊ธ์ ์ด ํ๋ฌ๊ทธ์ธ์ด ์ด๋ป๊ฒ ์๋ํ๋์ง ์๋ ์ฌ๋์ @Jon007๋ฟ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค.
#518์๋ ๊ธฐ์กด ์ฌ์ดํธ๊ฐ ์์๋ ๊ฐ๋ฅ์ฑ์ด ์์ผ๋ฏ๋ก #450์์ ์ด๋ฏธ ๊ฑฐ๋ถํ ์ด ์คํ ์์ ์ฌํญ์ด ํฌํจ๋์ด ์๋ ๊ฒ์ ๋ณด์์ง๋ง @hyyan ์ ์ด๋ฅผ ์๋ฝํ์ต๋๋ค...
๋๋ ์ง๊ธ #518์ ๋๋๋ ธ๋ค. ๊ทธ๋ฆฌ๊ณ ๋์ค์ ์์ธํ ์์๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค
๊ฐ์ฌ ํด์!
ํ๋ฌ๊ทธ์ธ์ ์ง์์ ์ธ WooCommerce ๋ฆด๋ฆฌ์ค์ ์ทจ์ฝํ ํ์ฌ ์ฌ์ฉ์ ์ง์ ๋ฐฉ์ ๋์ ๊ณต์ Polylang pll_copy_taxonomies
ํํฐ๋ฅผ ์ฌ์ฉํ์ฌ WooCommerce ๋ถ๋ฅ(product_type, product_visibility ๋ฐ ๊ธฐํ)๋ฅผ ๋๊ธฐํํด์ผ ํฉ๋๋ค. ํ๋ฌ๊ทธ์ธ์ ์ด๋ฏธ Polylang pll_copy_post_metas
ํํฐ๋ฅผ ์ฌ์ฉํ์ฌ ์ ํ ๋ฉํ๋ฅผ ๋ณต์ฌํ๋ฏ๋ก pll_copy_taxonomies
๋ฅผ ์ฌ์ฉํ์ฌ ์ ํ ๋ถ๋ฅ๋ฅผ ๋๊ธฐํํ๋ ๊ฒ์ด ํฉ๋ฆฌ์ ์
๋๋ค.
์ด ํํฐ๋ฅผ ์ฌ์ฉํ๋ฉด ๋๊ธฐํํ๊ฑฐ๋ ๋ณต์ฌํ๋ ค๋ ๋ถ๋ฅ๋ฒ์ ์ง์ ํ ์ ์์ผ๋ฉฐ Polylang์ ์ ๋ฒ์ญ์ ๋ง๋ค ๋ ํด๋น ๋ถ๋ฅ๋ฒ ๋ฐ ๊ด๋ จ ์ฉ์ด์ ๋๊ธฐํ/๋ณต์ฌ๋ฅผ ์ฒ๋ฆฌํฉ๋๋ค.
๊ทธ๋ฅ ์์ด๋์ด์ ๋๋ค.
๋๋ ๊ทธ๊ฒ์ ๋ณด์์ง๋ง ์ฐ์ปค๋จธ์ค๊ฐ ์์ฒด API์ ์์ฒด ํ ์ด๋ธ๋ก ๋ ๋ง์ด ์ด๋ํจ์ ๋ฐ๋ผ ์ ํ์ ๊ฒ์๋ฌผ๋ก ์ทจ๊ธํ๊ณ ์ผ๋ฐ ๊ฒ์๋ฌผ ๊ธฐ๋ฐ API๋ฅผ ์ฌ์ฉํ๋ ๋ฐ ์์กดํ ์ ์๊ฒ ๋๋ฉด์ ์ด ๋ชจ๋ ๊ฒ์ด ์ํํ ์ ๋๋ก ๊ตฌ์์ผ๋ก ๋ฐ๋๊ณ ์์ต๋๋ค. ๊ธฐ๊ปํด์ผ ์ฐ์ปค๋จธ์ค ์บ์ฑ ๋ฉ์ปค๋์ฆ์ ๋ฒ๊ทธ๊ฐ ์์ ๊ฒ์ ๋๋ค.
๋ค, ์๋๋ค. WC API ๋ณ๊ฒฝ์ ๊ธฐ๋ค๋ฆฌ๋ ๋์ ์์ ์๋ฃจ์
์ผ๋ก ์๊ฐํ์ต๋๋ค.
ํํธ, Meta.php
์ JS ์ฝ๋๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝํ์ฌ ์ ํ์ด ๊ฐ๋ณ์ ์ผ ๋ "๋จ์ ์ ํ"์ ์๋ชป๋ ์ ํ์ ํด๊ฒฐํ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
์์:
$code = sprintf(
'// <![CDATA[ %1$s'
. ' addLoadEvent(function () { %1$s'
. ' jQuery("#product-type option")'
. ' .removeAttr("selected");%1$s'
. ' jQuery("#product-type option[value=\"%2$s\"]")'
. ' .attr("selected", "selected");%1$s'
. '})'
. '// ]]>', PHP_EOL, $type[0]
);
์๊ฒ:
$code = sprintf(
'// <![CDATA[ %1$s'
. ' addLoadEvent(function () { %1$s'
. ' jQuery("#product-type option")'
. ' .prop("selected", false);%1$s'
. ' jQuery("#product-type option[value=\"%2$s\"]")'
. ' .prop("selected", true);%1$s'
. '})'
. '// ]]>', PHP_EOL, $type[0]
);
๋ถ๋ช
ํ ์ต์
์ ์ ํ/์ ํ ํด์ ํ๊ธฐ ์ํด attr()
๋ฐ removeAttr()
๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ WP์ jQuery ์ต๊ทผ ๋ณ๊ฒฝ ์ฌํญ์ผ๋ก ์ธํด ๋ ์ด์ ์ฌ์ฉ๋์ง ์์ต๋๋ค.
https://jquery.com/upgrade-guide/3.0/์์ :
Breaking change: .removeAttr() no longer sets properties to false
Prior to jQuery 3.0, using .removeAttr() on a boolean attribute such as checked, selected, or readonly would also set the corresponding named property to false. This behavior was required for ancient versions of Internet Explorer but is not correct for modern browsers because the attribute represents the initial value and the property represents the current (dynamic) value.
It is almost always a mistake to use .removeAttr( "checked" ) on a DOM element. The only time it might be useful is if the DOM is later going to be serialized back to an HTML string. In all other cases, .prop( "checked", false ) should be used instead.
๋ํ ํ์ฌ ์ฌ์ฉ์๊ฐ WC ๋ณต์ ์ ํ ๋งํฌ๋ฅผ ํด๋ฆญํ๋ฉด ์ ํ ์ ํ์ด ๋ณต์ ๋ณธ์ ๋ณต์ฌ๋์ง ์์ต๋๋ค.
Duplicator.php
์ unlinkOrginalProductTranslations()
ํจ์์ ์ด๊ฒ์ ์ถ๊ฐํ์ฌ "๊ณ ์ "ํ์ต๋๋ค.
$type = $product->get_type();
update_post_meta($duplicate->get_id(), '_translation_porduct_type', $type);
๋ฌธ์ ๊ฐ ์๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
'_translation_porduct_type'์ ์์ ํ ์์ ๊ณ ์ถ์ต๋๋ค. ์ค์ ๋ก ํ์ํ์ง๋ ์์ต๋๋ค. ์ฌ์ฉ์ ์ธํฐํ์ด์ค ๋ฌธ์ ์ ๋์ฒํ๊ธฐ ์ํ ๊ฒ์ผ ๋ฟ์ ๋๋ค. ๊ทธ๋ฌ๋ ์ง๊ธ์ ๊ทธ๋๋ก ์ ์งํ๊ณ ์ ์ํ ๋๋ก ์ํํ๋ ๊ฒ์ด ๊ฐ์ฅ ๊ฐ๋จํฉ๋๋ค.
์ด๊ฒ์ ๋ํด ๋ฌป๊ณ ์ถ์์ต๋๋ค. ๋ฒ์ญ๋ ์ ํ ์ ํ์ด _translation_porduct_type
์ ์ฅ๋๋ ์ด์ ๋ ๋ฌด์์
๋๊น? ํ์ํ ๋ ์๋ ์ ํ์์ ์ง์ ๊ฐ์ ธ์ฌ ์ ์์ต๋๊น?
polylang์ ๋ฒ์ญํ ๋ ์ด์ ์ ํ์ ์์ฒญํ ๋ ๋ฒ์ญ๋ ์ ํ ์ธ๋ถ ์ ๋ณด๋ฅผ ์ ๊ณตํ๋ ค๊ณ ํ ๋ ์ต์ํ ๋ฉํ๋ฐ์ดํฐ์์ ๋ณต์ฌํ๋ ๊ฒ์ด ๋ ์ฝ๊ธฐ ๋๋ฌธ์ ๋ณต์กํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
_translation_porduct_type
๋ฉํ๋ฅผ ์ ๊ฑฐํ๋ ค๋ฉด ํ๋ฌ๊ทธ์ธ์ด wp_insert_post
์ฌ์ฉํ๋ ์ฌ์ฉ์ ์ ์ ์๋ฃจ์
์ ์์กดํ๋ ๋์ WC API WC_Product:save()
๊ธฐ๋ฅ์ ์ฌ์ฉํ์ฌ ๋ฒ์ญ์ ์ ์ฅํด์ผ ํ๋ค๊ณ ์๊ฐํฉ๋๋ค. ์ง์ ์์
์ ์ํํด์ผ ํ์ง๋ง ์ด๋ Meta.php
์ ์๋ ๋ง์ ์ฝ๋๋ฅผ ๋ฆฌํฉํ ๋งํ๋ ๊ฒ์ ์๋ฏธํ๋ฉฐ ์ด๋์๋ถํฐ ์์ํด์ผ ํ ์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
์๋ . ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ จ์ต๋๊น?
์๋ ํ์ธ์, ์ ๋ #430์ ๋ํ ์ค๋ช ์ ํฌํจํ์ฌ Variable ์ ํ ๋ฌธ์ ์ ๋ํ ๋ช ๊ฐ์ง ์๋ฃจ์ ์ ์ฝ์ํ์ต๋๋ค. ๋๊ตฐ๊ฐ ์ต์ ์ฝ๋๋ฅผ ํ ์คํธํ๊ณ ์ด๋ค ๋ฌธ์ ๊ฐ ๋จ์ ์๋์ง ํ์ธํ ์ ์๋ค๋ฉด ์ข์ ๊ฒ์ ๋๋ค. ํฐ์ผ์ด ์์ ํ ์ค๋ณต๋์ด ๋ฐ๋ผ๊ฐ๊ธฐ๊ฐ ์ด๋ ค์์ง๊ณ ์์ต๋๋ค.
์์ ํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! ๊ธฐํ๊ฐ ๋๋ฉด ์ต์ ์ฝ๋๋ฅผ ํ ์คํธํ๊ณ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ฉด ์๋ ค ๋๋ฆฌ๊ฒ ์ต๋๋ค.
์ต์ ์ฝ๋๋ฅผ ํ
์คํธํ ํ ๋ฌธ์ ๋ฅผ ์ด์์ต๋๋ค.
https://github.com/hyyan/woo-poly-integration/issues/526
@hyyan @mrleemon ์ง๋ ์ฃผ์ ๋ช ๊ฐ์ง ์ค์ํ ๋ณ๊ฒฝ ์ฌํญ์ ํ์ธํ๊ณ 5.1๋ก ๋ ์ด๋ธ์ ์ง์ ํ์ต๋๋ค.
ํนํ ๋ค์ ์ ๋ํ meta.php ํธ์ถ์ ์ฃผ์ @mrleemon์ด ์์ ํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ ๊ฑฐํ์ต๋๋ค.
$this->syncSelectedproductType( $ID );
์ด์ ์๋ ์ ์ฅ ์์๊ฐ ์ ์ด๋ 5.0์์๋ ์ ํํ์ง ์์๊ธฐ ๋๋ฌธ์ ์ด ๋ฌธ์ ๊ฐ ์์์ต๋๋ค.
์ฝ๋ ์์ ์ ์ด์ WooCommerce ์ ์ฅ ์งํ ํํฌ๋ฅผ ์ ํํ๊ณ ๋น ๋ฅธ ํธ์ง(#549) ๋ฐ ๋๋ ํธ์ง์์๋ ์๋ํ๋๋ก ์กฐ์ ๋์ด ์ ํ ์ ํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด ๋ ์ด์ ํ์ํ์ง ์์ต๋๋ค.
๋ฌผ๋ก ์ด๊ฒ์ด ๋์ด ์๋๋๋ค. woo api๋ง ์ฌ์ฉํ๊ณ wp api๋ฅผ ํผํ๋ ค๋ฉด ์ ์ฒด๋ฅผ ๋ค์ ๊ฒํ ํด์ผ ํ์ง๋ง ์ผ๋ถ ์ด์ํ ๋์์ ์ ๊ฑฐํด์ผ ํฉ๋๋ค.
์์ฒญ๋! ๊ทธ ํด๊ฒฐ ๋ฐฉ๋ฒ ์์ ์ ์ ๋ง ๋์ฐํ์ต๋๋ค.
๊ทธ๋ ๋ค๋ฉด ์ฒ ์๊ฐ ์๋ชป๋ _translation_porduct_type
๋ฉํ๋ ๋ ์ด์ ํ์ํ์ง ์์ต๋๊น?
์๊ฐ์ด ์์ ๋ ์ด ์
๋ฐ์ดํธ๋ ๋ฒ์ ์ ํ
์คํธํ๊ฒ ์ต๋๋ค.
๊ฐ์ฌ ํด์!
์ง๊ธ์ ์ฒ ์๊ฐ ํ๋ฆฐ _translation_porduct_type ๋ฉํ ํ ๋น์ ๋จ๊ฒจ๋์์ง๋ง ์ฌ์ฉ๋์ง ์์ต๋๋ค. ์ด ๋ฒ์ ์ด ๊ด์ฐฎ์ผ๋ฉด ํ์ ๋ฆด๋ฆฌ์ค์์ ์ด ์ฝ๋์ ๊ธฐํ ์ค๋ณต ์ฝ๋๋ฅผ ์ ๊ฑฐํ ์ ์์ต๋๋ค.
์ด ์ ๋ฒ์ ์ ํ ์คํธํ ๊ฒฐ๊ณผ ๋ค์๊ณผ ๊ฐ์ ๋ฌธ์ ๋ฅผ ๋ฐ๊ฒฌํ์ต๋๋ค.
์๊ฒ ์ต๋๋ค. ํ์ธํ๊ฒ ์ต๋๋ค.
๊ธฐ์กด ์ ํ์ ์ ํ ์ ํ(๋ฐ ๊ธฐํ ์์ฑ)์ ๋ณ๊ฒฝํ๋ ๊ฒ์ ๊ด์ฐฎ์ต๋๋ค.
@mrleemon ์ฒดํฌ์ธ: woo hook์ด ์์ง ์คํ๋์ง ์์๊ธฐ ๋๋ฌธ์ wordpress hook์ ์ ์งํ๋ ค๋ฉด ์๋ก์ด ๋ฒ์ญ์ด ํ์ํฉ๋๋ค.
์์์ด ๊ณ ๋ง์!
๋์ค์ ์๊ฐ์ด ๋๋ฉด ํ
์คํธํด๋ณด๊ณ ์ต๋ํ ๋นจ๋ฆฌ ๋ค์ ์ฐ๋ฝ๋๋ฆฌ๊ฒ ์ต๋๋ค.
์ด ์ ๋ฒ์ ์ ํ
์คํธํ์ผ๋ฉฐ ์ ๋ฒ์ญ ๋ฌธ์ ๊ฐ ์์ ๋์์ต๋๋ค.
๊ฐ์ฌ ํด์!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋๋ ์ง๊ธ #518์ ๋๋๋ ธ๋ค. ๊ทธ๋ฆฌ๊ณ ๋์ค์ ์์ธํ ์์๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค