40 replies [Last post]
BrisDev's picture
Offline
Joined: 09/04/2007
Juice: 13
Was this information Helpful?

Hey all,

I'm in the process of building a Drupal site using Ubercart (at packndash.net), and wondering how to integrate the functionality to put certain items on sale.

An example of exactly what I'm after is at artezn.com's SALE page. Is this simply some settings within Ubercart? A module? Changed code?

Any help would be appreciated!

Thanks
Developer from Brisbane

BrisDev's picture
Offline
Joined: 09/04/2007
Juice: 13
Re: Items on sale - how?

Actually I forgot to add, on the website running on my machine at home, the product link shows the product name (as a link) of each product, as well as the body teaser. When I upload the site and use exactly the same database, it doesn't show the teaser. No matter what I change about the page, it just won't show those details. Any ideas?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Items on sale - how?

Man, I forgot how cool the Artez'n site is. I need to get a link back to them from the Live sites directory. (Can't remember who developed it!)

Anyways, regarding the sale page, it looks like some custom job they've done. A simple way to do this would be to add a CCK field to your products that lets you specify whether or not an item is on sale. Then you can use the Views module or a custom query to load up all the items on sale and display them on a certain page.

I love the idea of your store, too! Hope it goes well.

artscientific's picture
Offline
Joined: 05/20/2008
Juice: 19
Items on sale...

Hey guys, we are in the process of building a retro themed site at http://retro.ochaby.com (soon to be retrofitaprons.com and need to be able to put items on sale.

I'm going to try and muddle through your suggestion but frankly, while I know web design I'm new to drupal and ubercart and I dont even know where to enter new CCK fields into products. In the interest of Ubercart (which I greatly appreciate) I'd strongly suggest adding this as core feature. As a design house I can see a lot of people skipping right past ubercart because they dont see this integral feature that many people couldnt see doing business without.

Thanks for your time and a great product,
-Peter
ArtScientific Web Design

P.S. If we can get this figured out and functional we're going to implement Ubercart on our personal project a rave goth and sub culture toystore DefineToys.com! Check it out if you have a chance!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Items on sale...

Ahh, yeah... not all comments here are directed toward those not familiar with Drupal. CCK is a module developed and maintained by other Drupal users that lets you do things to product nodes... it's part of the whole design philosophy of Drupal - interconnected parts joined together to do what you need. So, it won't become a core feature, but toying around with the CCK module once it's installed on your site should help you become familiar with using it. I don't have a good tutorial to point you to, but I'll keep that in mind for the tutorials section here on Ubercart.org.

A quick Google search yielded this link to a video tutorial you might find useful:

http://learn.awakenedvoice.com/2007/07/30/drupal-cck-and-views-tutorial/

Francois's picture
Offline
Joined: 08/19/2008
Juice: 387
Need similar Functionality

Maybe there's an easy way to do this, and I'm not getting it.
@ BrisDev - Did you ever succeed in doing this? I can create a Sales page but have no idea how to get the Strike-through and Red text working like on http://www.artezn.com/catalog/specials/sale
@ Ryan - is there a module that does this? I've had no luck finding one, and my client will be VERY happy if I could get that right. Right now we're using "Promo Codes" but having an alternative SALE price with % discount would be great.

Thanks for the help
Francois.

--------
'Twas the end of the world, and you didn't even know it.

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
On Sale

Try this thread for some ideas.

http://www.ubercart.org/forum/development/3868/nifty_products_tutorial_p...

When the price is changed the old price has a strike through with a red new price being displayed. Text can be changed as needed along with colors, etc. Along with CSS for any embellishments.

AttachmentSize
buy_now.png 3.66 KB
buy_now_first.png 2.23 KB
Francois's picture
Offline
Joined: 08/19/2008
Juice: 387
Updating Prices

@Alaska. Thanks for the quick reply.

I see you're using list and sell-price to display this. Do you edit each individual "sell price" to display the final "Sale" price, or are you using a module to edit them in bulk? What I mean is, do you calculate the 33% discount (random amount) and then change the sell price by hand, or is there a quicker way.

You're method for displaying makes sense though.

--------
'Twas the end of the world, and you didn't even know it.

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Sale Items

