Re: Nifty Products Tutorial Part 1

seutje's picture
Offline
Joined: 05/15/2008
Juice: 36
Re: Nifty Products Tutorial Part 1

I removed the $title, coz it already shows the title outside of the #node container
added modelnumber
added dimensions
changed pictures to refere to the base path (lotta ppl use a local webserver to test multiple drupal projects at the same time)
changed the sub picture loop not to include the main picture again
made main picture bigger, sub pictures smaller

changed all IDs to classes

<?php

// Grabs the firsts image path and sets $imagePath.
$imagePath = $node->field_image_cache['0']['filepath'];
?>

<div id="node">
<div class="productnode">
<?php // default image display  ?>
<div class="imagesholder">
<div class="mainimage"><a href="<?php print base_path() ?>files/imagecache/product/<?php print $imagePath; ?>"><img src="<?php print base_path() ?>files/imagecache/product/<?php print $imagePath; ?>" height="200px" width="200px" alt="Title"></a></div>
<?php // all image display  ?>
<ul class="other_imgs">
   <?php
          
// get all images except the default one that's already shown
           
foreach ($node->field_image_cache as $images) {
            if (
$images['filepath'] != $imagePath) {
       
?>

   <li><a href="<?php print base_path() ?>files/imagecache/product/<?php print $images['filepath']; ?>" title="<?php print $images['title']; ?>" rel="pagination"><img src=" <?php print base_path() ?>files/imagecache/product/<?php print $images['filename']; ?>" width="50" height="50" alt="<?php print $images['alt']; ?>"></a></li>
    <?php  
       
} }
       
?>

</ul>
</div>
<?php // model number ?>
<?php print $node->content['model']['#value']; ?>
<?php // product description  ?>
<div class="productdesc"><?php print $node->content['body']['#value'];  ?></div>
<?php // dimensions ?>
<?php print $node->content['dimensions']['#value']; ?>
<?php  // list price and sell price display  ?>
<div class="price">
<p>List Price: <?php print uc_currency_format($node->list_price); ?></p>
<p>Sell Price: <?php print uc_currency_format($node->sell_price); ?></p>
</div>

<div id="cartButtons">
<?php // add to cart buttons ?>
<?php print $node->content['add_to_cart']["#value"]; ?>
</div>
</div>
</div>

hope this helps some1 besides myself ^^

here be the end!

Nifty Products Tutorial Part 1 By: mykz- (178 replies) Wed, 03/19/2008 - 19:04
  • Show discounted price by uc_discount module By: madjoe@drupal.org (02/14/2010 - 22:42)
  • Product Attributes By: rhysemt (01/17/2010 - 01:04)
  • Why? By: Foaman (10/17/2009 - 01:32)
  • Re: Nifty Products Tutorial Part 1 By: stasparshin (08/17/2009 - 12:24)
  • This is really useful. I've By: Ms_Kristina (07/16/2009 - 18:30)
  • Re: Nifty Products Tutorial Part 1 By: melanie_me (07/01/2009 - 15:43)
  • For images, I don't think this is the right way... By: cfab (07/01/2009 - 00:50)
  • Re: Nifty Products Tutorial Part 1 By: PepeMty (05/22/2009 - 14:21)
  • almost working... By: dontpanic (04/05/2009 - 02:01)
  • Re: Nifty Products Tutorial Part 1 By: RidolfiDesigns (03/31/2009 - 07:27)
  • Thickboc with Jquery Cycle By: matshep1 (03/10/2009 - 13:29)
  • Page title By: acbmse (03/05/2009 - 07:41)
  • Attributes working with node-product. By: perfectmatch (10/30/2008 - 16:02)
  • About Thickbox intergration By: adshill (10/23/2008 - 10:40)
  • Regarding to the images: if By: fossie@drupal.org (09/24/2008 - 08:03)
  • Using Tabs By: mach5_kel (09/06/2008 - 22:07)
  • Default node-product.tpl.php By: NecroHill (09/06/2008 - 15:50)
  • Modifing the Categories and Product Listings Pages By: maestrojed (08/28/2008 - 16:39)
  • Option Images not displaying/swatching on custom template By: beerismypoison (08/26/2008 - 15:25)
  • Re: Nifty Products Tutorial Part 1 By: end user (08/07/2008 - 17:05)
  • Re: Nifty Products Tutorial Part 1 By: seutje (06/17/2008 - 23:36)
  • Re: Nifty Products Tutorial Part 1 By: johnny5w (06/01/2008 - 19:16)
  • Re: Nifty Products Tutorial Part 1 By: seutje (05/29/2008 - 01:29)
  • Re: Nifty Products Tutorial Part 1 By: seutje (05/26/2008 - 09:17)
  • Reduced Price By: Alaska (05/25/2008 - 04:10)
  • Need thickbox for picture By: ericmalone (05/22/2008 - 15:06)
  • Re: Nifty Products Tutorial Part 1 By: end user (05/20/2008 - 00:26)
  • Hi, I tried out the code By: blueeeeie (05/19/2008 - 10:17)
  • Preselection radio button By: vincent@drupal.org (05/19/2008 - 02:48)
  • Re: Nifty Products Tutorial Part 1 By: seutje (05/15/2008 - 02:07)
  • Re: Nifty Products Tutorial Part 1 By: end user (04/22/2008 - 00:54)
  • Re: Nifty Products Tutorial Part 1 By: TutusForToddlers (04/08/2008 - 09:31)
  • Re: Nifty Products Tutorial Part 1 By: spasmody (04/08/2008 - 05:33)
  • Re: Nifty Products Tutorial Part 1 By: darkbrewery (03/21/2008 - 07:10)
  • Re: Nifty Products Tutorial Part 1 By: darkbrewery (03/20/2008 - 04:35)