Commit b369457a authored by Quan Nguyen's avatar Quan Nguyen

update 22 15h

parent 14eea73a
No preview for this file type
This diff is collapsed.
$(document).ready(function(){$(".subs__select-section").each(function(){const t=$(this).find(".subs__item-container");t.click(function(){t.each(function(){$(this).removeClass("subs__item-container--selected")}),$(this).addClass("subs__item-container--selected")})});const t=$('input[name="attribute_pa_bag"]'),e=$('input[name="variation_id"]'),s=$('input[name="frequency"]'),n=$("#totalPrice"),i=$("#btnContinue"),a=$("#total"),o=$("form.js-form-checkout").first(),c=$("#summaryBag"),r=c.find(".subs__text--primary"),d=c.find(".subs__text--secondary"),u=$("#summaryFreq"),m=u.find(".js-freq"),l=$("#selectBag"),_=l.find(".subs__item-container"),f=$("#selectFrequency"),b=f.find(".subs__item-container");i.click(function(){l.addClass("d-none"),f.removeClass("d-none"),$(this).addClass("d-none")}),_.click(function(){const s=$(this).find(".subs__text--primary").text().trim(),o=$(this).find(".subs__text--secondary").text().trim(),u=$(this).find(".subs__text--price").text().trim();r.text(s),d.text(o),n.text(u),c.removeClass("d-none"),i.removeClass("d-none"),a.removeClass("d-none"),console.log($(this).data("id")),t.val($(this).data("slug")),e.val($(this).data("id"))}),b.click(function(){const t=$(this).find(".subs__text--primary").text().trim().toLowerCase();m.text(t),u.removeClass("d-none"),o.removeClass("d-none"),s.val($(this).data("value"))})});
$(document).ready(function () {
// Add border to selected item
const subsSelectSection = $('.subs__select-section');
subsSelectSection.each(function () {
const items = $(this).find('.subs__item-container')
items.click(function () {
items.each(function () {
$(this).removeClass('subs__item-container--selected');
});
$(this).addClass('subs__item-container--selected');
});
});
// input
const inputAttributePaBag = $('input[name="attribute_pa_bag"]');
const inputVariationId = $('input[name="variation_id"]');
const inputFrequency = $('input[name="frequency"]');
const inputNumOfBag = $('input[name="num_of_bag"]');
const totalPrice = $('#totalPrice');
const btnContinue = $('#btnContinue');
const totalSection = $('#total');
const formCheckOut = $('form.js-form-checkout').first();
const summaryBag = $('#summaryBag');
const summaryBagTitle = summaryBag.find('.subs__text--primary');
const summaryBagDesc = summaryBag.find('.subs__text--secondary');
const summaryFreq = $('#summaryFreq');
const summaryFreqTitle = summaryFreq.find('.js-freq');
const selectBag = $('#selectBag');
const bags = selectBag.find('.subs__item-container');
const selectFrequency = $('#selectFrequency');
const frequencies = selectFrequency.find('.subs__item-container');
btnContinue.click(function () {
selectBag.addClass('d-none');
selectFrequency.removeClass('d-none');
$(this).addClass('d-none');
});
bags.click(function () {
const title = $(this).find('.subs__text--primary').text().trim();
const desc = $(this).find('.subs__text--secondary').text().trim();
const price = $(this).data('price');
summaryBagTitle.text(title);
summaryBagDesc.text(desc);
totalPrice.text(price);
summaryBag.removeClass('d-none');
btnContinue.removeClass('d-none');
totalSection.removeClass('d-none');
inputAttributePaBag.val($(this).data('slug'));
inputVariationId.val($(this).data('id'));
inputNumOfBag.val($(this).data('num-of-bag'));
});
frequencies.click(function () {
const title = $(this).find('.subs__text--primary').text().trim().toLowerCase();
summaryFreqTitle.text(title);
summaryFreq.removeClass('d-none');
formCheckOut.removeClass('d-none');
inputFrequency.val($(this).data('value'));
});
});
......@@ -61,14 +61,13 @@ function productLocation(branchIDParams) {
).prop("selectedIndex");
if (indexQualityStock === 0) {
$(".product-detail.product-type-simple form").submit(function () {
return false;
});
$(".product-detail.product-type-simple form :input").prop("disabled", true);
$(".product-detail.product-type-simple .stock.in-stock").hide();
$(".product-detail.product-type-simple .location-detail .message").text("");
$(".product-detail.product-type-simple .location-detail .branch").text("");
} else {
$(".product.product-detail .product-detail__notification").hide();
if (qualityStockText !== null) {
......@@ -114,9 +113,6 @@ function productLocation(branchIDParams) {
" " +
$(".modal-visible .out_stock").text()
);
$(".product-detail.product-type-simple form").submit(function () {
return false;
});
$(".product-detail.product-type-simple form :input").prop(
"disabled",
true
......
$(document).ready(function () {
// Add border to selected item
const subsSelectSection = $('.subs__select-section');
subsSelectSection.each(function () {
const items = $(this).find('.subs__item-container')
items.click(function () {
items.each(function () {
$(this).removeClass('subs__item-container--selected');
});
$(this).addClass('subs__item-container--selected');
});
});
// input
const inputAttributePaBag = $('input[name="attribute_pa_bag"]');
const inputVariationId = $('input[name="variation_id"]');
const inputFrequency = $('input[name="frequency"]');
const inputNumOfBag = $('input[name="num_of_bag"]');
const totalPrice = $('#totalPrice');
const btnContinue = $('#btnContinue');
const totalSection = $('#total');
const formCheckOut = $('form.js-form-checkout').first();
const summaryBag = $('#summaryBag');
const summaryBagTitle = summaryBag.find('.subs__text--primary');
const summaryBagDesc = summaryBag.find('.subs__text--secondary');
const summaryFreq = $('#summaryFreq');
const summaryFreqTitle = summaryFreq.find('.js-freq');
const selectBag = $('#selectBag');
const bags = selectBag.find('.subs__item-container');
const selectFrequency = $('#selectFrequency');
const frequencies = selectFrequency.find('.subs__item-container');
btnContinue.click(function () {
selectBag.addClass('d-none');
selectFrequency.removeClass('d-none');
$(this).addClass('d-none');
});
bags.click(function () {
const title = $(this).find('.subs__text--primary').text().trim();
const desc = $(this).find('.subs__text--secondary').text().trim();
const price = $(this).data('price');
summaryBagTitle.text(title);
summaryBagDesc.text(desc);
totalPrice.text(price);
summaryBag.removeClass('d-none');
btnContinue.removeClass('d-none');
totalSection.removeClass('d-none');
inputAttributePaBag.val($(this).data('slug'));
inputVariationId.val($(this).data('id'));
inputNumOfBag.val($(this).data('num-of-bag'));
});
frequencies.click(function () {
const title = $(this).find('.subs__text--primary').text().trim().toLowerCase();
summaryFreqTitle.text(title);
summaryFreq.removeClass('d-none');
formCheckOut.removeClass('d-none');
inputFrequency.val($(this).data('value'));
});
});
......@@ -119,7 +119,7 @@ function rrc_corn_schedules() {
* Cron Job by order type
*/
// add_action( 'woocommerce_thankyou', 'rrc_subscription_wc_automatic_re_order', 10, 1 );
add_action( 'woocommerce_process_shop_order_meta', 'rrc_subscription_wc_automatic_re_order', 10, 1 );
//add_action( 'woocommerce_process_shop_order_meta', 'rrc_subscription_wc_automatic_re_order', 10, 1 );
function rrc_subscription_wc_automatic_re_order( $order_id ) {
if ( ! $order_id ) {
return;
......
......@@ -277,15 +277,10 @@ function rangrangcoffee_scripts() {
wp_enqueue_script( 'product-detail', get_template_directory_uri() . "/assets/js/product-detail.js", array(), 'all' );
}
// TODO: Not use
if ( is_page_template( 'templates/template-selection-subscription-plan.php' ) ) {
wp_enqueue_script( 'coffee-sub', get_template_directory_uri() . "/assets/js/coffee-sub.js", array(), 'all' );
}
if ( is_page_template( 'templates/template-select-coffee-subscription.php' ) ) {
wp_enqueue_script( 'coffee-sub', get_template_directory_uri() . "/assets/js/select-coffee-subscription.js", array(), 'all' );
}
if ( is_page_template( 'templates/template-gift-details.php' ) ) {
wp_enqueue_script( 'gift-sub', get_template_directory_uri() . "/assets/js/gift-sub.js", array(), 'all' );
}
......
This diff is collapsed.
......@@ -13,10 +13,16 @@ get_header();
<?php
$shop_url = get_permalink( get_option( 'woocommerce_shop_page_id' ) );
$product_id = $_GET['product_id'];
$product = wc_get_product( $product_id );
$product_id = $_GET['product_id'];
$product = wc_get_product( $product_id );
if ( ! $product ) {
echo "<script>window.location.href = '" . get_the_permalink( pll_get_post( get_page_by_path( 'cart' )->ID ) ) . "'</script>";
}
$price = $product->get_price();
$is_coffee_sub = rrc_is_coffee_subscription_product( $product_id );
$is_coffee_sub = rrc_is_coffee_sub_product( $product_id );
$quantity = null;
foreach ( WC()->cart->get_cart() as $cart_item ) {
......@@ -50,11 +56,12 @@ foreach ( WC()->cart->get_cart() as $cart_item ) {
<p class="f16 mb-1 text-capitalize"><?php echo $product->get_name(); ?></p>
<p class="f12 font-italic text-capitalize"><?php echo $product->get_short_description(); ?></p>
<?php if ( ! $is_coffee_sub ) { ?>
<?php if ( $is_coffee_sub ) { ?>
<a class="custom-link text-decoration-none" href="<?php echo wc_get_cart_url(); ?>">
<?php pll_e( 'View cart' ); ?>
</a>
<?php } else { ?>
<p class="f16 fw600 mb-2"><?php echo wc_price( $price ); ?></p>
<?php } ?>
<?php if ( ! $is_coffee_sub ) { ?>
<div class="f14 mb-1">
QTY: <?php echo $quantity; ?>
<a class="custom-link text-decoration-none" href="<?php echo wc_get_cart_url(); ?>">
......@@ -62,6 +69,7 @@ foreach ( WC()->cart->get_cart() as $cart_item ) {
</a>
</div>
<?php } ?>
</div>
</div>
......@@ -74,13 +82,13 @@ foreach ( WC()->cart->get_cart() as $cart_item ) {
<?php pll_e( 'Cart Summary' ); ?>
</h2>
<div class="d-flex justify-content-between f16 mb-3">
<span>
<?php
$count = WC()->cart->get_cart_contents_count();
echo sprintf( _n( '%d item', '%d items', $count ), $count );
echo pll__( ' in your cart' );
?>
</span>
<span>
<?php
$count = WC()->cart->get_cart_contents_count();
echo sprintf( _n( '%d item', '%d items', $count ), $count );
echo pll__( ' in your cart' );
?>
</span>
<a class="custom-link text-decoration-none" href="<?php echo wc_get_cart_url(); ?>">
<?php pll_e( 'Edit cart' ); ?>
</a>
......
<?php
/**
* Template Name: Select coffee subscription Template
*
* Template for selecting coffee subscription
*
* @package Rang_Rang_Coffee
*/
get_header();
?>
<?php
// https://coffee-shop.dev/select-coffee-subscription/?product_id=1765
$product_id = isset( $_GET['product_id'] ) ? absint( $_GET['product_id'] ) : null;
if (!$product_id) {
echo "<script>window.location.href='" . home_url() . "';</script>";
}
$product = wc_get_product( $product_id );
// Check product is subscribable
$is_enable_subscription = get_field( 'enable_subscription', $product_id );
function tscs_input_hidden( $name, $value ) { ?>
<input type="hidden" name="<?php echo $name; ?>" value="<?php echo $value; ?>">
<?php
}
function tscs_render_bag( $product ) {
if ( $product instanceof WC_Product ) {
$price = $product->get_price();
$bag_types = get_field( 'bag_types', $product->get_id() );
foreach ( $bag_types as $bag_type ) {
$num_of_bag = absint( $bag_type['num_of_bag'] );
$image_url = $bag_type['bag_image']['sizes']['thumbnail'];
$text_primary = $num_of_bag . ' ' . rrc_plural( pll__( 'bag' ), pll__( 'bags' ), $num_of_bag );
$real_price = $price * $num_of_bag;
$currency_symbol = get_woocommerce_currency_symbol();
?>
<div class="col-md-6 col-12 p-2">
<div class="subs__item-container"
data-id="0"
data-price="<?php echo "$real_price$currency_symbol" ?>"
data-num-of-bag="<?php echo $num_of_bag ?>">
<img class="subs__item-img" src="<?php echo $image_url ?>" alt="<?php _e( $text_primary . ' image' ) ?>">
<h5 class="subs__text--primary"><?php echo $text_primary ?> </h5>
<!-- <p class="subs__text--secondary">desc</p> -->
<!-- <p class="subs__text--price"><?php echo wc_price( $real_price ) ?></p> -->
</div>
</div>
<?php
}
}
}
function tscs_render_frequency( $product_id ) {
$data_to_render = array(
array(
'value' => '1',
'name' => 'every week',
'image' => 'everyweek',
),
array(
'value' => '2',
'name' => 'every other week',
'image' => 'everyotherweek',
),
array(
'value' => '3',
'name' => 'every 3 weeks',
'image' => 'every3week',
),
array(
'value' => '4',
'name' => 'every 4 weeks',
'image' => 'every4week',
),
);
foreach ( $data_to_render as $value ) {
$img_name = $value['image'];
$img_url = get_theme_file_uri( "/assets/img/weeks/$img_name.svg" );
?>
<div class="col-md-6 col-12 p-2">
<div class="subs__item-container" data-value="<?php echo $value['value']; ?>">
<img class="subs__item-img" src="<?php echo $img_url; ?>" alt="*">
<h5 class="subs__text--primary"><?php echo $value['name']; ?></h5>
</div>
</div>
<?php
}
}
?>
<main id="primary" class="site-main">
<?php if ( $is_enable_subscription ) { ?>
<section class="subs">
<div class="container my-5">
<div class="row">
<div class="col-12 col-md-8 order-1 order-md-0 my-3 subs__container-select">
<!-- select bag -->
<div class="subs__select-section" id="selectBag">
<h2
class="subs__title mt-0 mb-3"><?php pll_e( "How many bag(s) per shipment?" ) ?></h2>
<div class="row px-3">
<?php tscs_render_bag( $product ); ?>
</div>
</div>
<!-- select freq -->
<div class="subs__select-section d-none" id="selectFrequency">
<h2
class="subs__title mt-0 mb-3"><?php pll_e( "How often do you need more coffee?" ) ?></h2>
<div class="row px-3">
<?php tscs_render_frequency( $product_id ); ?>
</div>
</div>
</div>
<!-- Summary -->
<div class="col-12 col-md-4 order-0 order-md-1 my-3 subs__container-summary">
<h3 class="subs__title mt-0 mb-3"> <?php pll_e( 'Subscription Summary' ); ?> </h3>
<!-- section summary -->
<div class="subs__section-summary">
<div class="subs__text--tertiary"><?php pll_e( 'coffee type' ); ?></div>
<div class="d-flex justify-content-between my-2">
<h4 class="subs__text--primary my-0"><?php echo esc_html( $product->get_title() ); ?></h4>
<a
href="<?php echo get_the_permalink( pll_get_post( get_page_by_path( 'coffee-subscriptions' )->ID ) ) ?>"
class="custom-link"><?php pll_e( 'Change' ); ?></a>
</div>
<p class="subs__text--secondary mb-2">
<?php echo esc_html( $product->get_short_description() ); ?>
</p>
</div>
<!-- / section summary -->
<!-- summary bag -->
<div class="subs__section-summary d-none" id="summaryBag">
<div class="subs__text--tertiary"><?php pll_e( 'bag(s)' ); ?></div>
<div class="d-flex justify-content-between my-2">
<h4 class="subs__text--primary my-0">.</h4>
<a class="custom-link"
href="<?php echo $_SERVER['REQUEST_URI']; ?>"><?php pll_e( 'Change' ); ?></a>
</div>
<p class="subs__text--secondary mb-2">.</p>
</div>
<!-- summary freq -->
<div class="subs__section-summary d-none" id="summaryFreq">
<div class="subs__text--tertiary"><?php pll_e( 'frequency' ); ?></div>
<div class="d-flex justify-content-between my-2">
<h4 class="subs__text--primary my-0 js-freq">.</h4>
</div>
<p class="subs__text--secondary mb-2">
<?php pll_e( "We will mail out your first shipment" ) ?>
<b><?php echo rrc_tomorrow_date(); ?></b> <?php pll_e( "and" ) ?> <span
class="js-freq">.</span> <?php pll_e( "thereafter" ) ?>
</p>
</div>
<div class="d-none" id="total">
<hr class="mx-0"/>
<div class="d-flex justify-content-between mb-4 d-none">
<div>
<div class="subs__text--primary"><?php pll_e( "Total Per Shipment" ) ?></div>
<div class="subs__text--secondary"><?php pll_e( "shipping included" ) ?></div>
</div>
<div class="subs__text--price font-nomal" id="totalPrice">.</div>
</div>
</div>
<button class="btn-custom btn-primary w-100 d-none" id="btnContinue"><?php pll_e( "Continue" ) ?></button>
<form
action="<?php echo esc_url( apply_filters( 'woocommerce_add_to_cart_form_action', $product->get_permalink() ) ); ?>"
class="mt-2 js-form-checkout d-none"
enctype="multipart/form-data" method="post">
<?php
// tscs_input_hidden( 'product_id', $product_id );
tscs_input_hidden( 'quantity', 1 );
tscs_input_hidden( 'add-to-cart', $product_id );
tscs_input_hidden( 'order_type', 'coffee_subscription' );
tscs_input_hidden( 'frequency', '' );
tscs_input_hidden( 'num_of_bag', '' );
?>
<!-- num_of_month -->
<div class="form-group">
<label class="f16 mb-2" for="num-of-month"><?php pll_e( "Month(s)" ) ?></label>
<select name="num_of_month" class="form-control" id="num-of-month">
<option value="1"><?php echo "1 " . pll__( "Month" ) ?></option>
<option value="3"><?php echo "3 " . pll__( "Months" ) ?></option>
<option value="6"><?php echo "6 " . pll__( "Months" ) ?></option>
<option value="12"><?php echo "12 " . pll__( "Months" ) ?></option>
</select>
</div>
<button type="submit" class="btn-custom btn-primary w-100">
<?php pll_e( "Proceed To Checkout" ) ?>
</button>
<p class="subs__text--secondary mt-1 mb-0"><?php pll_e( "Pause, skip, or cancel anytime" ) ?></p>
</form>
</div>
</div>
</div>
</section>
<?php } else { ?>
<div class="container my-4">
<div class="text-center">
<h3><?php pll_e( "This product not enable subscription" ); ?></h3>
<a href="<?php echo pll_home_url() ?>" class="btn-outline text-uppercase mt-4"><?php pll_e( "Home" ); ?></a>
</div>
</div>
<?php } ?>
</main>
<?php
get_footer();
......@@ -276,7 +276,7 @@ if ( isset( $_GET['search'] ) ) {
<div class="btn-outline btn btn-regular btn-cancel no-animate mb-2"
data-dismiss="modal"><?php pll_e( 'Cancel' ) ?> </div>
<a class="btn-primary btn btn-regular ml-3 mb-2 btn-submit"
href="<?php echo wc_get_cart_url() ?>?clear-cart&urlFrom=store">
href="<?php echo get_permalink(pll_get_post(get_option('woocommerce_shop_page_id'))); ?>?clear-cart&urlFrom=store">
<?php pll_e( 'Continue' ) ?>
</a>
</div>
......
......@@ -193,7 +193,7 @@ if (isset($_GET['search'])) {
</p>
<div class=" d-flex justify-content-center flex-sm-row flex-column">
<div class="btn-outline btn btn-regular btn-cancel no-animate mb-2" data-dismiss="modal"><?php pll_e('Cancel') ?> </div>
<a class="btn-primary btn btn-regular ml-3 mb-2 btn-submit" href="<?php echo wc_get_cart_url() ?>?clear-cart&urlFrom=store">
<a class="btn-primary btn btn-regular ml-3 mb-2 btn-submit" href="<?php echo get_permalink(pll_get_post(get_option('woocommerce_cart_page_id'))); ?>?clear-cart&urlFrom=store">
<?php pll_e('Continue') ?>
</a>
</div>
......
......@@ -51,10 +51,10 @@ if ( ! isset( $_GET['urlFrom'] ) ) {
<div class="col-md-5">
<div class="custom-card ml-md-5 cart__check-out my-4 my-mt-0 mb-3">
<p class="f16 mb-2">Order total</p>
<p class="f16 mb-2"><?php pll_e('Order total') ?></p>
<p class="f48 fw600">---</p>
<p class="mt-3 mb-0"><a class="custom-link text-capitalize"
href="<?php echo wc_get_page_permalink( 'shop' ); ?>">
href="<?php echo get_locale() != "en_US"? "/".get_locale().'/shop/' : wc_get_page_permalink( 'shop' ); ?>">
<?php echo esc_html( apply_filters( 'woocommerce_return_to_shop_text', pll__( 'Return to shop' ) ) ); ?></a>
</p>
</div>
......@@ -65,8 +65,9 @@ if ( ! isset( $_GET['urlFrom'] ) ) {
} else {
?>
<script>
window.location.href = "<?php echo wc_get_page_permalink( 'shop' ); ?>";
window.location.href = "<?php echo get_locale() != "en_US"? "/".get_locale().'/shop/' : wc_get_page_permalink( 'shop' ); ?>";
</script>
<?php
} ?>
......@@ -14,7 +14,7 @@ defined( 'ABSPATH' ) || exit;
do_action( 'woocommerce_before_cart' ); ?>
<form class="woocommerce-cart-form" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
<form class="woocommerce-cart-form" action="<?php echo get_permalink(pll_get_post(get_option('woocommerce_cart_page_id'))); ?>" method="post">
<?php do_action( 'woocommerce_before_cart_table' ); ?>
<div class="container cart my-5 cart woocommerce-cart-form__contents">
......@@ -169,7 +169,7 @@ do_action( 'woocommerce_before_cart' ); ?>
<div class="row mt-4">
<div class="col">
<a class="custom-link f16 btn" href="<?php echo wc_get_cart_url(); ?>/?clear-cart">
<a class="custom-link f16 btn" href="<?php echo get_permalink(pll_get_post(get_option('woocommerce_cart_page_id'))); ?>/?clear-cart">
<?php pll_e( "Empty your cart" ) ?>
</a>
</div>
......@@ -196,7 +196,7 @@ do_action( 'woocommerce_before_cart' ); ?>
<?php pll_e( "Order total" ) ?>
</a>
<p class="mt-3 mb-3">
<a class="custom-link text-capitalize" href="<?php echo wc_get_page_permalink( 'shop' ); ?>">
<a class="custom-link text-capitalize" href="<?php echo get_permalink(pll_get_post(get_option('woocommerce_shop_page_id'))); ?>">
<?php echo esc_html( apply_filters( 'woocommerce_return_to_shop_text', pll__( 'Return to shop' ) ) ); ?>
</a>
</p>
......
......@@ -38,7 +38,7 @@ defined( 'ABSPATH' ) || exit;
<a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>"
class="pay btn-custom btn-primary mb-5 mr-3 "><?php pll_e( 'Pay' ); ?></a>
<?php if ( is_user_logged_in() ) : ?>
<a href="<?php echo esc_url( wc_get_page_permalink( 'myaccount' ) ); ?>"
<a href="<?php echo get_permalink( pll_get_post( get_option('woocommerce_myaccount_page_id') ) )?>"
class="pay btn-custom btn-primary mb-5 "><?php pll_e( 'My account' ); ?></a>
<?php endif; ?>
</p>
......
......@@ -135,7 +135,22 @@ $product_id = $product->get_id();
<div class="col-12 col-md-6 px-md-4 summary entry-summary">
<?php
// $processing_type = wp_get_object_terms( $products[$i]->get_id(), $ );
function filter_product_type( $product_id, $processing_type_slug ) {
$processing_type = wp_get_object_terms( $product_id, $processing_type_slug );
$data_filter = "";
if ( ! is_wp_error( $processing_type ) && count( $processing_type ) > 0 ) {
for ( $j = 0; $j < count( $processing_type ); $j ++ ) {
if ( $j != count( $processing_type ) - 1 ) {
$data_filter .= $processing_type[ $j ]->name . ',';
} else {
$data_filter .= $processing_type[ $j ]->name;
}
}
}
return $data_filter;
}
?>
<div class="product-detail__content">
......@@ -148,25 +163,15 @@ $product_id = $product->get_id();
</div>
<div class="product-detail__content-attr">
<span class="fw-700">Origin:</span>
<span>Comlumbia</span>
<span><?php echo filter_product_type( $product_id, 'coffee_type' ); ?></span>
</div>
<div class="product-detail__content-attr">
<span class="fw-700">Processs:</span>
<span>Washed</span>
<span><?php echo filter_product_type( $product_id, 'processing' ); ?></span>
</div>
<div class="product-detail__content-attr">
<span class="fw-700">Region:</span>
<span>Hullace, Lorem</span>
</div>
<div class="product-detail__content-attr">
<span class="fw-700">Available:</span>
<span>1400-1500 HAGL</span>
</div>
<div class="product-detail__content-attr mb-3">
<span class="fw-700">Note:</span>
<span>Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe
commodi atque aliquid quasi fuga rerum rem!
</span>
<span><?php echo filter_product_type( $product_id, 'region' ); ?></span>
</div>
<div class="product-detail__content-attr mb-3">
<span class="fw-700">Product Description:</span>
......
<?php
defined( 'ABSPATH' ) || exit;
/**
* @param string $singular
* @param string $plural
* @param int $amount
*
* @return string
*/
function rrc_plural( string $singular, string $plural, int $amount ): string {
return sprintf( $amount == 1 || $amount == 0 ? $singular : $plural, $amount );
}
/**
* Clear cart with URL
*/
......@@ -143,6 +156,9 @@ function subscriptions_endpoint_content() {
wc_get_template( "myaccount/subscriptions.php" );
}
// Custom coffee subscription new
require_once( __DIR__ . '/includes/rrr-coffee-sub.php' );
// Subscription common
require_once( __DIR__ . '/includes/rrc-subscription.php' );
......
......@@ -10,24 +10,8 @@
defined( 'ABSPATH' ) || exit;
/**
* Get tomorrow date
*
* @return string
*/
function rrc_tomorrow_date(): string {
$date_now_plus_1 = date( 'Y-m-d', strtotime( '+1 day' ) );
$month = date( 'F', strtotime( $date_now_plus_1 ) );
$day = date( 'd', strtotime( $date_now_plus_1 ) );
return "$month $day";
}
function rrc_print_coffee_subscription_desc( $cart_item ) {
$desc = 'Coffee subscription';
$desc .= '<br>' . rrc_plural( 'Every %d week', 'Every %d weeks', absint( $cart_item['frequency'] ) ) . ', ' . rrc_plural( '%d shipment', '%d shipments', absint( $cart_item['num_shipment'] ) );
echo $desc;
}
/**
* Custom tab advanced
......
......@@ -54,3 +54,4 @@ add_action( 'woocommerce_process_shop_order_meta', 'rrc_save_general_details_del
function rrc_save_general_details_delivery_date_time_timestamp( $order_id ) {
update_post_meta( $order_id, 'delivery_date_time_timestamp', strtotime( wc_clean( $_POST['delivery_date'] ) ) );
}
<?php
$a = ["1", "2" , "#$"];
foreach ($a as $dd) {
echo $dd;
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ do_action( 'woocommerce_before_account_downloads', $has_downloads ); ?>
<?php else : ?>
<div class="woocommerce-Message woocommerce-Message--info woocommerce-info">
<a class="woocommerce-Button button"
href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', get_locale() != "en_US"? "/".get_locale().'/shop/' : wc_get_page_permalink( 'shop' ) ) ); ?>">
<?php pll_e( 'Browse products' ); ?>
</a>
<?php pll_e( 'No downloads available yet.' ); ?>
......
2021-10-20T02:31:07+00:00 CRITICAL Uncaught Error: Call to a member function get_description() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php:75
Stack trace:
#0 /home/rangrang/public_html/wp-includes/widgets.php(1224): Welcome_Kit_Subscription_Section->widget(Array, Array)
#1 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(520): the_widget('Welcome_Kit_Sub...', Array)
#2 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(490): WP_REST_Widget_Types_Controller->get_widget_preview('Welcome_Kit_Sub...', Array)
#3 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(1140): WP_REST_Widget_Types_Controller->encode_form_data(Object(WP_REST_Request))
#4 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/widget-t...', Array, NULL)
#5 /home/rangrang/public_html/w in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php on line 75
2021-10-20T02:35:35+00:00 CRITICAL Uncaught Error: Call to a member function get_description() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php:75
Stack trace:
#0 /home/rangrang/public_html/wp-includes/widgets.php(1224): Welcome_Kit_Subscription_Section->widget(Array, Array)
#1 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(520): the_widget('Welcome_Kit_Sub...', Array)
#2 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(490): WP_REST_Widget_Types_Controller->get_widget_preview('Welcome_Kit_Sub...', Array)
#3 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(1140): WP_REST_Widget_Types_Controller->encode_form_data(Object(WP_REST_Request))
#4 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/widget-t...', Array, NULL)
#5 /home/rangrang/public_html/w in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php on line 75
2021-10-22T02:00:15+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php:18
Stack trace:
#0 /home/rangrang/public_html/wp-includes/template-loader.php(106): include()
#1 /home/rangrang/public_html/wp-blog-header.php(19): require_once('/home/rangrang/...')
#2 /home/rangrang/public_html/index.php(17): require('/home/rangrang/...')
#3 {main}
thrown in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php on line 18
2021-10-22T02:00:39+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php:18
Stack trace:
#0 /home/rangrang/public_html/wp-includes/template-loader.php(106): include()
#1 /home/rangrang/public_html/wp-blog-header.php(19): require_once('/home/rangrang/...')
#2 /home/rangrang/public_html/index.php(17): require('/home/rangrang/...')
#3 {main}
thrown in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php on line 18
2021-10-22T02:01:02+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php:18
Stack trace:
#0 /home/rangrang/public_html/wp-includes/template-loader.php(106): include()
#1 /home/rangrang/public_html/wp-blog-header.php(19): require_once('/home/rangrang/...')
#2 /home/rangrang/public_html/index.php(17): require('/home/rangrang/...')
#3 {main}
thrown in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php on line 18
2021-10-22T02:01:23+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php:18
Stack trace:
#0 /home/rangrang/public_html/wp-includes/template-loader.php(106): include()
#1 /home/rangrang/public_html/wp-blog-header.php(19): require_once('/home/rangrang/...')
#2 /home/rangrang/public_html/index.php(17): require('/home/rangrang/...')
#3 {main}
thrown in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php on line 18
2021-10-22T02:01:52+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php:18
Stack trace:
#0 /home/rangrang/public_html/wp-includes/template-loader.php(106): include()
#1 /home/rangrang/public_html/wp-blog-header.php(19): require_once('/home/rangrang/...')
#2 /home/rangrang/public_html/index.php(17): require('/home/rangrang/...')
#3 {main}
thrown in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php on line 18
2021-10-22T02:03:04+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php:18
Stack trace:
#0 /home/rangrang/public_html/wp-includes/template-loader.php(106): include()
#1 /home/rangrang/public_html/wp-blog-header.php(19): require_once('/home/rangrang/...')
#2 /home/rangrang/public_html/index.php(17): require('/home/rangrang/...')
#3 {main}
thrown in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php on line 18
2021-10-22T02:03:51+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php:18
Stack trace:
#0 /home/rangrang/public_html/wp-includes/template-loader.php(106): include()
#1 /home/rangrang/public_html/wp-blog-header.php(19): require_once('/home/rangrang/...')
#2 /home/rangrang/public_html/index.php(17): require('/home/rangrang/...')
#3 {main}
thrown in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/templates/template-cart-added.php on line 18
2021-10-22T02:38:53+00:00 CRITICAL Maximum execution time of 30 seconds exceeded in /home/rangrang/public_html/wp-includes/wp-db.php on line 2056
2021-10-22T03:04:10+00:00 CRITICAL Uncaught Error: Call to a member function get_description() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php:75
Stack trace:
#0 /home/rangrang/public_html/wp-includes/widgets.php(1224): Welcome_Kit_Subscription_Section->widget(Array, Array)
#1 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(520): the_widget('Welcome_Kit_Sub...', Array)
#2 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(490): WP_REST_Widget_Types_Controller->get_widget_preview('Welcome_Kit_Sub...', Array)
#3 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(1140): WP_REST_Widget_Types_Controller->encode_form_data(Object(WP_REST_Request))
#4 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/widget-t...', Array, NULL)
#5 /home/rangrang/public_html/w in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php on line 75
2021-10-22T03:12:42+00:00 CRITICAL Uncaught Error: Call to a member function get_description() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php:75
Stack trace:
#0 /home/rangrang/public_html/wp-includes/widgets.php(1224): Welcome_Kit_Subscription_Section->widget(Array, Array)
#1 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(520): the_widget('Welcome_Kit_Sub...', Array)
#2 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(490): WP_REST_Widget_Types_Controller->get_widget_preview('Welcome_Kit_Sub...', Array)
#3 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(1140): WP_REST_Widget_Types_Controller->encode_form_data(Object(WP_REST_Request))
#4 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/widget-t...', Array, NULL)
#5 /home/rangrang/public_html/w in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php on line 75
2021-10-22T03:27:21+00:00 CRITICAL Uncaught Error: Call to a member function get_description() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php:75
Stack trace:
#0 /home/rangrang/public_html/wp-includes/widgets.php(1224): Welcome_Kit_Subscription_Section->widget(Array, Array)
#1 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(520): the_widget('Welcome_Kit_Sub...', Array)
#2 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(490): WP_REST_Widget_Types_Controller->get_widget_preview('Welcome_Kit_Sub...', Array)
#3 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(1140): WP_REST_Widget_Types_Controller->encode_form_data(Object(WP_REST_Request))
#4 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/widget-t...', Array, NULL)
#5 /home/rangrang/public_html/w in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php on line 75
2021-10-22T03:27:31+00:00 CRITICAL Uncaught Error: Call to a member function get_description() on bool in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php:75
Stack trace:
#0 /home/rangrang/public_html/wp-includes/widgets.php(1224): Welcome_Kit_Subscription_Section->widget(Array, Array)
#1 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(520): the_widget('Welcome_Kit_Sub...', Array)
#2 /home/rangrang/public_html/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php(490): WP_REST_Widget_Types_Controller->get_widget_preview('Welcome_Kit_Sub...', Array)
#3 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(1140): WP_REST_Widget_Types_Controller->encode_form_data(Object(WP_REST_Request))
#4 /home/rangrang/public_html/wp-includes/rest-api/class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/widget-t...', Array, NULL)
#5 /home/rangrang/public_html/w in /home/rangrang/public_html/wp-content/themes/rangrangcoffee/inc/classes/welcome-kit-subscription-section-widget.php on line 75
2021-10-20T09:55:15+00:00 ERROR Error getting remote inbox notification data feed
2021-10-20T09:55:15+00:00 ERROR WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => cURL error 60: SSL certificate problem: certificate has expired
)
)
[error_data] => Array
(
)
[additional_data:protected] => Array
(
)
)
2021-10-20T09:55:15+00:00 ERROR Error getting remote inbox notification data feed
2021-10-20T09:55:15+00:00 ERROR WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => cURL error 60: SSL certificate problem: certificate has expired
)
)
[error_data] => Array
(
)
[additional_data:protected] => Array
(
)
)
2021-10-22T02:05:35+00:00 ERROR Error getting remote inbox notification data feed
2021-10-22T02:05:35+00:00 ERROR WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => cURL error 60: SSL certificate problem: certificate has expired
)
)
[error_data] => Array
(
)
[additional_data:protected] => Array
(
)
)
2021-10-22T02:05:35+00:00 ERROR Error getting remote inbox notification data feed
2021-10-22T02:05:35+00:00 ERROR WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => cURL error 60: SSL certificate problem: certificate has expired
)
)
[error_data] => Array
(
)
[additional_data:protected] => Array
(
)
)
2021-10-22T02:16:18+00:00 ERROR Error getting remote inbox notification data feed
2021-10-22T02:16:18+00:00 ERROR WP_Error Object
(
[errors] => Array
(
[http_request_failed] => Array
(
[0] => cURL error 60: SSL certificate problem: certificate has expired
)
)
[error_data] => Array
(
)
[additional_data:protected] => Array
(
)
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment