رفتن به مطلب

جا به جا کردن تب محصولات


chemist

پست های پیشنهاد شده

با سلام و عرض خسته نباشید؛

تو سایتم محصولات سه تا تب دارند؛ ویژگی ها، شرایط استفاده و توضیحات که تب ویژگی ها در اول قرار داره و پیش فرض انتخاب شده است. آیا امکان جا به جا کردن تب ها وجود دارد؟

چطور میتونم تب توضیحات رو به عنوان تب پیش فرض و اول محصولات قرار بدم؟

ممنون میشم اگه لطف بفرمائید و راهنماییم کنین

لینک به ارسال

سلام

جهت آشنایی با روند تغییر در ووکامرس

این هم جواب شما

function woo_reorder_tabs( $tabs ) {
    $tabs['additional_information']['priority'] = 5;
    $tabs['description']['priority'] = 10;
    $tabs['reviews']['priority'] = 15;

    return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );

اطلاعات بیشتر در این مورد

لینک به ارسال

با تشکر از استاد همه فن حریف ووکامرس، آقا مهدی عزیز؛

بنده کدی که فرمودین رو در فایل functions.php قالب جایگذاری کردم ولی نتیجه ای حاصل نشد. گفتم فایل content-single-product.php رو اینجا بذارم تا بهتر بتونین راهنمایی بفرمائین.

<?php
   /**
    * The template for displaying product content in the single-product.php template
    *
    * Override this template by copying it to yourtheme/woocommerce/content-single-product.php
    *
    * @author 		WooThemes
    * @package 	WooCommerce/Templates
    * @version     1.6.4
    */
   
   if ( ! defined( 'ABSPATH' ) ) {
   	exit; // Exit if accessed directly
   }
   	global $product;
   
   	$prtype = $product->get_type();
   
   
   ?>
<?php
   /**
    * woocommerce_before_single_product hook
    *
    * @hooked wc_print_notices - 10
    */
    do_action( 'woocommerce_before_single_product' );
   
    if ( post_password_required() ) {
    	echo get_the_password_form();
    	return;
    }
   ?>
