<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>multiples images | Undisconnected</title>
	<atom:link href="https://undisconnected.com/tag/multiples-images/feed/" rel="self" type="application/rss+xml" />
	<link>https://undisconnected.com</link>
	<description>Reste connecté</description>
	<lastBuildDate>Thu, 29 Mar 2012 14:18:33 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Afficher plusieurs images pour un produit avec wp-ecommerce</title>
		<link>https://undisconnected.com/afficher-plusieurs-images-produit-wp-ecommerce/</link>
					<comments>https://undisconnected.com/afficher-plusieurs-images-produit-wp-ecommerce/#comments</comments>
		
		<dc:creator><![CDATA[Imatt]]></dc:creator>
		<pubDate>Fri, 09 Mar 2012 13:44:13 +0000</pubDate>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[multiples images]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[produit]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-ecommerce]]></category>
		<guid isPermaLink="false">https://undisconnected.com/?p=1339</guid>

					<description><![CDATA[<p>WP-Ecommerce est un plugin de E-commerce pour WordPress. Il est vraiment idéale sur le papier…</p>
The post <a href="https://undisconnected.com/afficher-plusieurs-images-produit-wp-ecommerce/">Afficher plusieurs images pour un produit avec wp-ecommerce</a> first appeared on <a href="https://undisconnected.com">Undisconnected</a>.]]></description>
										<content:encoded><![CDATA[<p>WP-Ecommerce est un plugin de E-commerce pour WordPress. Il est vraiment idéale sur le papier puisqu&rsquo;il permet de construire un système de E-commerce (backend et frontend) sans rien coder. Dans la pratique le plugin se révèle un peu moins idyllique, je pense que tous ceux qui ont essayé une fois dans leur vie de personnaliser un thème WP-Ecommerce comprendrons de quoi je parle.</p>
<p>Aujourd&rsquo;hui je vais vous exposer un problème auquel j&rsquo;ai été confronté, qui paraît très bête mais qui fût assez chronophage pour moi.</p>
<h2>Le problème dans WP-Ecommerce</h2>
<p>Le backend du plugin permet d&rsquo;uploader plusieurs photo pour un produit mais le front-end ne propose aucune methode pour aller les chercher et les afficher. En fait, WP-Ecommerce propose un add-on payant « Gold Cart » pour cela mais on s&rsquo;entend que ce n&rsquo;est pas une solution.</p>
<h2>La solution pour afficher plusieurs images</h2>
<p>Voici la marche à suivre, il vous faudra tout d&rsquo;abord repérer le code suivant dans le fichier « wpsc-single_product.php ».</p>
<pre class="brush: php; gutter: true">&lt; ?php if ( wpsc_the_product_thumbnail() ) : ?&gt;
        
      &lt; ?php if ( function_exists( &#039;gold_shpcrt_display_gallery&#039; ) )
         echo gold_shpcrt_display_gallery( wpsc_the_product_id() );
      ?&gt;
   &lt; ?php else: ?&gt;</pre>
<p>Ensuite vous pourrez remplacer le code ci-dessus par :</p>
<pre class="brush: php; gutter: true">&lt; ?php if ( wpsc_the_product_thumbnail()) ://if the product has any images...
      if (has_post_thumbnail()):?&gt;//...display the thumbnail if there is one...
          &lt; ?php echo get_the_post_thumbnail(wpsc_the_product_id(),&#039;thumbnail&#039;,array(&#039;alt&#039; =&gt; wpsc_the_product_title(),&#039;title&#039; =&gt; wpsc_the_product_title() ));?&gt; 
      &lt; ?php endif;
      sb_get_images_for_product(wpsc_the_product_id());//...and then display all the rest of the images
else: ?&gt;</pre>
<p>Puis ajouter dans le fichier « function.php » de votre thème la fonction suivante :</p>
<pre class="brush: php; gutter: true">function sb_get_images_for_product($id){
   global $wpdb;
   $post_thumbnail = get_post_thumbnail_id();//read the thumbnail id
   $attachments = $wpdb-&gt;get_results($wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;posts WHERE post_parent = $id AND post_type = &#039;attachment&#039; ORDER BY menu_order ASC&quot;));
   foreach ($attachments as $attachment){
      if ($attachment-&gt;ID &lt;&gt; $post_thumbnail){//if we haven&#039;t already got the attachment as the post thumbnail
         $image_attributes = wp_get_attachment_image_src($attachment-&gt;ID,&#039;thumbnail&#039;);?&gt;
	  
   &lt; ?php }
   }
}</pre>
<h2>Conclusion</h2>
<p>En conclusion, j&rsquo;adore WP-Ecommerce pour plein de choses, ce plugin est vraiment cool tant qu&rsquo;on a pas à rentrer dans le code. Une fois les mains dans le cambouis, on peut vite perdre patience. En plus de ça la doc n&rsquo;est pas toujours très claire. Cependant grâce à une communauté plutôt importante, on trouve souvent des solutions à nos problèmes. Donc voici ma participation en français <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>&nbsp;</p>
<h2>Ressources</h2>
<ul>
<li><a href="http://getshopped.org/">Le site de WP-Ecommerce</a></li>
<li><a href="http://www.simonbattersby.com/blog/2011/11/multiple-images-on-wp-e-commerce-product-pages/">L&rsquo;article de référence</a></li>
</ul>The post <a href="https://undisconnected.com/afficher-plusieurs-images-produit-wp-ecommerce/">Afficher plusieurs images pour un produit avec wp-ecommerce</a> first appeared on <a href="https://undisconnected.com">Undisconnected</a>.]]></content:encoded>
					
					<wfw:commentRss>https://undisconnected.com/afficher-plusieurs-images-produit-wp-ecommerce/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