The 'our price' and 'buy now' will not display unless the price is adjusted when editing the product. If the list price is at 0.00 or the same as the sell price the additional text will not display.

When the sell price (19.95) is lower than the list price (24.95) then the new information will display.

The good part is that each product can be altered so only a few items will display the new 'buy now' price. The negative part is that there is no global price change option. And you have to go back and change all of the modified items back to their pre discount price.

The way it is done on the Jewelry site is that the 'list price' is kept at $24.95, as an example. Then when the sale is over, you know what to again place in the 'sell price' block. Once entered the 'buy now' text goes away.

One can calculate the discounted price. However, it is just easier to put some amount in and not worry about how much the discount is. The idea being is to sell at whatever price it takes to move the item out of inventory.

Again this works well for spot price reductions on a few products. Or for a category that contains all of your discounted items.

If interested in a site wide price change without the need to modify each product, then there are other ways to make that happen.

One is the coupon module. Another would use the discount module.

AttachmentSize
sale.png 9.34 KB
Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Our Price

This is the code that was added to the theme for the display of 'our price' and 'buy now' text when the sell price is less than the list price.

This was placed in a new "node.tpl.php" called "node-product.tpl.php". Think that the new product node was created as there was a need to have a double set of products. One for person A and one for person B. You could try just modifying "node.tpl.php" and see if that works. It has just been too long to remember the details (May 08).

<?php
if ($sell_price < $list_price) {
print
"<div class=\"price-box\">"."<p>"."<span class=\"our-price\">". "Our Price / " . "</span>" . "<span class=\"offer-price\">" . "$" . $list_price . "</span>" . "</p>" . "<p class=\"offer-text\">Buy Now " . "<span class=\"sale-price\">" . "$" . $sell_price . "</p>
</div>"
;
} else {
print
"<div class=\"price-box\"><p class=\"sell-price\">". "$" . $sell_price . "</p></div>";
}
?>

The CSS was added to the end of the style.css sheet for the theme.

.price .price-box {
font-size: 12px;
text-align: left;
}

.price .sale-price {
font-weight: bold;
color: red;
}

.price .sell-price {
font-size: 125%;
color: #000;
}

.price .offer-price {
color: #000;
text-decoration: line-through;
font-size: 135%;
}

.price .offer-text {
color: #2B45B3;
margin-top: -10px;
margin-bottom: 0px;
font-weight: bold;
font-size: 125%;
}

.price .our-price {
color: green;
}

Change out the CSS elements to fit your needs.

Francois's picture
Offline
Joined: 08/19/2008
Juice: 387
Awesome.

You're great. That's perfect.

--------
'Twas the end of the world, and you didn't even know it.

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Buy Now

Of course, all of that was wrapped in a div as follows:

<div class="price">

<?php print $node->content['body']['#value'];  ?>

       Place php Buy Now -- Our Price code here......

</div>

The nice part is that any text can be used in place of 'buy now' or 'our price'.

Glad that the material will work for your application. It was provided by other forum members. So a thanks to them for their assistance last May.

adrianmak's picture
Offline
Joined: 05/28/2008
Juice: 312
Thanks Alaska. But this

Thanks Alaska.

But this piece of theming only appear on product node
price overwrite will not shown under product listing.

Where should I theme such price overwrite under product listing

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Buy Now

The code works as intended for Uber 5.x. Someone else will most likely know about the modifications required for your specific needs.

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
CSS not working in TPL file

Hey Alaska,

Great code. I am using it in my node-product.tpl file to display the list and sale price.

Im also putting the actual CSS in the TPL file. But when I put the CSS in the TPL file it doesnt format the list/sales price. Currently, my node-product.tpl file doesnt call any style sheet at all....just the ones I have set at the header above.

But when I add your CSS code to the one above it doesnt format. Any suggestions?

Many thanks! Great php code

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Sell - List Price

Actually the code is from some other folks and they did a good job with getting it to operate.

Are you using this for Uber 1.x or Uber 2.x? The code is for Drupal 5.x and Uber 1.x.

The CSS was added to the end of the CSS style sheet that is being used for your theme. And the sell price/list price PHP code is surrounded with a <div class="price">  PHP Code Goes Here  </div>. Or if you do not desire to use that "div" then remove all of the ".price" selectors. It is insurance that the selectors are unique. The ".price .sell-price" is being used as a contextual selector.

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Re: Sell - List Price

