Commit 139ae98a by Pham Huy

update price-tpl

parent 6c5b9222
...@@ -57,7 +57,7 @@ if ( post_password_required() ) { ...@@ -57,7 +57,7 @@ if ( post_password_required() ) {
* @hooked woocommerce_template_single_sharing - 50 * @hooked woocommerce_template_single_sharing - 50
* @hooked WC_Structured_Data::generate_product_data() - 60 * @hooked WC_Structured_Data::generate_product_data() - 60
*/ */
do_action( 'woocommerce_single_product_summary' ); //do_action( 'woocommerce_single_product_summary' );
?> ?>
</div> </div>
......
...@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
get_header( 'shop' ); ?> get_header(); ?>
<?php <?php
/** /**
...@@ -43,7 +43,7 @@ get_header( 'shop' ); ?> ...@@ -43,7 +43,7 @@ get_header( 'shop' ); ?>
* *
* @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content) * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
*/ */
do_action( 'woocommerce_after_main_content' ); // do_action( 'woocommerce_after_main_content' );
?> ?>
<?php <?php
...@@ -52,9 +52,9 @@ get_header( 'shop' ); ?> ...@@ -52,9 +52,9 @@ get_header( 'shop' ); ?>
* *
* @hooked woocommerce_get_sidebar - 10 * @hooked woocommerce_get_sidebar - 10
*/ */
do_action( 'woocommerce_sidebar' ); // do_action( 'woocommerce_sidebar' );
?> ?>
<?php get_footer( 'shop' ); <?php get_footer();
/* Omit closing PHP tag at the end of PHP files to avoid "headers already sent" issues. */ /* Omit closing PHP tag at the end of PHP files to avoid "headers already sent" issues. */
...@@ -947,24 +947,44 @@ function get_hansel_and_gretel_breadcrumbs() ...@@ -947,24 +947,44 @@ function get_hansel_and_gretel_breadcrumbs()
/** /**
* Customize theme woocomerce * Customize theme woocomerce
*/ */
// function ahoadon_add_woocommerce_support() { function ahoadon_add_woocommerce_support() {
// add_theme_support( 'woocommerce', array( add_theme_support( 'woocommerce', array(
// 'thumbnail_image_width' => 150, 'thumbnail_image_width' => 150,
// 'single_image_width' => 300, 'single_image_width' => 300,
// // 'product_grid' => array( // 'product_grid' => array(
// // 'default_rows' => 3, // 'default_rows' => 3,
// // 'min_rows' => 2, // 'min_rows' => 2,
// // 'max_rows' => 8, // 'max_rows' => 8,
// // 'default_columns' => 3, // 'default_columns' => 3,
// // 'min_columns' => 2, // 'min_columns' => 2,
// // 'max_columns' => 5, // 'max_columns' => 5,
// // ), // ),
// ) ); ) );
// } }
// add_action( 'after_setup_theme', 'ahoadon_add_woocommerce_support' ); add_action( 'after_setup_theme', 'ahoadon_add_woocommerce_support' );
add_theme_support('woocommerce');
// function ahoadon_add_woocommerce_support() { // function woocommerce_product_category( $args = array() ) {
// add_theme_support( 'woocommerce' ); // $woocommerce_category_id = get_queried_object_id();
// $args = array(
// 'parent' => $woocommerce_category_id
// );
// $terms = get_terms( 'product_cat', $args );
// if ( $terms ) {
// echo '<ul class="woocommerce-categories">';
// foreach ( $terms as $term ) {
// echo '<li class="woocommerce-product-category-page">';
// woocommerce_subcategory_thumbnail( $term );
// echo '<h2>';
// echo '<a href="' . esc_url( get_term_link( $term ) ) . '" class="' . $term->slug . '">';
// echo $term->name;
// echo '</a>';
// echo '</h2>';
// echo '</li>';
// }
// echo '</ul>';
// }
// } // }
// add_action( 'after_setup_theme', 'ahoadon_add_woocommerce_support' ); // add_action( 'woocommerce_before_shop_loop', 'woocommerce_product_category', 100 );
\ No newline at end of file
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
\ No newline at end of file
...@@ -9,33 +9,75 @@ ...@@ -9,33 +9,75 @@
get_header(); get_header();
?> ?>
<!--Chỉnh sửa css button khi hover -->
<!--Chỉnh sửa reponsive--> <?php get_template_part( 'template-parts/content', 'intro-slider' ); ?>
<section id="intro-hd">
<div class="container container-fluid">
<article class="row introduce">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<h2>A HÓA ĐƠN</h2>
<p class="sub-tit">Giải pháp hóa đơn điện tử chuyên nghiệp</p>
<p><span class="txt-red">A hóa đơn</span> giúp dễ dàng tạo lập, phát hành, quản lý hóa đơn với nhiều tính năng cao cấp, phù hợp đa dạng loại hình, quy mô doanh nghiệp</p>
<div id="lienket">
<div class="btn btn-1 wow zoomIn"><a href="#">Đăng ký sử dụng</a></div>
<div class="btn btn-2 wow zoomIn"><a href="#">Đăng ký đại lý</a></div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
<?php echo do_shortcode("[URIS id=18]"); ?>
</div>
</article>
</div>
</section>
<section id="prices"> <section id="prices">
<div class="container"> <div class="container">
<h2 class="prices-title">BẢNG GIÁ PHẦN MỀM A HÓA ĐƠN</h2> <h2 class="prices-title">BẢNG GIÁ PHẦN MỀM A HÓA ĐƠN</h2>
<div class="row"> <div class="row">
<?php
<?php echo do_shortcode('[products limit="12" columns="3" ]')?> // Products per page
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4"> $per_page = 10;
if ( get_query_var( 'taxonomy' ) ) { // If on a product taxonomy archive (category or tag)
$args = array(
'post_type' => 'product',
'posts_per_page' => $per_page,
'paged' => get_query_var( 'paged' ),
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_key' => '_price',
'tax_query' => array(
array(
'taxonomy' => get_query_var( 'taxonomy' ),
'field' => 'slug',
'terms' => get_query_var( 'term' ),
),
),
);
} else { // On main shop page
$args = array(
'post_type' => 'product',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_key' => '_price',
'posts_per_page' => $per_page,
'paged' => get_query_var( 'paged' ),
);
}
// Set the query
$products = new WP_Query( $args );
$home_url = home_url( $wp->request );
// Standard loop
if ( $products->have_posts() ) :
while ( $products->have_posts() ) : $products->the_post();
// Your new HTML markup goes here
global $product;
global $wp;
// print_r($product);
// echo '<br /><a href="'.get_permalink().'">' . woocommerce_get_product_thumbnail().' '.get_the_title().'</a>';
?>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"><?php the_title(); ?></h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title"><?php echo number_format($product->get_attribute( 'so-luong-hoa-don' ),0,",","."); ?></h5>
<p class="card-text">Giá tiền</p>
<p class="card-money"><?php echo $product->get_price_html()?></p>
<a href="<?php echo get_permalink() . do_shortcode('[add_to_cart_url id="'.$product->ID.'"]')?>" class="btn btn-primary">Mua ngay</a>
<?php //echo do_shortcode('[add_to_cart id="'.$product->ID.'" style="border-right:1px solid #ccc"]')?>
</article>
</div>
</div>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
<?php //echo do_shortcode('[products limit="12" columns="3" ]') ?>
<!-- <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY"> <div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 100 </h2> <h2 class="card-header"> AHD 100 </h2>
<article class="card-body"> <article class="card-body">
...@@ -46,139 +88,7 @@ get_header(); ...@@ -46,139 +88,7 @@ get_header();
<a href="#" class="btn btn-primary">Mua ngay</a> <a href="#" class="btn btn-primary">Mua ngay</a>
</article> </article>
</div> </div>
</div> </div>-->
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 200 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">200</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">190.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 300 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">3.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">250.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 500 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">500</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">390.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 1.000 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">1.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">740.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 3.000 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">3.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">1.560.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 5.000 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">5.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">2.350.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 10.000 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">10.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">3.900.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 20.000 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">20.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">7.200.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 50.000 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">50.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">19.500.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 100.000 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">100.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">35.000.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card text-center box-price wow flipInY">
<h2 class="card-header"> AHD 500.000 </h2>
<article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title">500.000</h5>
<p class="card-text">Giá tiền</p>
<p class="card-money">140.000.000</p>
<a href="#" class="btn btn-primary">Mua ngay</a>
</article>
</div>
</div>
</div> </div>
<div class="row text-center price_fee"> <div class="row text-center price_fee">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
......
<?php get_header(); ?> <?php get_header(); ?>
<div class="container"> <?php get_template_part( 'template-parts/content', 'intro-slider' ); ?>
<section id="prices">
<div class="container">
<h2 class="prices-title">BẢNG GIÁ PHẦN MỀM A HÓA ĐƠN</h2>
<div class="row"> <div class="row">
<main class="col-xs-12 col-sm-12 col-md-9 col-lg-9"> <!-- <main class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> -->
<?php <?php
// Only run on shop archive pages, not single products or other pages // Only run on shop archive pages, not single products or other pages
...@@ -10,10 +13,13 @@ ...@@ -10,10 +13,13 @@
$per_page = 10; $per_page = 10;
if ( get_query_var( 'taxonomy' ) ) { // If on a product taxonomy archive (category or tag) if ( get_query_var( 'taxonomy' ) ) { // If on a product taxonomy archive (category or tag)
$args = array( $args = array(
'post_type' => 'product', 'post_type' => 'product',
'posts_per_page' => $per_page, 'posts_per_page' => $per_page,
'paged' => get_query_var( 'paged' ), 'paged' => get_query_var( 'paged' ),
'tax_query' => array( 'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_key' => '_price',
'tax_query' => array(
array( array(
'taxonomy' => get_query_var( 'taxonomy' ), 'taxonomy' => get_query_var( 'taxonomy' ),
'field' => 'slug', 'field' => 'slug',
...@@ -23,24 +29,39 @@ ...@@ -23,24 +29,39 @@
); );
} else { // On main shop page } else { // On main shop page
$args = array( $args = array(
'post_type' => 'product', 'post_type' => 'product',
'orderby' => 'date', 'orderby' => 'meta_value_num',
'order' => 'DESC', 'order' => 'ASC',
'meta_key' => '_price',
'posts_per_page' => $per_page, 'posts_per_page' => $per_page,
'paged' => get_query_var( 'paged' ), 'paged' => get_query_var( 'paged' ),
); );
} }
// Set the query // Set the query
$products = new WP_Query( $args ); $products = new WP_Query( $args );
$home_url = home_url( $wp->request );
// Standard loop // Standard loop
if ( $products->have_posts() ) : if ( $products->have_posts() ) :
while ( $products->have_posts() ) : $products->the_post(); while ( $products->have_posts() ) : $products->the_post();
// Your new HTML markup goes here // Your new HTML markup goes here
global $product;
global $wp;
// print_r($product);
// echo '<br /><a href="'.get_permalink().'">' . woocommerce_get_product_thumbnail().' '.get_the_title().'</a>';
?> ?>
<div class="col-xs-12 col-md-3"> <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<h2><?php the_title(); ?></h2> <div class="card text-center box-price wow flipInY">
<?php the_content(); ?> <h2 class="card-header"><?php the_title(); ?></h2>
<?php // more stuff here... markup, classes etc. ?> <article class="card-body">
<p class="card-text">Số hóa đơn</p>
<h5 class="card-title"><?php echo number_format($product->get_attribute( 'so-luong-hoa-don' ),0,",","."); ?></h5>
<p class="card-text">Giá tiền</p>
<p class="card-money"><?php echo number_format($product->price,0,',','.')?></p>
<a href="<?php echo get_permalink() . do_shortcode('[add_to_cart_url id="'.$product->ID.'"]')?>" class="btn btn-primary">Mua ngay</a>
<?php //echo do_shortcode('[add_to_cart id="'.$product->ID.'" style="border-right:1px solid #ccc"]')?>
</article>
</div>
</div> </div>
<?php <?php
endwhile; endwhile;
...@@ -51,8 +72,8 @@ ...@@ -51,8 +72,8 @@
} }
?> ?>
</main> <!-- </main> -->
</div> </div>
</div> </div>
</div> </section>
<?php get_footer(); ?> <?php get_footer(); ?>
\ No newline at end of file
2019-12-23T03:18:05+00:00 CRITICAL Uncaught Error: Call to a member function get_price() on boolean in E:\xampp724\htdocs\ahoadon\wp-content\themes\ahoadonviet\template-parts\price-tpl.php:82
Stack trace:
#0 E:\xampp724\htdocs\ahoadon\wp-includes\template-loader.php(78): include()
#1 E:\xampp724\htdocs\ahoadon\wp-blog-header.php(19): require_once('E:\\xampp724\\htd...')
#2 E:\xampp724\htdocs\ahoadon\index.php(17): require('E:\\xampp724\\htd...')
#3 {main}
thrown in E:\xampp724\htdocs\ahoadon\wp-content\themes\ahoadonviet\template-parts\price-tpl.php on line 82
2019-12-23T02:52:07+00:00 INFO Regenerating images for attachment ID: 72
2019-12-23T02:52:08+00:00 INFO Regenerating images for attachment ID: 69
2019-12-23T02:52:08+00:00 INFO Regenerating images for attachment ID: 68
2019-12-23T02:52:09+00:00 INFO Regenerating images for attachment ID: 67
2019-12-23T02:52:10+00:00 INFO Regenerating images for attachment ID: 66
2019-12-23T02:52:10+00:00 INFO Regenerating images for attachment ID: 65
2019-12-23T02:52:11+00:00 INFO Regenerating images for attachment ID: 64
2019-12-23T02:52:11+00:00 INFO Regenerating images for attachment ID: 63
2019-12-23T02:52:12+00:00 INFO Regenerating images for attachment ID: 62
2019-12-23T02:52:12+00:00 INFO Regenerating images for attachment ID: 61
2019-12-23T02:52:13+00:00 INFO Regenerating images for attachment ID: 45
2019-12-23T02:52:13+00:00 INFO Regenerating images for attachment ID: 41
2019-12-23T02:52:14+00:00 INFO Regenerating images for attachment ID: 40
2019-12-23T02:52:14+00:00 INFO Regenerating images for attachment ID: 39
2019-12-23T02:52:15+00:00 INFO Regenerating images for attachment ID: 38
2019-12-23T02:52:15+00:00 INFO Regenerating images for attachment ID: 28
2019-12-23T02:52:16+00:00 INFO Regenerating images for attachment ID: 27
2019-12-23T02:52:16+00:00 INFO Regenerating images for attachment ID: 26
2019-12-23T02:52:17+00:00 INFO Regenerating images for attachment ID: 21
2019-12-23T02:52:17+00:00 INFO Regenerating images for attachment ID: 20
2019-12-23T02:52:18+00:00 INFO Regenerating images for attachment ID: 19
2019-12-23T02:52:18+00:00 INFO Regenerating images for attachment ID: 6
2019-12-23T02:52:18+00:00 INFO Completed product image regeneration job.
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