Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Attribute Price to Appear in Shopping Cart

Attribute Price to Appear in Shopping Cart

Locked

Views: 3,475

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
6 Nov 2007, 9:45 PM
#1
xtreme_exhibits avatar

xtreme_exhibits

New Zenner

Join Date:
Nov 2007
Posts:
17
Plugin Contributions:
0

Attribute Price to Appear in Shopping Cart

How can I accomplish this?

I need to start with a base pice of lets say $600. Then allow the customer to add on options such as an upgraded case for $300 and some fabric or graphics for another $600.

I set up the attributes fine and can get the proper price to appear in the shopping cart. HOWEVER, its quite a shocker for the customer to start with a product that only cost them $600 and end up with a shopping cart with a total of $1500. I'd like to have the shopping cart show how much each of the attributes they selected cost and how we arrived at the end total.

This way they don't have to hit the back button to re-calculate their spending and the totals.

Your help is sincerely appreciated!

7 Nov 2007, 1:05 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Attribute Price to Appear in Shopping Cart

You would have to re-write the whole section of the shopping cart to display these amounts ...

This can get rather complex in changing the way the display works ...

While it is not impossible, it could be done ... just a lot of work ...

7 Nov 2007, 1:10 AM
#3
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,616
Plugin Contributions:
0

Re: Attribute Price to Appear in Shopping Cart

You might want to have a look in our downloads section for the Javascript price updater.

14 Jul 2008, 1:41 PM
#4
rikochet avatar

rikochet

New Zenner

Join Date:
Jul 2008
Posts:
3
Plugin Contributions:
0

Re: Attribute Price to Appear in Shopping Cart

you got a specific download in mind? i can't seem to find any that do that...

it's frustrating, it seems like something that more people - if not everyone - would want!

anyone got any other ideas? i have to have this feature in my site!

thanks, ricky

10 Jul 2009, 9:22 PM
#5
sitehatchery avatar

sitehatchery

New Zenner

Join Date:
Mar 2007
Posts:
77
Plugin Contributions:
0

Re: Attribute Price to Appear in Shopping Cart

This was a long time ago, but it's top of google for "zen cart itemize attributes", so I'll give a fix here to save people the trouble:

tpl_shopping_cart_default.php

Comment out:

<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li>
 
``` and insert this:

if((int)$value['options_values_price']){ $price=money_format('%i', $value['options_values_price'] ); }
if($price){ $display_price=" (".$value['price_prefix'] . " $" . $price . ")"; }
echo '<li>' . $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']) . $display_price . '</li>';

$this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']);

if((int)$this->products[$i]['attributes'][$j]['price']){
$price=money_format('%i',$this->products[$i]['attributes'][$j]['price']);
$display_price=" (".$this->products[$i]['attributes'][$j]['prefix'] . " $" . $price . ")";
}
$this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value'] . $display_price);

11 Jul 2009, 2:48 AM
#6
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: Attribute Price to Appear in Shopping Cart

Thanks sitehatchery!

That was a really cool and useful answer that I learned something from!

11 Jul 2009, 3:11 AM
#7
sitehatchery avatar

sitehatchery

New Zenner

Join Date:
Mar 2007
Posts:
77
Plugin Contributions:
0

Re: Attribute Price to Appear in Shopping Cart

Thanks!

20 Nov 2009, 4:46 PM
#8
avengergirl avatar

avengergirl

Banned

Join Date:
Nov 2009
Posts:
2
Plugin Contributions:
0

Re: Attribute Price to Appear in Shopping Cart

Thank you sitehatchery for the code! :smile:

It does insert the attribute prices, but it appears to insert even if the selected attribute does not have a price associated with it.

That is, my regular t-shirt that costs $10 also shows the additional $2.00 that is charged on the x-large. Though, the total price is correct.

Not sure if I made the error here, or if it is supposed to work this way and just isn't ideal for my situation....?

21 Nov 2009, 6:39 AM
#9
sitehatchery avatar

sitehatchery

New Zenner

Join Date:
Mar 2007
Posts:
77
Plugin Contributions:
0

Re: Attribute Price to Appear in Shopping Cart

I should have initialized $display_price and $price before the code was executed:

$display_price='';
$price='';

25 Nov 2009, 2:19 PM
#10
avengergirl avatar

avengergirl

Banned

Join Date:
Nov 2009
Posts:
2
Plugin Contributions:
0

Re: Attribute Price to Appear in Shopping Cart

It worked, thanks again! :D

26 Oct 2010, 8:13 PM
#11
giftmeister avatar

giftmeister

Zen Follower

Join Date:
Jan 2009
Location:
Montreal, Canada
Posts:
230
Plugin Contributions:
0

Re: Attribute Price to Appear in Shopping Cart

Thanks a mil, I was also looking for this.

  • For those less technically inclined, can you clarify what to do with your last message? ...initialized $display_price=''; $price=''; (I'm the type who did not realize at first that the new code for tpl_shopping... needed <?php around it.)

  • It works on my site, yet the item price still includes the attributes price even though the attribute is now listed with its price and even though the attribute controller was set to No for 'Include in Base Price When Priced by Attributes.' Do you know what I'm overlooking?

R