OK got it. im using ubercart 2x.

but i have 4 style sheets since im using the algna theme. . .i guess i will try them in all 4 and see which one works. . .

i guess the node-product.tpl file looks at all 4?

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Re: Re: Sell - List Price

the sale vs list price PHP code works fine in the node-product.tpl file, but I cant figure out for the life of me how to get the CSS working.

I tried adding it to the top of the node-product.tpl file, and the 4 style sheets that come with the alagna theme (marinelli) but still i cant get it to work..

does anyone have the code above with a styled sheet already or know how to link that code to the style?

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Re: Re: Re: Sell - List Price

UM - I think there may be some replies/posts missing here. I checked it out earlier in the day and someone had posted some CSS code for my request above but know that I check the post is missing? Why did that happen?

Can any one help me with the CSS question above? Getting CSS to work for the SALE / LIST price to make the cross out effect.

thanks,

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Missing Posts

See this thread for the reason why things are missing.
http://www.ubercart.org/forum/ubercartorg/11087/moving

Perhaps this is one very good reason to "always" backup your database..... Guessing that it perhaps was not done, but could be wrong in that regard.

And perhaps making a copy of ones post just in case it has to be reposted for some reason. I did not so my new CSS post has been lost....

Can the lost information be restored and reposted???

minneapolisdan's picture
Offline
Joined: 05/21/2009
Juice: 67
Re: Missing Posts

That snippet of PHP code that Alaska posted, for showing how to display sale items, was very helpful. thanks! I combined it with some code that sterg17 posted on this other thread, so you get proper formatting on your prices (and avoid extra zeros on your prices).

http://www.ubercart.org/forum/bug_reports/11066/extra_0_end_sale_price_a...

I'll include it here as well.

<?php
 
if ($node->sell_price < $node->list_price) {
print
"<div class=\"price-box\">"."<p>"."<span class=\"our-price\">". "Price " . "</span>" . "<span class=\"offer-price\">"  . uc_currency_format($node->list_price) . "</span>" . "</p>" . "<p class=\"offer-text\">On Sale! " . "<span class=\"sale-price\">" . uc_currency_format($node->sell_price) . "</p>
</div>"
;
} else {
print
"<div class=\"price-box\"><p class=\"sell-price\">"uc_currency_format($node->sell_price)  . "</p></div>";
}
?>
BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1057
Hey guys, I have a question

Hey guys,

I have a question on this. I am using UC-1.x atop D-5.x

My node-product.tpl.php file has <div class="content"><?php print $content?></div> which displays, well, everything: the image, the description, the price, the attributes, the quantity, and the cart links.

When I add mplsdan's code, of course what it does is add an additional div for the price of the product. The only way to get rid of the original price, is to axe the "print $content", but then I loose everything.

I see how Alaska offered the <?php print $node->content['body']['#value'];  ?> line to add in the product description, so can someone tell me what I need to do to replace the "print $content" div with UC-specific divs to also include the image, the attribute field, quantity field, and the cart links?

So right now I am using:
<div class="content"><?php print $content?></div>
Which displays:
* Product Image Thumbnail that links to a larger image when clicked on
* Product Description
* Product Attribute
* Product Quantity
* Product Price
* Product Cart Links (Cart & Wishlist)

What code do I need to replace that with UC-coding, ie please correct this for me:

<div class="content">
<?php print $node->content['image']['#value'];  ?>  <--- Image???
<?php print $node->content['body']['#value'];  ?>
<?php print $node->content['attribute']['#value'];  ?> <--- Attribute???
<?php print $node->content['quantity']['#value'];  ?> <--- Quantity???

<?php if ($node->sell_price < $node->list_price) {
      print
"<div class=\"price-box\">"."<p>"."<span class=\"norm-price\">". "Price " . "</span>" . "<span class=\"offer-price\">"  . uc_currency_format($node->list_price) . "</span>" . "</p>" . "<p class=\"offer-text\">On Sale! " . "<span class=\"sale-price\">" . uc_currency_format($node->sell_price) . "</p>
             </div>"
;
    } else {
      print
"<div class=\"price-box\"><p class=\"sell-price\">"uc_currency_format($node->sell_price)  . "</p></div>";
    }
