【问题标题】:Wordpress ecommerce load products (JigoShop)Wordpress 电子商务加载产品 (JigoShop)
【发布时间】:2013-09-18 20:00:48
【问题描述】:

我有这个脚本

<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<th>ID product</th>
</tr>
<?php
    $query_args = array( 'post_type' => 'product', 'posts_per_page' => 1 );
    $loop = new WP_Query( $query_args );
    if ( have_posts() ) while ( $loop->have_posts() ) : $loop->the_post(); global $_product;
?>
    <tr>
        <td><?php echo $_product->get_the_ID(); ?></td>
    </tr>
<?php endwhile; ?>
</table>

但产品未显示。我打开了调试(真)但什么也没得到(没有错误)。

谢谢

【问题讨论】:

    标签: php wordpress e-commerce product jigoshop


    【解决方案1】:

    做了一些改动:

    <?php
        global $_product;
        $args = array( 'post_type' => 'product', 'posts_per_page' => 1 );
        $loop = new WP_Query($args);
        while ($loop->have_posts()) : $loop->the_post();
     ?>
    
        <product>
        <tr>
            <td><ITEM_ID><?php echo the_ID(); ?></ITEM_ID></td>
            <td><PRODUCTNAME><?php the_title_rss() ?></PRODUCTNAME></td>
    <td><?php if (get_option('rss_use_excerpt')) : ?>
            <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    <?php else : ?>
            <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    <?php endif; ?></td>
            <td><URL><?php the_permalink_rss() ?></URL></td>
            <td><PRICE_VAT><?php echo jigoshop_price($_product['get_price']); ?></PRICE_VAT></td>
            <td><CATEGORYTEXT><?php echo get_option('product_type') ?></CATEGORYTEXT></td>
            <td><EAN><?php echo the_ID(); ?></EAN></td>
    <?php rss_enclosure(); ?>
    <?php do_action('rss2_item'); ?>
        </tr></product>
    <?php endwhile; ?>
    </table>
    

    脚本显示价格,但所有产品都给我 0,00 欧元。为什么?我的 Bug 在哪里?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-01
      • 1970-01-01
      • 2011-10-07
      • 1970-01-01
      • 1970-01-01
      • 2017-12-16
      • 2019-02-22
      • 1970-01-01
      相关资源
      最近更新 更多