<div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php post_class(); ?>>
   <div class="container-fluid">
      <div id="top-3-slice" class="row">
         <div class="container">
            <div class="row">
               <div id="left-menu" class="col-lg-3 col-sm-3">
                  <ul>
                     <li><i class="fa fa-home fa-2x"></i><a href="<?php echo site_url(); ?>">صفحه نخست</a></li>
                     <?php
                        $cucat_tmp = get_the_terms( get_the_id(), 'product_cat');
                        if (count($cucat_tmp) == 2) {
                        	$cucat = $cucat_tmp[1];
                        } else {
                        	$cucat = $cucat_tmp[0];
                        }
                        print_single_left_cats($cucat->parent, $cucat->term_id);
                        ?>
                  </ul>
               </div>
               <div id="slider single-slider" class="col-lg-9 col-sm-9">
                  <div class="slider-p single-slider-p col-lg-12 col-sm-12 col-xs-12">
                     <div class="single-title col-lg-12 col-sm-12">
                        <?php the_excerpt(); ?>
                     </div>
                     <?php
                        /**
                         * woocommerce_before_single_product_summary hook
                         *
                         * @hooked woocommerce_show_product_sale_flash - 10
                         * @hooked woocommerce_show_product_images - 20
                         */
                        do_action( 'woocommerce_before_single_product_summary' );
						
                        ?>
                     
                     <div class="slider-detials single-slider-detials col-lg-4 col-md-4 col-sm-5 col-xs-12">
                        <footer>
                        	<?php 
								if ($product->product_type == 'variable') {
									$display_price = wc_price($product->get_display_price($product->get_variation_price())) . $product->get_price_suffix();
									$display_regular_price = wc_price($product->get_display_price($product->get_variation_regular_price())) . $product->get_price_suffix();
									$discount = round(($product->get_display_price($product->get_variation_price()) / $product->get_display_price($product->get_variation_regular_price())) * 100 - 100) . '%';
									$savings = wc_price($product->get_display_price($product->get_variation_regular_price()) - $product->get_display_price($product->get_variation_price()));
								} else {
									$display_price = wc_price($product->get_display_price()) . $product->get_price_suffix();
									$display_regular_price = wc_price($product->get_display_price($product->get_regular_price())) . $product->get_price_suffix();
									$discount = round(($product->get_display_price() / $product->get_display_price($product->get_regular_price())) * 100 - 100) . '%';
									$savings = wc_price($product->get_display_price($product->get_regular_price()) - $product->get_display_price());
								}
							?>
                           <div class="payable col-lg-10 col-sm-10 col-xs-11">
                              <p>پرداختی شما :</p>
                              <p class="payable-price"><?php echo $display_price; ?></small></p>
                           </div>
                           <div class="discount col-lg-2 col-sm-2 col-xs-1">
                              <div class="discount-cont">
                                 <p><?php echo trim($discount, '-'); ?></p>
                                 <small>تخفیف</small>
                              </div>
                           </div>
                               <table class="information col-lg-12">
                                    <tbody>
                                        <tr>
                                            <td class="profit">
                                                سود شما 
                                                <p><?php echo $savings; ?></p>
                                            </td>
                                           <td>
                                                قیمت واقعی
                                                <p class="reqular">
                                                    <?php echo $display_regular_price; ?>
                                                </p>
                                            </td>
                                        </tr>
                                        
                                        <tr class="count-sale">
                                            <?php setPostViews(get_the_id());
												$count_stat = of_get_option('count_sale_radio'); 
												if($count_stat == "" || $count_stat == "0"){
											?>
                                                <td colspan="10">
                                                    تعداد خریداری شده 
													<?php $tsol = get_post_meta( $product->id, 'total_sales', true ); ?>
                                                    <p>
                                                        <?php 
                                                            if(empty ($tsol)){
                                                                echo '0';	
                                                            }else{
                                                                echo get_post_meta( $product->id, 'total_sales', true );	
                                                            }
                                                        ?>
                                                    </p>
                                                </td>
                                            <?php } elseif($count_stat == "1"){ ?>
                                                <td colspan="10">
                                                    تعداد بازدید 
                                                    <p><?php echo getPostViews(get_the_id()); ?></p>
                                                </td>
                                            <?php } elseif($count_stat == "2"){ ?>
                                            	<td>
	                                            	 تعداد خریداری شده 
													<?php $tsol = get_post_meta( $product->id, 'total_sales', true ); ?>
                                                    <p>
                                                        <?php 
                                                            if(empty ($tsol)){
                                                                echo '0';	
                                                            }else{
                                                                echo get_post_meta( $product->id, 'total_sales', true );	
                                                            }
                                                        ?>
                                                    </p>
                                           		</td>
                                                <td>
                                                    تعداد بازدید 
                                                    <p><?php echo getPostViews(get_the_id()); ?></p>
                                                </td>
                                            <?php } ?>
                                        </tr>
                                        
                                        <tr>
                                            <td colspan="10">
                                               
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
							   <div class="timer-panel col-lg-12 col-sm-12 col-xs-12">
									<div class="deals-timing-front">
										<?php do_action( 'woocommerce_after_single_product_summary' );?>
									</div>
							   </div>
							   <?php do_action( 'woocommerce_single_product_summary' ); ?>
                        </footer>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <div class="attr-cont container">
         <div class="row">
            <div class="col-lg-12 col-sm-12">
               <div class="single-product-container col-lg-12 col-sm-12 col-xs-12">
                  <div class="tabs-panel col-lg-8 col-md-7 col-sm-7">
                     <div class="tabs">
                        <ul>
                           <li class="tab1 active-tab"><span class="tbs">ویژگی ها</span></li>
                           <li class="tab2"><span>شرایط استفاده</span></li>
                           <li class="tab3"><span>توضیحات</span></li>
                        </ul>
                     </div>
                     <div id="tab1" class="product-attr tab-p col-lg-12 col-sm-12">
                        <footer>
                           <?php echo get_post_meta(get_the_id(),'hkh_product_attr',true); ?>
                        </footer>
                     </div>
                     <div id="tab2" class="offer tab-p col-lg-12 col-sm-12">
                        <footer>
                           <?php echo get_post_meta(get_the_id(),'hkhtow_product_attr',true); ?>
                        </footer>
                     </div>
                     <div id="tab3" class="tab-p col-lg-12 col-sm-12">
                       <footer>
                          <?php the_content(); ?>
                       </footer>
                     </div>
                  </div>
                  <div class="col-lg-4 col-md-5 col-sm-5">
                     <div class="user-attr-p col-lg-12 col-sm-12">
                        <header class="net-title col-lg-12 col-sm-12 col-xs-12">
                           <h4 class="col-lg-7 col-sm-7 col-xs-8">مشخصات فروشنده</h4>
                        </header>
                        <footer>
                           <div class="offer-adress">
                              <?php $user_info = get_userdata($post->post_author);
                                 $userlvl = implode(', ', $user_info->roles);
                                 	if ($userlvl == 'vendor'){ ?>
                              <span>
                              نام فروشگاه :
                              <a href="<?php 
                                 $wcv_settings = get_option('wc_prd_vendor_options');
                                 $wcv_perm = $wcv_settings['vendor_shop_permalink'];
                                 $shop = $post->post_author;
                                 $shopkey = 'pv_shop_slug';
                                 $shop_link = site_url($wcv_perm . get_user_meta( $shop, $shopkey, true ));
                                 echo $shop_link;
                                 ?>" target="_blank">
                              <?php global $post;
                                 $user_id = $post->post_author;
                                 $key = 'pv_shop_name';
                                 $single = true;
                                 $user_last = get_user_meta( $user_id, $key, $single );
                                 echo $user_last;
                                 ?>
                              </a>
                              </span><br /><?php } ?>
                              <span>آدرس :</span>
                              <?php 
							  	$disaddress = get_post_meta(get_the_id(),'meta-text-address',true);
							  	if(!$disaddress) {
							  		the_author_meta('billing_address_1', $post->post_author ); 
								} else {
									echo $disaddress;
								}
								?> 
                              <br />
                              شماره تماس : <?php echo get_post_meta(get_the_id(),'meta-text-tell',true);
                                 $weburl = get_post_meta(get_the_id(),'meta-text-weburl',true);
                                 if(!empty($weburl)) { ?>
                              <br />
                              <a href="<?php echo get_post_meta(get_the_id(),'meta-text-weburl',true); ?>" target="_blank">مشاهده وب سایت</a>
                              <?php } ?>
                           </div>
                           <br />
                            <?php 
								global $product;
								$deal_markers = get_post_meta($product->id, 'deal_markers', true);
								wc_get_template('map_tab.php', array('deal_markers' => $deal_markers), '', WCD_DIR . 'templates/');
							?>
                        </footer>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <div class="attr-cont container">
         <div class="row">
            <div class="col-lg-12 col-sm-12">
               <div class="single-product-container memo col-lg-12 col-sm-12">
                  <div class="memo-p product-tag col-lg-12 col-sm-12">
                    <header class="comment-title net-title col-lg-12 col-sm-12 col-xs-12">
                       <h4 class="col-lg-7 col-sm-7 col-xs-8">برچسب ها</h4>
                    </header>
                    <footer>
                    	<?php echo $product->get_tags( ' ', '' );  ?>
                    </footer>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <div class="attr-cont container">
         <div class="row">
            <div class="col-lg-12 col-sm-12">
               <div class="single-product-container memo col-lg-12 col-sm-12">
                  <div class="memo-p col-lg-12 col-sm-12">
                     <?php comments_template('/comments.php'); ?>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
   <div class="container">
      <div class="netbargim">
         <div class="row">
            <div class="today-net col-lg-12 col-sm-12 col-xs-12">
               <header class="net-title col-lg-12 col-sm-12 col-xs-12">
                  <span class="small-bar">
                  <?php
                     echo '<img src="';
                     switch(of_get_option('theme_color_radio')){
                     	case '2':
                     		echo get_bloginfo("template_url") . '/images/orange/small-bar.png';		
                     		break;	
                     
                     	case '3':
                     		echo get_bloginfo("template_url") . '/images/blue/small-bar.png';	
                     		break;
                     
                     	case '4':
                     		echo get_bloginfo("template_url") . '/images/green/small-bar.png';		
                     		break;
                     		
                     	default:
                     		echo get_bloginfo("template_url") . '/images/small-bar.png';
                     }
                     echo '" width="25" height="20" alt="bar-code" />';
                     ?>
                  </span>
                  <h4 class="col-lg-7 col-sm-7 col-xs-8"><?php echo of_get_option('netbarg_title','نت برگ'); ?> های مرتبط</h4>
               </header>
            </div>
         </div>
         <div class="row">
            <?php
				if ( empty( $product ) || ! $product->exists() ) {
					return;
				}
				$q_time = time() + 12600;
				$related = $product->get_related( $posts_per_page );
				
				if ( sizeof( $related ) == 0 ) return;
				
				$args = apply_filters( 'woocommerce_related_products_args', array(
					'post_type'            => 'product',
					'ignore_sticky_posts'  => 1,
					'no_found_rows'        => 1,
					'posts_per_page'       => $posts_per_page,
					'orderby'              => $orderby,
					'post__in'             => $related,
					'post__not_in'         => array( $product->id ),
					'meta_key' => '_sale_price_dates_to',
					'meta_value' => $q_time,
					'meta_compare' => '>',
				) );
				
				$products = new WP_Query( $args );
				
				$woocommerce_loop['columns'] = $columns;
               
               if ( $products->have_posts() ) : ?>
            <?php while ( $products->have_posts() ) : $products->the_post(); 
				global $product;
			 if ($product->product_type == 'variable') {
							$rel_display_price = wc_price($product->get_display_price($product->get_variation_price())) . $product->get_price_suffix();
							$rel_display_regular_price = wc_price($product->get_display_price($product->get_variation_regular_price())) . $product->get_price_suffix();
							$rel_discount = round(($product->get_display_price($product->get_variation_price()) / $product->get_display_price($product->get_variation_regular_price())) * 100 - 100) . '%';
							$rel_savings = wc_price($product->get_display_price($product->get_variation_regular_price()) - $product->get_display_price($product->get_variation_price()));
						} else {
							$rel_display_price = wc_price($product->get_display_price()) . $product->get_price_suffix();
							$rel_display_regular_price = wc_price($product->get_display_price($product->get_regular_price())) . $product->get_price_suffix();
							$rel_discount = round(($product->get_display_price() / $product->get_display_price($product->get_regular_price())) * 100 - 100) . '%';
							$rel_savings = wc_price($product->get_display_price($product->get_regular_price()) - $product->get_display_price());
						}
			?>
            <div class="post-p col-lg-3 col-md-4 col-sm-6 col-xs-12">
               <div class="post col-lg-12">
                  <div class="post-img">
                     <div class="net-hover">
                        <p class="price-text">مبلغ پرداختی شما</p>
                        <p class="post-price"><?php echo $rel_display_price; ?></p>
                        <table class="net-hover-tb">
                           <tbody>
                              <tr>
                                 <td>
                                    سود شما 
                                    <p><?php print $rel_savings; ?></p>
                                 </td>
                                 <td>
                                    تخفیف
                                    <p><?php echo trim($rel_discount, '-'); ?></p>
                                 </td>
                              </tr>
                              <tr>
                                 <td colspan="10" class="post-see-netbarg-td">
                                    <div class="post-see-netbarg"><a href="<?php the_permalink(); ?>">مشاهده <?php echo of_get_option('netbarg_title','نت برگ'); ?></a></div>
                                 </td>
                              </tr>
                           </tbody>
                        </table>
                     </div>
                     <div class="post-crop">
                        <?php if(get_post_meta(get_the_id(), 'meta-text-6', true)=='yes'){ ?>
                        <div class="ribbon-ani"></div>
                        <?php } 
                           $pex_time = get_post_meta(get_the_id(), '_sale_price_dates_to', true);
                           $now_time = time() + 12600;
                           if ($pex_time < $now_time) { echo '<div class="ribbon-expired"></div>'; }
                           
                           global $product;
                           $attachment_ids = array_filter($product->get_gallery_attachment_ids());									
                           if( has_post_thumbnail() ) {
                           	the_post_thumbnail('product-size');
                           } elseif(!empty($attachment_ids)) {
                           ?>
                        <img src="<?php echo wp_get_attachment_url($attachment_ids[0]); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />
                        <?php
                           } else {
                           ?>
                        <img src="<?php bloginfo('template_url'); ?>/images/image-not-found.png" width="584" height="188" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />
                        <?php } ?>
                     </div>
                     <p class="post-title"><a href="<?php the_permalink(); ?>"><?php if (strlen($post->post_title) > 75) {
                        echo $short_title=mb_substr(the_title('','',FALSE),0,40) . '...'; } else {
                        the_title();
                        } ?></a></p>
                     <table class="post-detials">
                        <tbody>
                           <tr>
                              <td class="post-discount">
                                 <?php echo trim($rel_discount, '-'); ?>
                                 <div class="arr"></div>
                              </td>
                              <td class="post-place"><i class="place fa fa-map-marker"></i><span><?php echo get_post_meta(get_the_id(), 'meta-text-city', true); ?></span></td>
                              <td class="post-cart"><?php
                                 $tsol = get_post_meta( $product->id, 'total_sales', true );
                                  if(empty ($tsol)){
                                 			echo '0';	
                                 		}else{
                                 			echo get_post_meta( $product->id, 'total_sales', true );	
                                 		} ?> <i class="fa fa-shopping-basket"></i></td>
                           </tr>
                        </tbody>
                     </table>
                  </div>
               </div>
            </div>
             
            <?php endwhile; // end of the loop. ?>
            <?php endif; wp_reset_postdata();?>
            <!-- End Of Row -->
         </div>
         <!-- End Of NetBarg -->
      </div>
   </div>
   <meta itemprop="url" content="<?php the_permalink(); ?>" />
