2015-10-17 64 views
1

我想在单品页面上对显示变化做一些小改动。Woocommerce产品版本变化版面变化

正常情况下,变化会以html形式显示。

<table class="variations" cellspacing="0"> 
<tbody> 

<tr> 
<td class="label"><label for="group-size">Group Size</label></td> 
<td class="value"> 
<select id="group-size" class="" name="attribute_group-size" data-attribute_name="attribute_group-size"> 
<option value="">Chose an options</option> 
<option value="1 Person" >1 Person</option> 
<option value="2 persons" >2 persons</option> 
</select> 
</td> 
</tr> 

<tr> 
<td class="label"><label for="type-of-activity">Type of Activity</label></td> 
<td class="value"> 
<select id="tipo-de-actividad" class="" name="attribute_tipo-de-actividad" data-attribute_name="attribute_type-of-activity"> 
<option value="">Chose an option</option> 
<option value="Walking" >Walking</option> 
<option value="With car" >with car</option> 
</select> 
<a class="reset_variations" href="#">Clean the selections</a> 
</td> 
</tr> 

</tbody> 
</table> 

但我想有这样

<table class="variations" cellspacing="0"> 
<tbody> 

<tr> 
<td class="label"><label for="group-size">Group Size</label></td> 
</tr> 
<tr> 
<td class="value"> 
<select id="group-size" class="" name="attribute_group-size" data-attribute_name="attribute_group-size"> 
<option value="">Chose an options</option> 
<option value="1 Person" >1 Person</option> 
<option value="2 persons" >2 persons</option> 
</select> 
</td> 
</tr> 

<tr> 
<td class="label"><label for="type-of-activity">Type of Activity</label></td> 
</tr> 
<tr> 
<td class="value"> 
<select id="tipo-de-actividad" class="" name="attribute_tipo-de-actividad" data-attribute_name="attribute_type-of-activity"> 
<option value="">Chose an option</option> 
<option value="Walking" >Walking</option> 
<option value="With car" >with car</option> 
</select> 
<a class="reset_variations" href="#">Clean the selections</a> 
</td> 
</tr> 

</tbody> 
</table> 

意味着我wantto刚才上面的选项行内的标签。

我们该怎么做?

回答

1

我自己得到了解决方案。

有variable.php在 的wp-content /插件/ woocommerce /模板/单品/添加到购物车

我打开该文件

我已经改变

<table class="variations" cellspacing="0"> 
      <tbody> 
       <?php foreach ($attributes as $attribute_name => $options) : ?> 
        <tr> 
         <td class="label"><label for="<?php echo sanitize_title($attribute_name); ?>"><?php echo wc_attribute_label($attribute_name); ?></label></td> 
         <td class="value"> 
          <?php 
           $selected = isset($_REQUEST[ 'attribute_' . sanitize_title($attribute_name) ]) ? wc_clean($_REQUEST[ 'attribute_' . sanitize_title($attribute_name) ]) : $product->get_variation_default_attribute($attribute_name); 
           wc_dropdown_variation_attribute_options(array('options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected)); 
           echo end($attribute_keys) === $attribute_name ? '<a class="reset_variations" href="#">' . __('Clear selection', 'woocommerce') . '</a>' : ''; 
          ?> 
         </td> 
        </tr> 
       <?php endforeach;?> 
      </tbody> 
     </table> 

<table class="variations" cellspacing="0"> 
      <tbody> 
       <?php foreach ($attributes as $attribute_name => $options) : ?> 
        <tr> 
         <td class="label"><label for="<?php echo sanitize_title($attribute_name); ?>"><?php echo wc_attribute_label($attribute_name); ?></label></td> 
</tr> 
<tr> 
         <td class="value"> 
          <?php 
           $selected = isset($_REQUEST[ 'attribute_' . sanitize_title($attribute_name) ]) ? wc_clean($_REQUEST[ 'attribute_' . sanitize_title($attribute_name) ]) : $product->get_variation_default_attribute($attribute_name); 
           wc_dropdown_variation_attribute_options(array('options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected)); 
           echo end($attribute_keys) === $attribute_name ? '<a class="reset_variations" href="#">' . __('Clear selection', 'woocommerce') . '</a>' : ''; 
          ?> 
         </td> 
        </tr> 
       <?php endforeach;?> 
      </tbody> 
     </table> 

结果是,因为我喜欢。

对不起,打扰你了。