?>

<?php print $node->content['cartlinks']['#value'];  ?> <--- Cart Links???
</div>

Thanks in advance!!

Mike

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1057
Re: Hey guys, I have a question

Ahhhh nevermind, I found the information in the 'Nifty Products Tutorial Part 1' thread

Mike

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1057
Hey guys, When I

Hey guys,

When I use...

      <?php if (!$teaser) {
        if (
$node->sell_price < $node->list_price) {
          print
"<div class=\"my_display_price\"><p><s>" . "$" . $list_price . "</s> <font color=\"limegreen\"><b>On Sale! " . "$" . $sell_price . "</b></font></p>
                 </div>"
;
        } else {
          print
"
            <div class=\"my_display_price\">
              <p>"
. "$" . $sell_price . "</p>
            </div>"
;
      }
     
?>

...to display my prices in conjunction with the modification for...

"Product and its derivatives are not available for sale."
"Hide product price."

...it no longer hides the product price.

What is the extra variable I need to check for to see if the product's price is selected to be hidden?

Thanks
Mike

moby's picture
Offline
Joined: 10/05/2008
Juice: 169
module?

would it be possible to build this into a module?

wouldnt making these changes manually be overwritten when upgrading?

Francois's picture
Offline
Joined: 08/19/2008
Juice: 387
I don't think so.

I don't think so.

These changes go into your theme folder - node.product.tpl.php - not the Ubercart module folder, and therefore they never get touched unless you overwrite your theme folder.

Here's an example of how I implemented it in my product page (combination of various code snippets found on ubercart.org and drupal.org :

<div class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> product-nodetype">
  <div class="node_title">
    <?php if ($page == 0): ?>
    <h3 class="title"> <a href="<?php print $node_url ?>"><?php print $title; ?></a> </h3>
    <?php endif; ?>
  </div>
  <?php
// Grabs the firsts image path and sets $imagePath.
$imagePath = $node->field_image_cache['1']['filepath'];
?>

  <div class="content">
    <div class="product_image two_column">
      <?php // default image display  ?>
      <div id="image"><a class="thickbox" rel="thickbox" href="../files/imagecache/product/<?php print $imagePath; ?>"><img src="../files/imagecache/product/<?php print $imagePath; ?>" alt="Title" /></a></div>
    </div>
    <div class="product-content one_column" style="float:right;">
      <table border="0" cellpadding="2" cellspacing="0">
        <tr>
          <td colspan="2"><h3><?php print $node->title.""; ?></h3></td>
        </tr>
        <tr>
          <td class="blue" colspan="2">Description</td>
        </tr>
        <tr>
          <td colspan="2"><?php print $node->content['body']['#value'].""; ?></td>
        </tr>
        <tr>
          <td width="40%" class="blue">Fit</td>
          <td width="60%"><?php print $field_fit[0]['view'] ?></td>
        </tr>
        <tr>
          <td width="40%" class="blue">Content</td>
          <td width="60%"><?php print $field_fabric_content[0]['view'] ?></td>
        </tr>
        <tr>
          <td width="40%" class="blue">Care</td>
          <td width="60%"><?php print $field_instructions[0]['view'] ?></td>
        </tr>
      </table>
      <ul>
        <li>
          <h3>
            <?php
           
if ($sell_price < $list_price) {
            print
"<p class=\"sale_old\">" . "$" . $list_price . "</p>" . "<p class=\"sale_new\">Sale " . "$" . $sell_price . "</p>";
            } else {
            print
"$" . $sell_price . "</p>";
            }
           
?>

          </h3>
        </li>
        <li><?php print $node->content['add_to_cart']["#value"].""; ?></li>
        <li> </li>
      </ul>
      <!-- TO ADD NEXT AND PREVIOUS LINKS TO THE NODE, REMOVE HTML NOTES
      <!--?php
  print next_prev_same_type($node->nid, "node", "prev");
  print next_prev_same_type($node->nid, "node", "next");
?-->
      <!-- END NEXT PREVIOUS -->
    </div>
  </div>
</div>
<!-- TO ADD MULTI IMAGES, REMOVE HTML NOTES AND ** from ?PHP

<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 class="thickbox" rel="thickbox" href="<**?php print base_path() ?>files/imagecache/product/<**?php print $images['filepath']; ?>" title="<**?php print $images['title']; ?>"><img src="//<**?php print base_path() ?>files/imagecache/product/<**?php print $images['filename']; ?>" width="" height="50" alt="<**?php print $images['alt']; ?>" /></a></li>
  <**?php  
} }
?>
</ul>