</div>
<!-- #product-<?php the_ID(); ?> -->
<?php do_action( 'woocommerce_after_single_product' ); ?>

با سپاس فراوان

 

پی نوشت: منظور بنده فقط تغییر ظاهری نیست! یعنی واقعاً متنی که در بخش توضیحات (پست اصلی) نوشته می شود در بخش توضیحات بیاید و به عنوان تب اول، فعال و پیش فرض بیاید.

با تشکر

لینک به ارسال

اول این‌که اگر کدتون خیلی طولانی هست به صورت اتچ اضافه کنید ...

دلیل اینکه کد کار نکرد: نویسنده قالب اومده بود به جای استفاده از اکشن مورد نظر کدهای اون رو قرار داده بود و با توجه به قالب شخصی‌سازی کرده بود

جواب: این کد مربوط به تب‌هاست در قالب شما

<div class="tabs">
    <ul>
        <li class="tab1 active-tab"><span class="tbs">ویژگی ها</span></li>
        <li class="tab2"><span>شرایط استفاده</span></li>
        <li class="tab3"><span>توضیحات</span></li>
    </ul>
</div>
<div id="tab1" class="product-attr tab-p col-lg-12 col-sm-12">
    <footer>
        <?php echo get_post_meta(get_the_id(),'hkh_product_attr',true); ?>
    </footer>
