web-dev-qa-db-fra.com

Comment modifier la page du produit pour Jigoshop

Salut, je suis en train d’éditer Jigoshop loop-shop.php pour créer une liste d’apparences et le code est ci-dessous .... Faites-le-moi savoir où je peux obtenir les choses ci-dessous ...

  1. Ajouter au panier - Lien seulement
  2. Price Text - Article de liste
  3. et description du produit

enter image description here

Ci-dessous mon code de loop-shop.php

<?php
global $columns, $per_page;
do_action('jigoshop_before_shop_loop');
$loop = 0;
if (!isset($columns) || !$columns) $columns = apply_filters('loop_shop_columns', 4);
//if (!isset($per_page) || !$per_page) $per_page = apply_filters('loop_shop_per_page', get_option('posts_per_page'));
//if ($per_page > get_option('posts_per_page')) query_posts( array_merge( $wp_query->query, array( 'posts_per_page' => $per_page ) ) );
ob_start();
if (have_posts()) : while (have_posts()) : the_post(); $_product = new jigoshop_product( $post->ID ); $loop++;

?>

<div class="row show-grid">
  <div class="span12" class="custom-product" id="custom-product">
  <?php do_action('jigoshop_before_shop_loop_item'); ?>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td rowspan="2"><?php do_action('jigoshop_before_shop_loop_item_title', $post, $_product); ?></td>
      <td colspan="3" align="left" valign="top"><h2><strong><a href="<?php the_permalink(); ?>">
          <?php the_title(); ?>
          </a></strong></h2>
        <p><strong></strong> </p></td>
    </tr>
    <tr>
      <td align="left" valign="middle"><div class="euro-button"><strong> </strong></div></td>
      <td align="center" valign="middle"><a href="#"><img src="<?php bloginfo('template_directory'); ?>/img/add-tocart-button.png" alt="Add to Cart"></a></td>
      <td align="right" valign="middle"><a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/img/product-description.png" alt="Product Information"> </a></td>
    </tr>
  </table>
</div>
</div>
<br/>
<?php

    if ($loop==$per_page) break;
        endwhile; endif;

    if ($loop==0) :
        $content = '<p class="info">'.__('No products found which match your selection.', 'jigoshop').'</p>';
        else :
            $found_posts = ob_get_clean();
            $content = '<ul class="products">' . $found_posts . '</ul><div class="clear"></div>';
        endif;

        echo apply_filters( 'jigoshop_loop_shop_content', $content );

    do_action('jigoshop_after_shop_loop');
1
SamKit

Vous devez modifier le fichier loop-shop.php sous modèle (n'oubliez pas que le fichier peut être mis à jour automatiquement, vous avez donc besoin d'une sauvegarde.)

    <?php
    global $columns, $per_page;
    do_action('jigoshop_before_shop_loop');
    $loop = 0;
    if (!isset($columns) || !$columns) $columns = apply_filters('loop_shop_columns', 4);
    //if (!isset($per_page) || !$per_page) $per_page = apply_filters('loop_shop_per_page', get_option('posts_per_page'));
    //if ($per_page > get_option('posts_per_page')) query_posts( array_merge( $wp_query->query, array( 'posts_per_page' => $per_page ) ) );
    ob_start();
    if (have_posts()) : while (have_posts()) : the_post(); $_product = new jigoshop_product( $post->ID ); $loop++;

    ?>

    <div class="row show-grid">
      <div class="span12" class="custom-product" id="custom-product">
      <?php do_action('jigoshop_before_shop_loop_item'); ?>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td rowspan="2" width="185"><?php do_action('jigoshop_before_shop_loop_item_title', $post, $_product); ?></td>
          <td colspan="3" align="left" valign="top"><h2><strong><a href="<?php the_permalink(); ?>">
              <?php the_title(); ?>
              </a></strong></h2>
            <p><?php do_action('jigoshop_before_shop_loop_product_summary', $post, $_product ); ?></p></td>
        </tr>
        <tr>
          <td align="left" valign="bottom"><div id="btnPrice"><?php do_action('jigoshop_after_shop_loop_item_title', $post, $_product); ?></div></td>
          <td align="center" valign="bottom"><div id="btnCart"><?php do_action('jigoshop_after_shop_loop_item', $post, $_product); ?></div></td>
          <td align="right" valign="bottom"><a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/img/product-description.png" alt="Product Information"> </a></td>
        </tr>
      </table>
    </div>
    </div>
    <br/>
    <?php

        if ($loop==$per_page) break;
            endwhile; endif;

        if ($loop==0) :
            $content = '<p class="info">'.__('No products found which match your selection.', 'jigoshop').'</p>';
            else :
                $found_posts = ob_get_clean();
                $content = '<ul class="products">' . $found_posts . '</ul><div class="clear"></div>';
            endif;

            echo apply_filters( 'jigoshop_loop_shop_content', $content );

        do_action('jigoshop_after_shop_loop');

Vous devez ajouter des CSS à embellir selon vos besoins

#btnPrice {
    background: url("../img/euro.png") no-repeat scroll 0 0 transparent;
    height: 45px !important;
    line-height: 13px;
    padding: 10px 0 0 !important;
    text-align: center;
    width: 202px !important;
    margin-right:10px;
}
#btnPrice  .price {
    magrin:0 !important;
    line-height:30px !important;
    font-family:Arial !important;
    font-size:20pt !important;
    color:#FFF !important;

}

#btnCart .button {
    background: url("../img/add-tocart-button.png") no-repeat scroll 0 0 transparent;
    font-family: Arial !important;
    font-size: 15pt !important;
    height: 45px !important;
    line-height: 45px !important;
    padding: 0 0 10px !important;
    width: 202px !important;
}

Maintenant que vous avez terminé, vous pouvez également ajouter une action pour arrêter la mise à jour de Word-press à chaque fois.

Arrêtez de mettre à jour Wordpress

add_filter( 'http_request_args', 'dm_prevent_update_check', 10, 2 );
function dm_prevent_update_check( $r, $url ) {
    if ( 0 === strpos( $url, 'http://api.wordpress.org/plugins/update-check/' ) ) {
        $my_plugin = plugin_basename( __FILE__ );
        $plugins = unserialize( $r['body']['plugins'] );
        unset( $plugins->plugins[$my_plugin] );
        unset( $plugins->active[array_search( $my_plugin, $plugins->active )] );
        $r['body']['plugins'] = serialize( $plugins );
    }
    return $r;
}
// stop updating wordpress plugins
1