END OF MULTI IMAGES-->

--------
'Twas the end of the world, and you didn't even know it.

Alizah07's picture
Offline
Joined: 10/24/2010
Juice: 5
just checking

Wedding Favors
Just checking Smiling
is it work or not

Alizah07's picture
Offline
Joined: 10/24/2010
Juice: 5
Nice Posts

Checking again Smiling
http://www.weddingavenue.com/
wot abt this one

Francois's picture
Offline
Joined: 08/19/2008
Juice: 387
Weird

I've just run into the weirdest problem...

When using the "smaller than" code it would only work if the first digit of the list price is higher than first digit of the sell price. So if it was $200 and the new price is $150, it displays correctly. However, as soon as it was $200 vs $95 it would display only the $95. Strange... this only happens in the view (Views) and not on the product node. CRAZY, I know. Anybody have any suggestions?

<?php
           
if ($sell_price < $list_price) {
            print
"<li class=\"sale_old\">" . $list_price . "</li>" . "<li class=\"sale_new\">Now " . $sell_price . "</li>";
            } else {
            print
"<li>". $sell_price . "</li>" . "<li class=\"sale_new\">" </li>";
            }
            ?>

--------
'Twas the end of the world, and you didn't even know it.

longwave's picture
Offline
Joined: 09/20/2008
Juice: 487
Re: Weird

$sell_price and $list_price are strings, not numbers, so comparisons will work like this.

Try if ($node->sell_price < $node->list_price) instead.

--
These forums are for general support questions about Ubercart.
Bug reports and feature requests should be posted at http://drupal.org/project/issues/ubercart
Latest API documentation can be found at http://api.ubercart.me/

Summit_drupal's picture
Offline
Joined: 12/11/2010
Juice: 137
Re: Re: Weird

Interested in D6/U2 Sell price/List price also for Showing discount! Greetings, Martijn

Francois's picture
Offline
Joined: 08/19/2008
Juice: 387
Re: Re: Re: Weird

Hey Martin, For D6 U2 I use the following code (obviously you can customize this to suite your needs):

<?php
if ($node->sell_price < $node->list_price) {
print
"<div class=\"sale-pricing\"><div class=\"old-price\">Old Price "  . uc_currency_format($node->list_price) . "</div>" . "<div class=\"sale_new\">Sale Price</div>" . "<div class=\"product-info product display\">"uc_currency_format($node->sell_price)  . "</div></div>";
} else {
print
"<div class=\"product-info product display\">"uc_currency_format($node->sell_price)  . "</div>";
}
?>

and for CSS I use