</div>
<div id="tab2" class="offer tab-p col-lg-12 col-sm-12">
    <footer>
        <?php echo get_post_meta(get_the_id(),'hkhtow_product_attr',true); ?>
    </footer>
</div>
<div id="tab3" class="tab-p col-lg-12 col-sm-12">
    <footer>
        <?php the_content(); ?>
    </footer>
</div>

ترتیب رو تغییر بدید نوع نمایش هم تغییر می‌کنه همین

<div class="tabs">
    <ul>
        <li class="tab1 active-tab"><span>توضیحات</span></li>
        <li class="tab2"><span class="tbs">ویژگی ها</span></li>
        <li class="tab3"><span>شرایط استفاده</span></li>
    </ul>
</div>
<div id="tab1" class="tab-p col-lg-12 col-sm-12">
    <footer>
        <?php the_content(); ?>
    </footer>
</div>
<div id="tab2" class="product-attr tab-p col-lg-12 col-sm-12">
    <footer>
        <?php echo get_post_meta(get_the_id(),'hkh_product_attr',true); ?>
    </footer>
</div>
<div id="tab3" class="offer tab-p col-lg-12 col-sm-12">
    <footer>
        <?php echo get_post_meta(get_the_id(),'hkhtow_product_attr',true); ?>
    </footer>
</div>

 

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...