task 6809 | вынес выбор опции подписки в отдельный twig шаблон

pull/36/head
parent 0189c54e03
commit dddac1236f
  1. 5
      wp-content/themes/cosmopet/modules/shop/components/single-product/assets/css/gp-style-core.css
  2. 33
      wp-content/themes/cosmopet/templates/shop/product-subscription-options-prompt-radio-block.twig
  3. 58
      wp-content/themes/cosmopet/woocommerce/single-product/product-subscription-options-prompt-radio.php

@ -1566,3 +1566,8 @@ input:checked + .subscription-option-details::before, input:checked + .wcsatt-op
display: flex; display: flex;
gap: 10px; gap: 10px;
} }
.amount {
color: #1A1A1A;
font-weight: 600;
}

@ -0,0 +1,33 @@
<ul class="wcsatt-options-prompt-radios">
<li class="wcsatt-options-prompt-radio">
<label class="wcsatt-options-prompt-label wcsatt-options-prompt-label-one-time">
<input class="wcsatt-options-prompt-action-input"
type="radio"
name="subscribe-to-action-input"
value="no" />
<div class="wcsatt-options-prompt-action">
One-time purchase for
<b class="woocommerce-Price-amount">
{% if fn('wc_get_price_to_display', product, {'price': product.get_regular_price }) > fn('wc_get_price_to_display', product, {'price': product.get_sale_price }) %}
<del>{{ fn('wc_price', fn('wc_get_price_to_display', product, {'price': product.get_regular_price })) }}</del>
<ins>{{ fn('wc_price', fn('wc_get_price_to_display', product, {'price': product.get_sale_price })) }}</ins>
{% else %}
{{ fn('wc_price', fn('wc_get_price_to_display', product, {'price': product.get_regular_price })) }}
{% endif %}
</b>
</div>
</label>
</li>
<li class="wcsatt-options-prompt-radio">
<label class="wcsatt-options-prompt-label wcsatt-options-prompt-label-subscription">
<input class="wcsatt-options-prompt-action-input"
type="radio"
name="subscribe-to-action-input"
value="yes" />
<span class="wcsatt-options-prompt-action">
{{ subscription_cta | raw }}
</span>
</label>
</li>
</ul>

@ -1,55 +1,9 @@
<?php <?php
/** use Timber\Timber;
* Product Subscription Options Radio Prompt Template.
*
* Override this template by copying it to 'yourtheme/woocommerce/single-product/product-subscription-options-prompt-radio.php'.
*
* On occasion, this template file may need to be updated and you (the theme developer) will need to copy the new files to your theme to maintain compatibility.
* We try to do this as little as possible, but it does happen.
* When this occurs the version of the template file will be bumped and the readme will list any important changes.
*
* @version 4.1.0
*/
// Exit if accessed directly. $product = wc_get_product();
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $product;
?>
<style> Timber::render( 'shop/product-subscription-options-prompt-radio-block.twig', [
.amount { 'product' => $product,
color: #1A1A1A; 'subscription_cta' => $subscription_cta ?? '', // передайте сюда HTML, как делает оригинальный шаблон
font-weight: 600; ] );
}
</style>
<ul class="wcsatt-options-prompt-radios">
<li class="wcsatt-options-prompt-radio">
<label class="wcsatt-options-prompt-label wcsatt-options-prompt-label-one-time">
<input class="wcsatt-options-prompt-action-input" type="radio" name="subscribe-to-action-input" value="no" />
<div class="wcsatt-options-prompt-action">
One-time purchase for
<b class="woocommerce-Price-amount">
<?php
$regular_price = $product->get_regular_price();
$sale_price = $product->get_sale_price();
if ( $sale_price && $regular_price > $sale_price ) {
echo '<del>' . wc_price( $regular_price ) . '</del> <ins>' . wc_price( $sale_price ) . '</ins>';
} else {
echo wc_price( $regular_price );
}
?>
</b>
</div>
</label>
</li>
<li class="wcsatt-options-prompt-radio">
<label class="wcsatt-options-prompt-label wcsatt-options-prompt-label-subscription">
<input class="wcsatt-options-prompt-action-input" type="radio" name="subscribe-to-action-input" value="yes" />
<span class="wcsatt-options-prompt-action"><?php echo wp_kses_post( $subscription_cta ); ?></span>
</label>
</li>
</ul>
Loading…
Cancel
Save