.old-price {text-decoration:line-through;}
.sale-pricing .display, .sale-pricing .sale_new {color:#a30000;}

Hope that helps.

--------
'Twas the end of the world, and you didn't even know it.

Francois's picture
Offline
Joined: 08/19/2008
Juice: 387
Re: Re: Weird

Unfortunately this doesn't seem to work in D5 U1. I'm getting blanks, I'm doing this in a view, so that might make a difference. The view seems to be able only to output UC prices as $x.xx, and not just x.xx which is I'm sure where the trouble lies, as you mention.

--------
'Twas the end of the world, and you didn't even know it.

alanudi's picture
Offline
Joined: 02/09/2011
Juice: 17
CAN WE MOVE ON TO NEW TOPICS PLEASE?

Hi guys,

I hate to sound like a dick, but seriously? This topic is 4 years old, that's 2007

Can you guys please comment on the new UNANSWERED topics?

Thanks!

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1057
Re: CAN WE MOVE ON TO NEW TOPICS PLEASE?

What is wrong with replying relevant information to a continuous, on going topic? When searching for something, it is nice to find 1 topic that contains all the info I need. Furthermore, you have only been a member for a little over 4 hours. Relax and enjoy the free support. There are some topics here with over 150 replies spanning 4+ years. Imagine if that was broken up into 100 different topics with like subjects, it would take forever for anyone to find information.

This topic has helped me immensely and I've appreciated all the feedback and support.

Mike

alanudi's picture
Offline
Joined: 02/09/2011
Juice: 17
okie doke mike. Any Idea

Mike,

I understand. I'm simply asking for some attention to be paid to the unanswered questions...

Any Idea where we can get support for the questions people don't answer?

Unfortunately, those ones are hard to 'enjoy' Eye-wink

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1057
Hey guys, I need help with

Hey guys,

I need help with configuring a view for this.

When using the sell_price < list_price method to trigger a sale item, how can I use this relationship in a View?

Using Views6.x-2.12, I have Filter options for "Product: Sell price" and "Product: List price", but when I add one of these, the only options I have are "Is less than..., Is equal to..., Is greater than..., Is between..." et cetera and then an empty Value field.

My Question: Is there a "Value" that I can enter that points to the other price? For instance, if I add a Sell Price filter, can I add a value such as <list_price> that will pull the value of the list price to compare against?

Thank you very much!
Mike

Page reloaded with:

Quote:

To complete this form, please complete the word verification below.

end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Hey guys, I need help with

This is how I was going to do it but not sure if it works with the default catalogue view as I don't use it.

First set up a CCK filed check box called On Sale Item
Second Set up a CCK text field for the old price and you use the sell price for the new discounted price.

When you set up the view in the fields I would choose the following

Node: Title
Content: Image product_list image linked to node
Content: Old Product Price(field_old_product_price)
Product: Sell price PRICE
Product: Add to cart form

So the views gid (which I use) would lost all those fields. Then I'd use CSS to strike out the Old Price text.

Then under Views Filters I would select Content: On Sale Item not empty

I'll set up a test view later tonight and post back but like I stated this is for my set up and I don't use the catalogue but taxonomy and views for the store

end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Re: Hey guys, I need help with

Here's a sample category I set up http://www.altgro.com/specials

Also forgot to add that in the views Field for the old price I have these selected to exclude the field if its empty

Count the number 0 as empty
If the field contains the number zero, display the empty text instead
Hide if empty

I should add that I haven't tried this with products that use attributes to change the price as I don't use them atm.

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1057
Hmmmmmm........I am using

Hmmmmmm........

I am using node.tpl.php to compile my product pages and have the On Sale functionality as discussed above in reply #9 and others. I am not using Views to build our product page.

Here is what I am trying to do:

- Have a View created block that only shows products whose sell price is less than their list price.

- Currently, I am using Nodequeue to handle this. So we first set the new lower sell price, then we also have to add the product to a nodequeue (the View filters which products are in the nodequeue).

- If I could just use a View filter to check on it's own for which sell price < list price, then the Block would be populated automatically the moment we set the sell price.

- This would eliminate the need to use the extra nodequeue step.

Thanks for the help!
BigMike

jimboo's picture
Offline
Joined: 01/04/2011
Juice: 44
Sale price items and displaying views of sale items

I did this in D7 UC3 by adding the following to the mytheme_preprocess_node{} function in my themes template file

    if (isset($vars['sell_price']) && isset($vars['list_price'])){
    if ($vars['sell_price'] < $vars['list_price']){
      $vars['content']['display_price']['#attributes']['class'][] = 'sale-price';
      $vars['content']['list_price']['#attributes']['class'][] = 'old-price';
      $vars['content']['sell_price']['#attributes']['class'][] = 'sale-price';
      $vars['content']['sell_price']['#title'] = 'Sale Price:';
    }
  } 

This also changed the label of sell_price from Price: to Sale Price:

I then added two lines to my css file

.old-price .uc-price{text-decoration:line-through;}
.sale-price .uc-price{color:#a30000;}

To display a block of 'sale' items I have just used a taxonomy tag of 'on sale' and use that as a filter in my view.

To make a block automatically show items that have a sell price lower than list price, I would also consider using either a computed field (module) that = list price - sell price and filter by the computed field < 0, or use views custom field.
Will have to give it a go and report back!