It would be nice to have an additional column displaying the 'per unit' item price in the shopping cart.
Support for this feature was expressed here and in subsequent comments: http://drupal.org/node/529110#comment-2231154
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | cart-unit-price.diff | 2.31 KB | SeanA |
Comments
Comment #1
SeanA commentedHere's a patch against the most recent dev release. Use -p1 when applying.
Comment #2
Cablestein commentedYou can achieve this through a different method...
Put the following code into your own module, enable the module, and voila it works.
Originally the code is from this guy, on his webpage... but I'm posting it here as it's more relevant and safer (ie will be here even if his site goes down).
http://pixeljets.com/blog/adding-price-field-ubercart-cart-page
QUESTION: I should know this, but can't the same code just be pasted into template.php ? I don't know. Anyways this works for me and I'm moving on.
QUESTION 2: Now how about the order overview page on the 1st checkout screen? That should also show unit cost too. I'm surprised this stuff hasn't been in place since Ubercart day 1.
Comment #3
tr commented@SeanA: Ubercart lets you alter the tables to add or remove any column you want, that way everyone gets to pick and choose if the defaults don't suit you. Making a unit price part of the defaults like in your patch may suit you but I guarantee someone else will ask how to remove it. So I don't see any need to change the defaults as long as we have a mechanism that lets you alter the table.
@Cablestein: Thank you for the code demonstrating this. (A little excessive on the tags. Please read http://drupal.org/node/1023102. Tags are not needed for search purposes.)
Now that Views is capable of displaying this sort of thing, we've started to use it to take the place of purpose-built code. If the cart tables were rebuilt with Views, then Views will provide a UI for changing the table without coding. That's something that will probably happen in the future.
Comment #4
SeanA commentedTR, as Cablestein said: "I'm surprised this stuff hasn't been in place since Ubercart day 1." Displaying the unit price is standard across many carts. It totally makes sense to display the unit prices by default. Whatever.
I need to use a custom mini-module for this? "This db-expensive node_load call can be easily avoided by using..." my hack. Much more efficient.
Comment #5
korayal commentedCablestein's solution worked for me, but is it also possible to make the same update on the cart table in the checkout page?
I tried the same on "uc_cart_review_table" but it didn't work.
Comment #6
windtrader commented>> @SeanA: Ubercart lets you alter the tables to add or remove any column you want, that way everyone gets to pick and choose if the defaults don't suit you. Making a unit price part of the defaults like in your patch may suit you but I guarantee someone else will ask how to remove it. So I don't see any need to change the defaults as long as we have a mechanism that lets you alter the table. <<
@TR - I looked high and low in the Ubercart documents for a way to modify the columns in the shopping cart and just did not find anything official. Can someone point me to an existing feature within UC to do this or do I need to use custom methods like those described in this post?
Comment #7
tr commented@Cablestein described how to do it, in #2.
Comment #8
liestc commentedCablestein's solution worked for me, but is it also possible to make the same update on the cart table in the checkout page?
I tried the same on "uc_cart_review_table" but it didn't work.
_____________________________________________________________________
[url=http://www.eurdresses.com]dresses for a wedding[/url]
[url=http://www.eurdresses.com]bride dresses[/url]
Comment #9
Cablestein commentedI still need to get this happening in the cart review table on the Checkout page.
In exploration of this issue I'm simply trying to just affect that table in SOME way but after going through 5 functions I still can't seem to be able to touch it. Like changing the title from "Cart Contents" to anything else. Am I missing something? I'm clear cache on the Performance page, and refreshing admin and/or module pages for the hell of it.
Comment #10
lancewig commentedThis works fine and great until you add attributes (with prices) to your products. It gets a whole lot more complicated at that point because you have to grab the serialized data field, unserialize it, query the 'uc_attributes_options' table and then add that to the existing price (but only if there is an attribute in the first place). I hope somebody can benefit from me staying up til 3 in the morning fighting this. I can't help but think there is a better way to write this but I got it done. Client was pissed because Ubercart doesn't have a 'Unit Price' column unlike just about every other cart out there. The problem was they had products like cards where say, "a single card" is $3.50 and then "a box of 8" is $16. I had a "sell price" set up as $3.50 and an attribute of $12.50 (to make it $16).
EDIT: I have to wonder if it's as simple and dividing $total by $quantity because your already have those variables to work with.
Comment #11
saidoze commentedinstead of
is use
#value -> #markup
only then it displays
Comment #12
loparr commentedHow about displaying custom cck field inside cart table? With availability details for example? Thank you