Hallo
I need to show the discounted price in the catalog.
An example for the page http://myshop.com/catalog/mycategory is the following:

| product image | product name | sell price | discounted price | buy now buttom |

I try to use the uc_advanced_catalog module but in the admin/build/ds/layout/product/list or in admin/store/settings/catalog/edit/advanced I do not see the Discounted Price field .
I found the Discounted Price field only in views.

I have the same need to show the discounted price in cart

| delete | product image | product name | Qty. | total | total discounted price |

The discount amount apperar only after subtotal but this can confuse the buyer because he does not know what products it was applied the discount

Thank you

CommentFileSizeAuthor
#6 no discount price.jpg100.3 KBvmed
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

designate’s picture

subscribing

joshfromdallas’s picture

I was using this fix:

http://drupal.org/node/905368#comment-4694998

to show the discounted price on my catalog pages. It was working great but the dicount was not showing on the payment section on the review order page. So i updated to Discount 2.2 and it fixed the other issue but this stopped working.

This looks like it would solve one of your problems, however it may not solve them both. It needs to be tweaked to work with the latest update, I have been attempting to figure it out but have had no success yet.

joshfromdallas’s picture

Version: 6.x-2.0 » 6.x-2.2

Here is the fixed function if anyone else needs it, just put this in your template.php and then flush your theme reg.

Note: the get_discounted_price changed to uc_discounts_get_discounted_price_for_product($product) commented out old line and added that. Works a charm and you can use css to cross out old price and put new price in red if ya want.

function phptemplate_uc_catalog_product_grid($products) {  
	$product_table = '<div class="category-grid-products"><table>';  
	$count = 0;  $context = array(    
		'revision' => 'themed',    
		'type' => 'product',  
	);  
	foreach ($products as $nid) {    
		$product = node_load($nid);    
		$context['subject'] = array('node' => $product);    
		
		if ($count == 0) {      
			$product_table .= "<tr>";    
		}    
		elseif ($count % variable_get('uc_catalog_grid_display_width', 3) == 0) {
			$product_table .= "</tr><tr>";    
			}    
			
		$titlelink = l($product->title, "node/$nid", array('html' => TRUE));    
		if (module_exists('imagecache') && ($field = variable_get('uc_image_'. $product->type, '')) && isset($product->$field) && file_exists($product->{$field}[0]['filepath'])) {      
		$imagelink = l(theme('imagecache', 'product_list', $product->{$field}[0]['filepath'], $product->title, $product->title), "node/$nid", array('html' => TRUE));    
		}    
		else {      
			$imagelink = '';    
		}    
		
		$product_table .= '<td>';    
		if (variable_get('uc_catalog_grid_display_title', TRUE)) {
			$product_table .= '<span class="catalog-grid-title">'. $titlelink .'</span>';    
			}    
			if (variable_get('uc_catalog_grid_display_model', TRUE)) {
				$product_table .= '<span class="catalog-grid-ref">'. $product->model .'</span>';    
				}    
				$product_table .= '<span class="catalog-grid-image">'. $imagelink .'</span>';    
				if (module_exists('uc_discounts')) {  
					$discounted_price = uc_discounts_get_discounted_price_for_product($product);    
					/*$discounted_price = theme("uc_discounts_get_discounted_price_for_product", $product);*/        
					if (!is_null($discounted_price) && $product->sell_price > $discounted_price) {            
				if (variable_get('uc_catalog_grid_display_sell_price', TRUE)) {              
					$product_table .= '<p class="original-sell-price">'. uc_price($product->sell_price, $context) .'</p>';            
					}            
					$product_table .= '<span class="field-type-discounted-price">SALE<br /> '. theme("product_discounted_price", $product, uc_price($discounted_price, $context)) .'</span>';            		}            
					else {            
					if (variable_get('uc_catalog_grid_display_sell_price', TRUE)) {              
						$product_table .= '<span class="catalog-grid-sell-price">'. uc_price($product->sell_price, $context) .'</span>';            
					}            
					}            
					theme("add_product_price_altering_css", $product);            
					theme("add_product_price_altering_javascript", $product);        
				}        
				else {           
					if (variable_get('uc_catalog_grid_display_sell_price', TRUE)) {             
						$product_table .= '<span class="catalog-grid-sell-price">'. uc_price($product->sell_price, $context) .'</span>';           
					}        
				}    
				if (module_exists('uc_cart') && variable_get('uc_catalog_grid_display_add_to_cart', TRUE)) {      
					if (variable_get('uc_catalog_grid_display_attributes', TRUE)) {        
						$product_table .= theme('uc_product_add_to_cart', $product);      
					}      
					else {        
						$product_table .= drupal_get_form('uc_catalog_buy_it_now_form_'. $product->nid, $product);      
					}    
				}    
			$product_table .= '</td>';    $count++;  
		}  
	$product_table .= "</tr></table></div>";  
	return $product_table;
}
JFreed’s picture

Great this was helpful thanks.

vmed’s picture

hi there,
i use the default danland theme, in witch file do i add the code to ?

thanks
johan

vmed’s picture

FileSize
100.3 KB

anyone a idea ? , i need the discount price in the field prijs ! , any idea how ???, i use the danland theme !

see attached image for my catalog page

thanks
johan

designate’s picture

Title: Show discounted Price on Catalog Page » Show discounted Price on Catalog Page/ grid
Version: 6.x-2.2 » 6.x-2.4
Category: feature » support

Anybody?

I use UC 2.9, Discounts 2.4 with Advanced Catalog & Display Suite/ Node Display. Adding CCK fields Codeless Discounts & Discounted Price to the product content type makes the discount nicely shown on the product page but it is not showing in the catalog grid. I tried to make a field via Node Display [module display settings] displaying the cck value. print $object -> field_discounted; I only get "array" returned.

Other way i tried was via Token Field, but then again the discounted price is not shown and only "[field_discounted]".

Ryanm81’s picture

This works for me in Drupal 7 with Ubercart 3. I could not do this so I paid for someone to do it for me so I am just sharing it here to help others and may not be able to answer any questions for customizing it sorry.

Views Price: If sell price is less than list price then display both prices in separate spans. If sell price = list price than just outputs the normal sell price.

1. Add normal ubercart fields 'Sell Price' and 'List Price' to the view - set these to 'Do not display'
2. Use the 'Global PHP' module to create a PHP field in views
3. In the global PHP field enter this:

<?php 
$sell_pri = number_format($row->sell_price, variable_get('uc_currency_prec', 2), '.', ''); 
$list_pri = number_format($row->list_price, variable_get('uc_currency_prec', 2), '.', '');
if ($sell_pri < $list_pri) {echo '<span class="old-price"> $' .$list_pri. '</span> <span class="new-price"> $' .$sell_pri. '</span>';}
else {echo '$'.$sell_pri;}
?>

This will output both prices if they are different. Then just theme in css old-price and sell-price to create strikethough in old price etc.

For main product page you can use the same code either through display suite for a custom field, or using a custom field to display the view. Or if you are theming the .tpl file I suppose you can just use the same code above in template file I or create a function and call the function in the template - I am not sure - I just know it works in views for me.

vood002’s picture

I used the computed field module for this, pretty simple solution that can be used globally.

https://www.drupal.org/project/computed_field

The code is basic, this is what my function looks like:

<?php
	$output = '';
	
	if ($entity->list_price > $entity->sell_price){
		$output .= '<span class="list-price">' . theme('uc_price', array('price' => $entity->list_price ) ) . '</span>';
	}

	$output .= '<span class="sell-price">' . theme('uc_price', array('price' => $entity->sell_price ) ) . '</span>';

	return $output;
?>
apaderno’s picture

Issue summary: View changes
Status: Active » Closed (outdated)
Issue tags: -Ubercart, -advanced catalog, -Discounts Alternative

I am closing this issue, as Drupal 6 is now not supported.