Ubercart - Custom Views2 Fields Template
by admin on Jun.19, 2009, under Linux Blerg
After exhausting search for solution to get the original price appear crossed / slashed if there is a discount price price available from uc_discount_alternative module……
If you have been in the similar situation then you should know how long and exhausting it is to get the right and working information about how to do things with drupal and ubercart. Well for the problem above, you can use this custom template and rename the template to views-view-fields.tpl.php (This one will apply to all your views) or views-view-fields–YOURVIEWNAME.tpl.php (for single view use only)
<div class="block-products-content">
<div class="block-title">< ?php print $fields['title']->content; ?></div>
<div class="block-image">< ?php print $fields['field_image_cache_fid']->content; ?></div>
< ?php if ( is_null($fields['discounted_price']->content) ) { ?>
<div class="block-layer-wrapper">
<div class="block-sell-price">< ?php print t('Only'); ?> :< ?php print $fields['sell_price']->content; ?></div>
<div class="block-discount-price"></div>
< ?php } else { ?>
<div class="block-layer-wrapper">
<div class="block-sell-price">< ?php print t('List'); ?> :<s>< ?php print $fields['sell_price']->content; ?></s></div>
<div class="block-discount-price">< ?php print t('Sale'); ?> :< ?php print $fields['discounted_price']->content; ?></div>
< ?php } ?>
<div class="block-button">< ?php print $fields['buyitnowbutton']->content; ?></div>
</div>
</div>
</div>
and change the css as you see fit :
#category-grid-products-wrapper {
position:relative;
float:left;
width:auto;
height:100%;
margin:0 auto 20px;;
}
#category-grid-products-wrapper .category-grid-products-content {
float:left;
width:140px;
margin-top:5px;
margin-right:2px;
_margin-right:1px;
height:343px;
-moz-border-radius-topleft:6px;
-moz-border-radius-topright:6px;
-webkit-border-top-left-radius:8px;
-webkit-border-top-right-radius:8px;
-moz-border-radius-bottomleft:6px;
-moz-border-radius-bottomright:6px;
-webkit-border-bottom-left-radius:8px;
-webkit-border-bottom-right-radius:8px;
border: 1px solid #e2e2df;
text-align:center;
padding-top:3px;
padding-bottom:3px;
background: url('images/banner3.jpg') repeat-x bottom right;
}
.category-grid-products-content .catalog-grid-image {
height:150px;
width:100%;
}
.category-grid-products-content .catalog-grid-title {
height:100px;
width:99%;
margin-left:0.5%;
margin-right:0.5%;
font-weight:700;
padding-top:3px;
}
.category-grid-products-content .catalog-grid-sell-price, .category-grid-products-content .catalog-grid-discount-price {
height:30px;
width:100%;
border-top:1px dotted #ccc;
font-size:16px;
font-weight: bolder;
padding-top:3px;
color: #333333;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.category-grid-products-content .catalog-grid-discount-price {
color: #CC0000;
border: none;
}
.category-grid-products-content .catalog-addtocart-button {
height:26px;
width:100%;
}
Hope this one can help you avoid those exhausting late night search….
-= end transmission =-


















January 24th, 2010 on 5:42 am
It’s becoming harder and harder to separate the wheat from the chaff, but I think you’ve got some quite helpful info here. Trading is hard enough without being misguided by false prophets. Thank you for a very informative post!