I'm not too sure if this is the right area to be posting and if not please direct me to a more appropriate place. I have installed Ubercart + Display Suite and I'm having problems getting the "price" field to show when I customize a layout. There is not even an option in the layout for the field to be placed in any region. I checked all the modules to make sure everything was turned on and it appears so. Does anyone have any suggestions as to why the price field will not show?

Comments

F0rumus3r’s picture

I kind of solved this problem but created another one along the way. For those who may be interested:

I went to Display Suite> Node Displays > Fields

Click 'Add new code field'
Populate Field Key and Field Title
Select which types of content you want to EXCLUDE from the new field
Toggel 'Toggle this checkbox if you are using tokens in this field" ON
Go through the list and find which Token is best suited, for me it was [sell_price]
Save Code Field

Now you can select where you want this field on your layout page

Now the problem . . .

The price displays now but unfortunately it has added extra decimal places -6 to be exact. Instead of an amount displaying as $150.99 it is now displaying as $159.990000

I did check my store configuration to make sure I had the currency correct and I do. I'm not to sure where to go from here.

swentel’s picture

Status: Active » Closed (fixed)

You can either use the uc_price() function (included in uc_store/includes/uc_price.inc) or use php functions like money_format (see php.net/money_format)

F0rumus3r’s picture

Thank you for the suggestion! Unfortunately PHP is not a strength (I've never used it before today). I looked up the tutorial and I kind of get it. I've tried to implement the code and I've been having a hell of a time trying to get it to work.

Show examples of my failed attempts include:

[sell_price] , money_format(.2) 

//or

[sell_prince, money_format(.2)]

//or

[sell_price];
money_format(.2);

I can't get get any combination of these to work. I'm pretty frustrated.

jami3z’s picture

I had the same issue. seems like a bug. if [sell_price] is already available then why would it not work?

i did the same work around as #1, but to get the themed price i added the following in the field code:

<?php
  $context = array('revision' => 'themed', 'type'  => 'amount');
  print uc_price($subtotal, $context);
?>
designate’s picture

Title: Price not showing? » Price not showing when price is 0.00?

Since I'm no php-type-of-guy; How to only show the price on the above mentioned (#4) way when the sell price is greater than 0.00? Thus not showing the price [and label] when it's 0 [in case of ubercart price quote] What syntax to use?