简体   繁体   English

woocommerce - 更改类别中的产品的HTML

[英]woocommerce - change the html of products in category

product's html looks like this: product的html如下所示:

<li class="post-13 product type-product status-publish has-post-thumbnail first taxable shipping-taxable purchasable product-type-simple product-cat-printer instock">
    <a href="http://xxx">
        <img width="150" height="150" src="http://xx" class="attachment-shop_catalog wp-post-image" alt="" />
        <h3>abc</h3>
        <span class="price"><span class="amount">15.86&nbsp;&euro;</span></span>
    </a>
    <div class="gridlist-buttonwrap">
        <a href="xx?add-to-cart=13" rel="nofollow" data-product_id="13" data-product_sku="" class="button add_to_cart_button product_type_simple">Buy</a>
    </div>
    <hr />          
</li>

Is it possible to move the price next to the button? 是否可以移动按钮旁边的价格?

<li class="post-13 product type-product status-publish has-post-thumbnail first taxable shipping-taxable purchasable product-type-simple product-cat-printer instock">
    <a href="http://xxx">
        <img width="150" height="150" src="http://xx" class="attachment-shop_catalog wp-post-image" alt="" />
        <h3>abc</h3>
    </a>
    <div class="abc">
        <a href="xx?add-to-cart=13" rel="nofollow" data-product_id="13" data-product_sku="" class="button add_to_cart_button product_type_simple">Buy</a>
        <span class="price"><span class="amount">15.86&nbsp;&euro;</span></span>
    </div>          
 </li>

The only way I have found out it that I should edit core of the plugin, which is useless because I will loose all changes after updates. 我发现它的唯一方法是我应该编辑插件的核心,这是没用的,因为我会在更新后丢失所有更改。

Edit: for example this theme , they have this structure: 编辑:例如这个主题 ,他们有这样的结构:

<li>
    <a href="http://demo2.woothemes.com/sliding/shop/yellow-necklace/" style="width: 192px; height: 295px;">
        <img width="192" height="295" src="http://demo2.woothemes.com/sliding/files/2011/11/yellow-necklace-192x295.jpg" class="attachment-woo_sliding_slider wp-post-image" alt="yellow-necklace" />
        <div class="meta">
            <h3>Yellow Necklace</h3>
            <span class="slider-price"><span class="amount">&pound;19.00</span></span>
        </div>

    </a>

</li>

You can override a template file and that will not be updated when you update woocommerce. 您可以覆盖模板文件,并在更新woocommerce时不会更新。

From the WooCommerce docs 来自WooCommerce 文档

Alternatively, you can edit these files in an upgrade safe way through overrides. 或者,您可以通过覆盖以升级安全的方式编辑这些文件。 Simply copy it into a directory within your theme named /woocommerce, keeping the same file structure. 只需将其复制到名为/ woocommerce的主题目录中,保持相同的文件结构即可。

Example: To overide the admin order notification, copy: woocommerce/templates/emails/admin-new-order.php to yourtheme/woocommerce/emails/admin-new-order.php 示例:要覆盖管理员订单通知,请将:woocommerce / templates / emails / admin-new-order.php复制到yourtheme / woocommerce / emails / admin-new-order.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM